ArcStrabo10.ButtonColorSegmentation.OnClick C# (CSharp) Метод

OnClick() защищенный Метод

protected OnClick ( ) : void
Результат void
        protected override void OnClick()
        {
            string straboPath = Environment.GetEnvironmentVariable(ArcStrabo10Extension.EnvironmentVariableSTRABO_HOME, EnvironmentVariableTarget.User);
            string tessPath = Environment.GetEnvironmentVariable(ArcStrabo10Extension.EnvironmentVariableTESS_DATA, EnvironmentVariableTarget.User);

            if (ArcStrabo10Extension.PathSet == false)
            {

                if (String.IsNullOrEmpty(straboPath) == true)
                {
                    MessageBox.Show(ArcStrabo10Extension.ErrorMsgNoStraboHome);
                    return;
                }
                if (String.IsNullOrEmpty(tessPath) == true)
                {
                    MessageBox.Show(ArcStrabo10Extension.ErrorMsgNoTess_Data);
                    return;
                }

                bool Initialize_straboPath_Correct = ArcStrabo10Extension.initialize_straboPath_directories(straboPath);

                if (Initialize_straboPath_Correct == false)
                {
                    MessageBox.Show(ArcStrabo10Extension.ErrorMsgNoStraboHomeWritePermission);
                    return;
                }

                ArcStrabo10Extension.PathSet = true;
            }
            //
            //  TODO: Sample code showing how to access button host
            //
            ArcMap.Application.CurrentTool = null;
            ComboBoxLayerSelector layerNameCombo = ComboBoxLayerSelector.GetLayerNameComboBox();

            RasterLayer rasterlayer = new RasterLayer();
            rasterlayer = ((RasterLayer)layerNameCombo.GetSelectedLayer());
            //raster.Raster
            //RasterLayer raster2 = new RasterLayer();
            //raster2.CreateFromRaster(raster.Raster);
            //IMap map = ArcMap.Document.FocusMap;
            //map.AddLayer((ILayer)raster2);
            //MessageBox.Show(layerNameCombo.selected_layer_name + " " + raster2.RowCount + " " + raster2.ColumnCount + " " + raster2.BandCount);
            ColorSegmentationWorker cs = new ColorSegmentationWorker();
            try
            {
                IRaster2 iraster2 = rasterlayer.Raster as IRaster2;
                string[] bitmap_fns = cs.Apply(System.IO.Path.GetDirectoryName(iraster2.RasterDataset.CompleteName) + "\\", ArcStrabo10Extension.Text_Result_Path + "\\", System.IO.Path.GetFileName(iraster2.RasterDataset.CompleteName));
                IMap map = ArcMap.Document.FocusMap;
                foreach (string path in bitmap_fns)
                {
                    //RasterDataset rds = new RasterDataset();
                    //rds.OpenFromFile(path);
                    RasterLayer rasterlayer2 = new RasterLayer();
                    rasterlayer2.CreateFromFilePath(path);
                    map.AddLayer(rasterlayer2);
                }
            }
            catch (Exception e)
            {

                Console.WriteLine(e.ToString());
            }
        }
ButtonColorSegmentation