예제 #1
0
        /// <summary>
        /// Show the Bookmark DockPane.
        /// </summary>
        internal static void ShowBookmarkPane()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find("mapExploration_BookmarksDockPane");

            if (pane == null)
            {
                return;
            }

            pane.Activate();
        }
        /// <summary>
        /// Show the DockPane.
        /// </summary>
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);

            if (pane == null)
            {
                return;
            }

            pane.Activate();
        }
        /// <exclude />
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
            {
                DockPane.Activate();
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDOWN)
            {
                if (DockPane.DockPanel.AllowRedocking && DockPane.AllowRedocking &&
                    !DockHelper.IsDockStateAutoHide(DockPane.DockState))
                {
                    DockPane.DockPanel.DragHandler.BeginDragPane(DockPane, ClientRectangle.Location);
                }
                else
                {
                    base.WndProc(ref m);
                }
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
            {
                base.WndProc(ref m);

                if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
                {
                    DockPane.DockPanel.ActiveAutoHideContent = null;
                    return;
                }

                DockContent activeContent = DockPane.DockPanel.ActiveContent;
                for (int i = 0; i < DockPane.Tabs.Count; i++)
                {
                    DockContent content = DockPane.Tabs[i].Content;
                    if (DockPane.IsFloat)
                    {
                        DockPane.RestoreToPanel();
                    }
                    else
                    {
                        DockPane.Float();
                    }
                    if (activeContent != null)
                    {
                        activeContent.Activate();
                    }
                }
                return;
            }

            base.WndProc(ref m);
        }
        /// <summary>
        /// Show the DockPane.
        /// </summary>
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);

            if (pane == null)
            {
                return;
            }

            pane.Activate();
            //Settings will be loaded either when the project is opened (the settings pane is already visible) or when the pane is shown
            ((SettingsDockpaneViewModel)pane).LoadSettings();
        }
        /// <summary>
        /// Show the DockPane.
        /// </summary>
        internal static void Show()
        {
            if (_this != null)
            {
                _this.SetPolygonLayer();
            }
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);

            if (pane == null)
            {
                return;
            }

            pane.Activate();
        }
        private void MainOpenEdit_Button(object sender, RoutedEventArgs e)
        {
            if (StaticVariables.archesInstanceURL == "" | StaticVariables.archesInstanceURL == null)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please, Log in to Arches Server...");
                return;
            }

            DockPane pane = FrameworkApplication.DockPaneManager.Find("arches_arcgispro_addin_SaveResource");

            if (pane == null)
            {
                return;
            }
            pane.Activate();
        }
예제 #7
0
        /// <summary>
        /// Show the DockPane.
        /// </summary>
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);

            if (pane == null)
            {
                return;
            }

            //The very first time, if the pane is not visible, set the
            //selection tool active
            if (!pane.IsVisible && !_oneShot)
            {
                _oneShot = true;
                FrameworkApplication.SetCurrentToolAsync("esri_mapping_selectByRectangleTool");
            }
            pane.Activate();
        }
예제 #8
0
        /// <summary>
        /// Show the DockPane.
        /// </summary>
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);

            if (pane == null)
            {
                return;
            }

            pane.Activate();

            var vm = pane as DefineQueryDefinitionFiltersViewModel;

            if (vm != null && MapView.Active != null)
            {
                vm.GetMapMembers(MapView.Active);
                vm.InitializeFilters();
            }
        }
예제 #9
0
        /// <summary>
        /// Show the DockPane.
        /// </summary>
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);

            if (pane == null)
            {
                return;
            }

            pane.Activate();

            var vm = pane as DefinitionQueryDockPaneViewModel;

            if (vm != null && MapView.Active != null)
            {
                vm.ClearControlProperties();
                vm.BuildControlProperties(MapView.Active);
            }
        }
예제 #10
0
        private async void EditCourse()
        {
            await QueuedTask.Run(() =>
            {
                //hide all tools except line tool on layer
                var featLayer              = MapView.Active.Map.FindLayers(ConstDefintion.ConstFeatureClass_Course).First();
                var editTemplates          = featLayer.GetTemplates();
                var newCIMEditingTemplates = new List <CIMEditingTemplate>();
                foreach (var et in editTemplates)
                {
                    // initialize template by activating default tool
                    et.ActivateDefaultToolAsync();
                    var cimEditTemplate = et.GetDefinition();
                    // get the visible tools on this template
                    var allTools = et.ToolIDs.ToList();
                    // add the hidden tools on this template
                    allTools.AddRange(cimEditTemplate.GetExcludedToolDamlIds().ToList());
                    // hide all the tools then allow the line tool
                    cimEditTemplate.SetExcludedToolDamlIds(allTools.ToArray());
                    cimEditTemplate.AllowToolDamlID(ConstDefintion.ConstID_SketchLineTool);
                    newCIMEditingTemplates.Add(cimEditTemplate);
                }
                // update the layer templates
                var layerDef = featLayer.GetDefinition() as CIMFeatureLayer;
                // Set AutoGenerateFeatureTemplates to false for template changes to stick

                layerDef.AutoGenerateFeatureTemplates = false;
                layerDef.FeatureTemplates             = newCIMEditingTemplates.ToArray();
                featLayer.SetDefinition(layerDef);
                MapView.Active.ZoomToAsync(featLayer);
            });

            FrameworkApplication.ActivateTab(ConstDefintion.ConstID_EditingTab);
            DockPane dp = FrameworkApplication.DockPaneManager.Find(ConstDefintion.ConstID_CreateFeaturesDockPane);

            if (dp != null)
            {
                dp.Activate();
            }
        }
예제 #11
0
        private void EditOpenChromium_Button(object sender, RoutedEventArgs e)
        {
            if (StaticVariables.archesInstanceURL == "" | StaticVariables.archesInstanceURL == null)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please, Log in to Arches Server...");

                DockPane pane = FrameworkApplication.DockPaneManager.Find("arches_arcgispro_addin_MainDockpane");
                if (pane == null)
                {
                    return;
                }
                pane.Activate();
                return;
            }
            if (StaticVariables.archesResourceid == "" | StaticVariables.archesResourceid == null)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please, Register the Resource to Edit...");
                return;
            }
            string editorAddress = StaticVariables.archesInstanceURL + $"resource/{StaticVariables.archesResourceid}";

            UI.ChromePaneViewModel.OpenChromePane(editorAddress);
        }
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID2);

            if (pane == null)
            {
                return;
            }
            else
            {
                string dateInString = "02.01.2020";

                DateTime startDate  = DateTime.Parse(dateInString);
                DateTime expiryDate = startDate.AddDays(29);
                if (DateTime.Now > expiryDate)
                {
                    MessageBox.Show("This Trial has expired.  Thank you for trying Q Pro for SAP. " + Environment.NewLine + Environment.NewLine + "We would appreciate any feedback you may have.  Please report bugs and/or enhancements to [email protected] ." + Environment.NewLine + Environment.NewLine + "You can uninstall this addin by using ArcGIS Pro's AddIn Manager." + Environment.NewLine + Environment.NewLine + "If you are interested in purchasing Q Pro for SAP please contact Quartic Solutions at [email protected] or visit our website www.quarticsolutions.com");
                }
                else
                {
                    pane.Activate();
                }
            }
        }
        private async void GetAttribute()
        {
            if (StaticVariables.archesInstanceURL == "" | StaticVariables.archesInstanceURL == null)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please, Log in to Arches Server...");

                DockPane pane = FrameworkApplication.DockPaneManager.Find("arches_arcgispro_addin_MainDockpane");
                if (pane == null)
                {
                    return;
                }
                pane.Activate();
                return;
            }

            await QueuedTask.Run(async() =>
            {
                var selectedFeatures = MapView.Active.Map.GetSelection();
                if (selectedFeatures.Count == 1)
                {
                    var firstSelectionSet = selectedFeatures.First();
                    if (firstSelectionSet.Value.Count == 1)
                    {
                        LayerName           = firstSelectionSet.Key.Name;
                        var archesInspector = new Inspector();
                        archesInspector.Load(firstSelectionSet.Key, firstSelectionSet.Value);
                        _attributeValues.Clear();
                        try
                        {
                            foreach (var attribute in archesInspector)
                            {
                                AttributeValue newAttribute = new AttributeValue(attribute.FieldAlias, attribute.CurrentValue.ToString());
                                _attributeValues.Add(newAttribute);
                            }

                            StaticVariables.archesResourceid = archesInspector["resourceinstanceid"].ToString();
                            StaticVariables.archesTileid     = archesInspector["tileid"].ToString();
                            StaticVariables.archesNodeid     = archesInspector["nodeid"].ToString();
                            ResourceIdEdited = StaticVariables.archesResourceid;
                        }
                        catch (Exception ex)
                        {
                            ClearAttributeValues();
                            Message = $"This feature may not exist at \n{StaticVariables.archesInstanceURL}\n{ex.Message}";
                            return;
                        }

                        try
                        {
                            var result = await CheckInstancePermission(StaticVariables.archesResourceid);
                            if (!result["edit"])
                            {
                                ClearAttributeValues();
                                Message              = "You do not have a permission to edit this Resource Instance";
                                Registered           = false;
                                MessageBoxVisibility = "Visible";
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            ClearAttributeValues();
                            Message = $"Connection Failed \n{ex.Message}";
                            return;
                        }
                        Registered             = true;
                        RegisteredVisibility   = "Visible";
                        UnregisteredVisibility = "Hidden";
                        MessageBoxVisibility   = "Hidden";
                    }
                    else
                    {
                        ClearAttributeValues();
                        Message = "Make Sure to Select ONE valid geometry";
                    }
                }
                else
                {
                    ClearAttributeValues();
                    Message = "Make Sure to Select from ONE Arches Layer";
                }
            });
        }
예제 #14
0
        private void Content_OnEndDrag(bool abort)
        {
            User32.SetCursor(DragControl.Cursor.Handle);

            if (abort)
            {
                return;
            }

            DockContent content = ((DockPane)DragControl).ActiveContent;

            if (DropTarget.DropTo is DockPane)
            {
                DockPane paneTo = DropTarget.DropTo as DockPane;

                if (DropTarget.Dock == DockStyle.Fill)
                {
                    bool samePane = (content.Pane == paneTo);
                    if (!samePane)
                    {
                        content.Pane = paneTo;
                    }

                    if (DropTarget.ContentIndex == -1 || !samePane)
                    {
                        paneTo.SetContentIndex(content, DropTarget.ContentIndex);
                    }
                    else
                    {
                        DockContentCollection contents = paneTo.Contents;
                        int oldIndex = contents.IndexOf(content);
                        int newIndex = DropTarget.ContentIndex;
                        if (oldIndex < newIndex)
                        {
                            newIndex += 1;
                            if (newIndex > contents.Count - 1)
                            {
                                newIndex = -1;
                            }
                        }
                        paneTo.SetContentIndex(content, newIndex);
                    }

                    content.Activate();
                }
                else
                {
                    DockPane           pane      = content.DockPanel.DockPaneFactory.CreateDockPane(content, paneTo.DockState, true);
                    IDockListContainer container = paneTo.DockListContainer;
                    if (DropTarget.Dock == DockStyle.Left)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Left, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Right)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Right, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Top)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Top, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Bottom)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Bottom, 0.5);
                    }

                    pane.DockState = paneTo.DockState;
                    pane.Activate();
                }
            }
            else if (DropTarget.DropTo is DockPanel)
            {
                DockPane  pane;
                DockPanel dockPanel = content.DockPanel;
                if (DropTarget.Dock == DockStyle.Top)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockTop, true);
                }
                else if (DropTarget.Dock == DockStyle.Bottom)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockBottom, true);
                }
                else if (DropTarget.Dock == DockStyle.Left)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockLeft, true);
                }
                else if (DropTarget.Dock == DockStyle.Right)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockRight, true);
                }
                else if (DropTarget.Dock == DockStyle.Fill)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.Document, true);
                }
                else
                {
                    return;
                }

                pane.Activate();
            }
            else if (IsDockStateValid(DockState.Float))
            {
                Point ptMouse = Control.MousePosition;

                Size  size = FloatWindow.DefaultWindowSize;
                Point location;
                if (content.DockState == DockState.Document)
                {
                    location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y);
                }
                else
                {
                    location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y - size.Height);
                }

                if (ptMouse.X > location.X + size.Width)
                {
                    location.X += ptMouse.X - (location.X + size.Width) + OutlineBorderWidth;
                }

                DockPane pane = content.DockPanel.DockPaneFactory.CreateDockPane(content, new Rectangle(location, size), true);
                pane.Activate();
            }
        }
예제 #15
0
        internal static void Show()
        {
            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);

            pane?.Activate();
        }
예제 #16
0
        private void Pane_OnEndDrag(bool abort)
        {
            User32.SetCursor(DragControl.Cursor.Handle);

            if (abort)
            {
                return;
            }

            DockPane pane = (DockPane)DragControl;

            if (DropTarget.DropTo is DockPane)
            {
                DockPane paneTo = DropTarget.DropTo as DockPane;

                if (DropTarget.Dock == DockStyle.Fill)
                {
                    for (int i = pane.Contents.Count - 1; i >= 0; i--)
                    {
                        DockContent c = pane.Contents[i];
                        c.Pane = paneTo;
                        if (DropTarget.ContentIndex != -1)
                        {
                            paneTo.SetContentIndex(c, DropTarget.ContentIndex);
                        }
                        c.Activate();
                    }
                }
                else
                {
                    if (DropTarget.Dock == DockStyle.Left)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Left, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Right)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Right, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Top)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Top, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Bottom)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Bottom, 0.5);
                    }

                    pane.DockState = paneTo.DockState;
                    pane.Activate();
                }
            }
            else if (DropTarget.DropTo is DockPanel)
            {
                if (DropTarget.Dock == DockStyle.Top)
                {
                    pane.DockState = DockState.DockTop;
                }
                else if (DropTarget.Dock == DockStyle.Bottom)
                {
                    pane.DockState = DockState.DockBottom;
                }
                else if (DropTarget.Dock == DockStyle.Left)
                {
                    pane.DockState = DockState.DockLeft;
                }
                else if (DropTarget.Dock == DockStyle.Right)
                {
                    pane.DockState = DockState.DockRight;
                }
                else if (DropTarget.Dock == DockStyle.Fill)
                {
                    pane.DockState = DockState.Document;
                }

                pane.Activate();
            }
            else if (IsDockStateValid(DockState.Float))
            {
                Point ptMouse = Control.MousePosition;

                Point location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y);
                Size  size;
                bool  createFloatWindow = true;
                if (pane.FloatWindow == null)
                {
                    size = FloatWindow.DefaultWindowSize;
                }
                else if (pane.FloatWindow.DockList.Count == 1)
                {
                    size = pane.FloatWindow.Size;
                    createFloatWindow = false;
                }
                else
                {
                    size = FloatWindow.DefaultWindowSize;
                }

                if (ptMouse.X > location.X + size.Width)
                {
                    location.X += ptMouse.X - (location.X + size.Width) + OutlineBorderWidth;
                }

                if (createFloatWindow)
                {
                    pane.FloatWindow = pane.DockPanel.FloatWindowFactory.CreateFloatWindow(pane.DockPanel, pane, new Rectangle(location, size));
                }
                else
                {
                    pane.FloatWindow.Bounds = new Rectangle(location, size);
                }

                pane.DockState = DockState.Float;
                pane.Activate();
            }
        }
        /// <exclude/>
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
            {
                DockPane.Activate();
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDOWN)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    DockContent content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        DockPane.ActiveContent = content;
                        Update();
                    }
                    if (DockPane.DockPanel.AllowRedocking && DockPane.AllowRedocking && DockPane.ActiveContent.AllowRedocking)
                    {
                        DockPane.DockPanel.DragHandler.BeginDragContent(DockPane, DockPane.ClientRectangle);                         //DockPane.DisplayingRectangle);
                    }
                }
                else
                {
                    base.WndProc(ref m);
                }
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_RBUTTONDOWN)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    DockContent content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        DockPane.ActiveContent = content;
                    }
                }
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_RBUTTONUP)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    DockContent content = Tabs[index].Content;
                    if (content.TabPageContextMenu != null)
                    {
                        content.TabPageContextMenu.Show(this, this.PointToClient(Control.MousePosition));
                    }
                }
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
            {
                base.WndProc(ref m);

                int index = GetHitTest();
                if (DockPane.DockPanel.AllowRedocking && index != -1)
                {
                    DockContent content = Tabs[index].Content;
                    try     { content.IsFloat = !content.IsFloat; }
                    catch   {       }
                }

                return;
            }

            base.WndProc(ref m);
            return;
        }
        protected override async Task <bool> OnSketchCompleteAsync(ArcGIS.Core.Geometry.Geometry geometry)
        {
            try
            {
                if (_graphic != null)
                {
                    _graphic.Dispose();
                }
                //Polygon polygon;
                //await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
                //{
                //    List<Coordinate2D> coordinates2 = new List<Coordinate2D>()
                //{
                //  //new Coordinate2D(-159.20168702818188, 21.876487211082708),
                //  //new Coordinate2D(-159.42653907783114, 21.838951660451173),
                //  //new Coordinate2D(-159.44077880308507, 21.94718691051718),
                //  //new Coordinate2D(-159.21630329750306, 21.94718691051718),
                //  //new Coordinate2D(-159.21413990271841, 21.9365008022738),
                //  //new Coordinate2D(-159.21383956606297, 21.93655454291286),
                //  //new Coordinate2D(-159.20168702818188, 21.876487211082708),
                //  new Coordinate2D(-17773406.8675, 2478583.7239999995),
                //  new Coordinate2D(-17773406.8675, 2578583.7239999995),
                //  new Coordinate2D(-16773406.8675, 2578583.7239999995),
                //  new Coordinate2D(-17773406.8675, 2478583.7239999995)
                //};
                //    CIMPolygonSymbol _polygonSymbol = null;
                //    _polygonSymbol = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.BlackRGB, SimpleFillStyle.Null, SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid));
                //    using (PolygonBuilder polygonBuilder = new PolygonBuilder(coordinates2, MapView.Active.Extent.SpatialReference))
                //    {
                //        polygonBuilder.SpatialReference = MapView.Active.Extent.SpatialReference;
                //        polygon = polygonBuilder.ToGeometry();
                //        geometry = polygonBuilder.ToGeometry();
                //        //Geometry geometry2 = GeometryEngine.Instance.ProjectEx(geometry, projTransFromSRs);
                //        _graphic = MapView.Active.AddOverlayAsync(geometry, _polygonSymbol.MakeSymbolReference());
                //    }
                //});

                //return true;
                //DockPane pane = FrameworkApplication.DockPaneManager.Find("test_docing_Panel_PlanetDocPane");
                DockPane pane = FrameworkApplication.DockPaneManager.Find("test_docing_Panel_Demo");
                //PlanetDocPaneViewModel planetDocPaneViewModel = (PlanetDocPaneViewModel)pane;
                //planetDocPaneViewModel.Users = "New collection"
                pane.Enabled = true;
                //Add an overlay graphic to the map view
                _graphic = await this.AddOverlayAsync(geometry, _lineSymbol.MakeSymbolReference());

                //define the text symbol
                var textSymbol = new CIMTextSymbol();
                //define the text graphic
                var textGraphic = new CIMTextGraphic();

                //await QueuedTask.Run(() =>
                //{
                //    //Create a simple text symbol
                //    textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 8.5, "Corbel", "Regular");
                //    //Sets the geometry of the text graphic
                //    textGraphic.Shape = geometry;
                //    //Sets the text string to use in the text graphic
                //    //textGraphic.Text = "This is my line";
                //    //Sets symbol to use to draw the text graphic
                //    textGraphic.Symbol = textSymbol.MakeSymbolReference();
                //    //Draw the overlay text graphic
                //    _graphic = this.ActiveMapView.AddOverlay(textGraphic);

                //});
                string  ejson = geometry.ToJson();
                Polygon poly  = (Polygon)geometry;
                IReadOnlyList <Coordinate2D> coordinates = poly.Copy2DCoordinatesToList();
                ToGeoCoordinateParameter     ddParam     = new ToGeoCoordinateParameter(GeoCoordinateType.DD);
                List <string> geocoords = new List <string>();
                List <Tuple <double, double> > AllPts = new List <Tuple <double, double> >();
                double x;
                double y;
                foreach (Coordinate2D item in coordinates)
                {
                    MapPoint mapPoint = MapPointBuilder.CreateMapPoint(item, MapView.Active.Extent.SpatialReference);
                    List <Tuple <string, string> > pts = new List <Tuple <string, string> >();
                    string dd1 = mapPoint.ToGeoCoordinateString(ddParam).Split(' ')[0];
                    pts.Add(new Tuple <string, string>(mapPoint.ToGeoCoordinateString(ddParam).Split(' ')[1], mapPoint.ToGeoCoordinateString(ddParam).Split(' ')[0]));
                    if (pts[0].Item1.Contains("W"))
                    {
                        x = double.Parse("-" + pts[0].Item1.Substring(0, pts[0].Item1.Length - 1));
                        y = double.Parse(pts[0].Item2.Substring(0, pts[0].Item2.Length - 1));
                        //AllPts.Add(new Tuple<int, int>(int.Parse("-" + pts[0].Item1.Substring(0, pts[0].Item1.Length - 1)), int.Parse(pts[0].Item2.Substring(0, pts[0].Item2.Length -1))));
                    }
                    else if (pts[1].Item2.Contains("S"))
                    {
                        x = double.Parse(pts[0].Item1.Substring(0, pts[0].Item1.Length - 1));
                        y = double.Parse("-" + pts[0].Item2.Substring(0, pts[1].Item2.Length - 1));
                        //AllPts.Add(new Tuple<int, int>(int.Parse(pts[0].Item1.Substring(0, pts[0].Item1.Length - 1)), int.Parse("-" + pts[0].Item2.Substring(0, pts[1].Item2.Length - 1))));
                    }
                    else
                    {
                        x = double.Parse(pts[0].Item1.Substring(0, pts[0].Item1.Length - 1));
                        y = double.Parse(pts[0].Item2.Substring(0, pts[0].Item2.Length - 1));
                        //AllPts.Add(new Tuple<int, int>(int.Parse(pts[0].Item1.Substring(0, pts[0].Item1.Length - 1)), int.Parse(pts[0].Item2.Substring(0, pts[1].Item2.Length - 1))));
                    }
                    AllPts.Add(new Tuple <double, double>(x, y));
                    geocoords.Add(mapPoint.ToGeoCoordinateString(ddParam));
                }

                double[,] sd = new double[AllPts.Count, 2];
                for (int i = 0; i < AllPts.Count; i++)
                {
                    sd[i, 0] = AllPts[i].Item1; //+ "," + AllPts[i].Item2;
                    sd[i, 1] = AllPts[i].Item2;
                }
                List <double[, ]> ss = new List <double[, ]>();
                ss.Add(sd);
                Config configPoints = new Config
                {
                    type        = "Polygon",
                    coordinates = ss.ToArray()
                };
                Config configGeom = new Config
                {
                    type       = "GeometryFilter",
                    field_name = "geometry",
                    config     = configPoints
                };



                //DateFilter
                Config dateconfigconfig2 = new Config
                {
                    gte = "2019-05-19T16:51:19.926Z",
                    lte = "2019-08-19T16:51:19.926Z"
                };

                Config dateconfigconfig = new Config
                {
                    type       = "DateRangeFilter",
                    field_name = "acquired",
                    config     = dateconfigconfig2
                };
                Config dateconfig = new Config
                {
                    type   = "OrFilter",
                    config = new[] { dateconfigconfig }
                };

                SearchFilter  searchFilter = new SearchFilter();
                List <string> typoes       = new List <string>();
                typoes.Add("PSScene4Band");
                typoes.Add("SkySatCollect");
                typoes.Add("REOrthoTile");


                List <Config> mainconfigs = new List <Config>();
                mainconfigs.Add(dateconfig);
                mainconfigs.Add(configGeom);
                searchFilter.item_types = typoes.ToArray();
                Filter topfilter = new Filter();
                topfilter.type      = "AndFilter";
                searchFilter.filter = topfilter;
                Config mainConfig = new Config();
                searchFilter.filter.config = mainconfigs.ToArray();


                //string json = JsonConvert.SerializeObject(searchFilter);
                string json = JsonConvert.SerializeObject(searchFilter, new JsonSerializerSettings()
                {
                    NullValueHandling = NullValueHandling.Ignore
                });
                string asas = "{\"filter\":{\"type\":\"AndFilter\",\"config\":[{\"type\":\"GeometryFilter\",\"field_name\":\"geometry\",\"config\":{\"type\":\"Polygon\",\"coordinates\":[[[-159.44149017333984,21.877787931279187],[-159.44998741149902,21.87679231243837],[-159.45372104644778,21.872769941600623],[-159.45217609405518,21.866835742000745],[-159.44372177124023,21.864207091531895],[-159.43561077117923,21.86930503623256],[-159.44149017333984,21.877787931279187]]]}},{\"type\":\"OrFilter\",\"config\":[{\"type\":\"DateRangeFilter\",\"field_name\":\"acquired\",\"config\":{\"gte\":\"2019-05-22T16:36:32.254Z\",\"lte\":\"2019-08-22T16:36:32.254Z\"}}]}]},\"item_types\":[\"PSScene4Band\",\"REOrthoTile\",\"SkySatCollect\"]}";
                //var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://api.somewhere.com/v2/cases");
                HttpClientHandler handler = new HttpClientHandler()
                {
                    AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
                };
                HttpClient client = new HttpClient(handler)
                {
                    BaseAddress = new Uri("https://api.planet.com")
                };
                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "data/v1/quick-search");
                request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                request.Headers.CacheControl = new CacheControlHeaderValue();

                request.Headers.CacheControl.NoCache = true;
                request.Headers.Host = "api.planet.com";
                request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
                //request.Headers.Remove("Content-Type");
                //request.Headers.Add("Content-Type", "application/json");
                var content = new StringContent(json, Encoding.UTF8, "application/json");
                request.Content = content;
                var byteArray = Encoding.ASCII.GetBytes("1fe575980e78467f9c28b552294ea410:hgvhgv");
                client.DefaultRequestHeaders.Host = "api.planet.com";
                //_client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                content.Headers.Remove("Content-Type");
                content.Headers.Add("Content-Type", "application/json");
                //client.DefaultRequestHeaders.AcceptEncoding.Add(StringWithQualityHeaderValue.Parse("gzip"));
                client.DefaultRequestHeaders.Add("Connection", "keep-alive");
                client.DefaultRequestHeaders.Add("User-Agent", "ArcGISProC#");
                //content.Headers.TryAddWithoutValidation("Authorization", "Basic " + Convert.ToBase64String(byteArray));
                //client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "MWZlNTc1OTgwZTc4NDY3ZjljMjhiNTUyMjk0ZWE0MTA6");//Convert.ToBase64String(byteArray));
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
                using (HttpResponseMessage httpResponse = client.SendAsync(request).Result)
                {
                    using (HttpContent content2 = httpResponse.Content)
                    {
                        var json2 = content2.ReadAsStringAsync().Result;
                        QuickSearchResult quickSearchResult = JsonConvert.DeserializeObject <QuickSearchResult>(json2);
                        //Geometry geometry2 = GeometryEngine.Instance.ImportFromJSON(JSONImportFlags.jsonImportDefaults, JsonConvert.SerializeObject( quickSearchResult.features[5].geometry));
                    }
                }



                pane.Activate();
                return(true);
            }
            catch (Exception exe)
            {
                if (_graphic != null)
                {
                    _graphic.Dispose();
                }
                return(false);
            }
        }
        private async void CreateUpload_Button(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MapView.Active == null)
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("No MapView currently active. Exiting...", "Info");
                    return;
                }
                if (StaticVariables.archesInstanceURL == "" | StaticVariables.archesInstanceURL == null)
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please, Log in to Arches Server...");

                    DockPane pane = FrameworkApplication.DockPaneManager.Find("arches_arcgispro_addin_MainDockpane");
                    if (pane == null)
                    {
                        return;
                    }
                    pane.Activate();
                    return;
                }
                if (StaticVariables.archesNodeid == "" | StaticVariables.archesNodeid == null)
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please, Select a Geometry Node to use...");
                    return;
                }
                if (StaticVariables.archesResourceid != "" && StaticVariables.archesResourceid != null)
                {
                    StaticVariables.archesResourceid = "";
                }

                List <string> archesGeometryCollection = await SaveResourceView.GetGeometryString();

                string archesGeometryString = String.Join(",", archesGeometryCollection);
                Dictionary <string, int> archesGeometryType = SaveResourceView.GetGeometryType(archesGeometryCollection);

                MessageBoxResult messageBoxResult = ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(
                    $"Are you sure you want to submit the selected geometry to create a new resource instance?\n\n" +
                    $"Total {archesGeometryCollection.Count} geometries will be submitted\n" +
                    $"{archesGeometryType["point"]} point(s)\n" +
                    $"{archesGeometryType["line"]} line(s)\n" +
                    $"{archesGeometryType["polygon"]} polygon(s)",
                    "Submit to Arches", MessageBoxButton.OKCancel, MessageBoxImage.Question);

                if (messageBoxResult.ToString() == "OK")
                {
                    string geometryFormat  = "esrijson";
                    string submitOperation = "create";
                    var    result          = await SaveResourceView.SubmitToArches(null, StaticVariables.archesNodeid, archesGeometryString, geometryFormat, submitOperation);

                    StaticVariables.archesResourceid = result["resourceinstance_id"];
                    CreateResourceViewModel.GetResourceIdsCreated();
                    SaveResourceView.RefreshMapView();
                    OpenChromiumButton.IsEnabled = true;
                }
                else
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("The submission is cancelled");
                }
            }
            catch (Exception ex)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Exception: " + ex.Message);
            }
        }