async void newService_Click(object sender, EventArgs e)
        {
            List <ExplorerDialogFilter> filters = new List <ExplorerDialogFilter>();

            filters.Add(new OpenMapFilter());

            ExplorerDialog exDialog = new ExplorerDialog("Select Map", filters, true);

            if (exDialog.ShowDialog() == DialogResult.OK)
            {
                List <IMap> maps = new List <IMap>();
                foreach (IExplorerObject exObject in exDialog.ExplorerObjects)
                {
                    var exObjectInstance = await exObject.GetInstanceAsync();

                    if (exObjectInstance is IMap)
                    {
                        maps.Add((IMap)exObjectInstance);
                    }
                }

                FormAddServices services = new FormAddServices(maps);
                if (services.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    await AddMap2Connection(services.ServiceNames, services.Maps);
                }

                if (_refreshDelegate != null)
                {
                    await _refreshDelegate();
                }
            }
        }
Exemple #2
0
        public void Content_DragDrop(System.Windows.Forms.DragEventArgs e)
        {
            foreach (string format in e.Data.GetFormats())
            {
                object ob = e.Data.GetData(format);
                if (ob is List <IExplorerObjectSerialization> )
                {
                    ExplorerObjectManager exObjectManager = new ExplorerObjectManager();

                    List <IExplorerObject> exObjects = exObjectManager.DeserializeExplorerObject((List <IExplorerObjectSerialization>)ob);
                    if (exObjects == null)
                    {
                        return;
                    }

                    foreach (IExplorerObject exObject in exObjects)
                    {
                        if (exObject is IExplorerParentObject)
                        {
                            ((IExplorerParentObject)exObject).Refresh();
                        }
                        if (exObject.Object is IFeatureDataset)
                        {
                            IDataset dataset = (IDataset)exObject.Object;

                            FormDatasetProperties dlg = new FormDatasetProperties(dataset);
                            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                Map map = new Map();
                                map.AddDataset(dataset, 0);
                                map.Name = dataset.DatasetName;

                                map.Limit = map.Envelope = ((IFeatureDataset)dataset).Envelope;
                                FormAddServices services = new FormAddServices(map);
                                if (services.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                {
                                    AddMap2Connection(services.ServiceNames, services.Maps);
                                }
                            }
                        }
                        else if (exObject.Object is IMap)
                        {
                            FormAddServices services = new FormAddServices((IMap)exObject.Object);
                            if (services.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                AddMap2Connection(services.ServiceNames, services.Maps);
                            }
                        }
                        else if (exObject.Object is IMapDocument)
                        {
                            FormAddServices services = new FormAddServices(((IMapDocument)exObject.Object).Maps);
                            if (services.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                AddMap2Connection(services.ServiceNames, services.Maps);
                            }
                        }
                    }
                }
            }
        }