Exemplo n.º 1
0
        /// <summary>
        /// Creates a layer group.
        /// </summary>
        /// <param name="sender">
        /// Create Group button.
        /// </param>
        /// <param name="e">
        /// Attributes of the event.
        /// </param>
        private void OnCreateGroup(object sender, RoutedEventArgs e)
        {
            try
            {
                var layerGroup = new LayerGroup();
                layerGroup.Owner = this;
                layerGroup.ShowDialog();
                if (!string.IsNullOrEmpty(layerGroup.LayerGroupName))
                {
                    TreeViewItem selectedNode = this.layersTree.SelectedItem as TreeViewItem;
                    if (selectedNode != null)
                    {
                        string url      = string.Format("http://{0}:5050/layerApi.aspx?cmd=group&frame={1}&name={2}", this.machineIp, selectedNode.Header.ToString(), layerGroup.LayerGroupName);
                        string payload  = string.Empty;
                        string response = WWTRequest.Send(url, payload);
                        this.PrintSendAndReceive(url, response);
                        this.PrintSendAndReceiveHeader("Create Group");

                        url      = string.Format("http://{0}:5050/layerApi.aspx?cmd=showlayermanager", this.machineIp);
                        response = WWTRequest.Send(url, string.Empty);
                        this.PrintSendAndReceive(url, response);
                        this.PrintSendAndReceiveHeader("Show Layer Manager Pane in WWT");

                        this.RefreshLayers(false, false);
                    }
                }
            }
            catch (CustomException ex)
            {
                // WorldWide Telescope might not be open.
                this.ReportError(ex.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a layer group.
        /// </summary>
        /// <param name="sender">
        /// Create Group button.
        /// </param>
        /// <param name="e">
        /// Attributes of the event.
        /// </param>
        private void OnCreateGroup(object sender, RoutedEventArgs e)
        {
            try
            {
                var layerGroup = new LayerGroup();
                layerGroup.Owner = this;
                layerGroup.ShowDialog();
                if (!string.IsNullOrEmpty(layerGroup.LayerGroupName))
                {
                    TreeViewItem selectedNode = this.layersTree.SelectedItem as TreeViewItem;
                    if (selectedNode != null)
                    {
                        string url = string.Format("http://{0}:5050/layerApi.aspx?cmd=group&frame={1}&name={2}", this.machineIp, selectedNode.Header.ToString(), layerGroup.LayerGroupName);
                        string payload = string.Empty;
                        string response = WWTRequest.Send(url, payload);
                        this.PrintSendAndReceive(url, response);
                        this.PrintSendAndReceiveHeader("Create Group");

                        url = string.Format("http://{0}:5050/layerApi.aspx?cmd=showlayermanager", this.machineIp);
                        response = WWTRequest.Send(url, string.Empty);
                        this.PrintSendAndReceive(url, response);
                        this.PrintSendAndReceiveHeader("Show Layer Manager Pane in WWT");

                        this.RefreshLayers(false, false);
                    }
                }
            }
            catch (CustomException ex)
            {
                // WorldWide Telescope might not be open.
                this.ReportError(ex.Message);
            }
        }