private void createFeature_Click(object sender, EventArgs e)
        {
            if (elements.Items.Count == 0)
                MessageBox.Show("Must create elements.");
            else
            {
                DynamicForm f = new DynamicForm("Configure feature...", DynamicForm.CloseButtons.OkCancel);
                f.AddTextBox("Feature name:", null, 50, "name");
                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string name = f.GetValue<string>("name").Trim();
                    if (name == "")
                        MessageBox.Show("Invalid name:  must not be blank.");
                    else
                    {
                        Shapefile shapefile = null;
                        try
                        {
                            shapefile = Shapefile.Create(name, (elements.Items[0] as Geometry).SRID, Shapefile.ShapefileType.Feature);
                            ShapefileGeometry.Create(shapefile, elements.Items.Cast<Geometry>().Select(g => new Tuple<Geometry, DateTime>(g, DateTime.MinValue)).ToList());
                            MessageBox.Show("Shapefile \"" + name + "\" created.");
                            elements.Items.Clear();
                            points.Items.Clear();
                        }
                        catch (Exception ex)
                        {
                            Console.Out.WriteLine("Failed to create shapefile:  " + ex.Message);

                            try { shapefile.Delete(); }
                            catch (Exception ex2) { Console.Out.WriteLine("Failed to delete failed shapefile:  " + ex2.Message); }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void DynamicGUI_Display(IZeusGuiControl gui, IZeusFunctionExecutioner executioner)
        {
            try
            {
                DynamicForm  df     = new DynamicForm(gui as GuiController, executioner);
                DialogResult result = df.ShowDialog();

                if (result == DialogResult.Cancel)
                {
                    gui.IsCanceled = true;
                }
            }
            catch (Exception ex)
            {
                _log.Write(ex);
            }
        }
Ejemplo n.º 3
0
        public void DynamicGUI_Display(IZeusGuiControl gui, IZeusFunctionExecutioner executioner)
        {
            this.Cursor = Cursors.Default;

            try
            {
                DynamicForm  df     = new DynamicForm(gui as GuiController, executioner);
                DialogResult result = df.ShowDialog(this);

                if (result == DialogResult.Cancel)
                {
                    gui.IsCanceled = true;
                }
            }
            catch (Exception ex)
            {
                OnErrorsOccurred(ex);
            }

            Cursor.Current = Cursors.Default;
        }
        private void createFeature_Click(object sender, EventArgs e)
        {
            if (elements.Items.Count == 0)
            {
                MessageBox.Show("Must create elements.");
            }
            else
            {
                DynamicForm f = new DynamicForm("Configure feature...", DynamicForm.CloseButtons.OkCancel);
                f.AddTextBox("Feature name:", null, 50, "name");
                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string name = f.GetValue <string>("name").Trim();
                    if (name == "")
                    {
                        MessageBox.Show("Invalid name:  must not be blank.");
                    }
                    else
                    {
                        Shapefile shapefile = null;
                        try
                        {
                            shapefile = Shapefile.Create(name, (elements.Items[0] as Geometry).SRID, Shapefile.ShapefileType.Feature);
                            ShapefileGeometry.Create(shapefile, elements.Items.Cast <Geometry>().Select(g => new Tuple <Geometry, DateTime>(g, DateTime.MinValue)).ToList());
                            MessageBox.Show("Shapefile \"" + name + "\" created.");
                            elements.Items.Clear();
                            points.Items.Clear();
                        }
                        catch (Exception ex)
                        {
                            Console.Out.WriteLine("Failed to create shapefile:  " + ex.Message);

                            try { shapefile.Delete(); }
                            catch (Exception ex2) { Console.Out.WriteLine("Failed to delete failed shapefile:  " + ex2.Message); }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void DynamicGUI_Display(GuiController gui, IZeusFunctionExecutioner executioner)
        {
            this.Cursor = Cursors.Default;

            try
            {
                DynamicForm  df     = new DynamicForm(gui, executioner);
                DialogResult result = df.ShowDialog(this);

                if (result == DialogResult.Cancel)
                {
                    gui.IsCanceled = true;
                }
            }
            catch (Exception ex)
            {
                ZeusDisplayError formError = new ZeusDisplayError(ex);
                formError.SetControlsFromException();
                formError.ShowDialog(this);
            }

            this.Cursor = Cursors.WaitCursor;
        }
Ejemplo n.º 6
0
        public void DynamicGUI_Display(GuiController gui, IScriptExecutioner executioner)
        {
            DynamicForm df = new DynamicForm(gui, executioner);

            df.ShowDialog(this);
        }
Ejemplo n.º 7
0
			if (zout != null)
			{
				SimpleOutputForm frm = new SimpleOutputForm();
				frm.OutText = zout.text;
				frm.ShowDialog(this);
 private void setPointDrawingDiameterToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DynamicForm f = new DynamicForm("Set point drawing diameter...", DynamicForm.CloseButtons.OkCancel);
     f.AddNumericUpdown("Diameter (pixels):", _pointDrawingDiameter, 0, 1, decimal.MaxValue, 1, "d");
     if (f.ShowDialog() == DialogResult.OK)
     {
         int value = Convert.ToInt32(f.GetValue<decimal>("d"));
         if (value != _pointDrawingDiameter)
         {
             _pointDrawingDiameter = value;
             GetThreatSurfaces(new Rectangle(0, 0, CurrentThreatSurface.Width, CurrentThreatSurface.Height), false);
         }
     }
 }