async private void contextItem_AddField_Click(object sender, EventArgs e)
        {
            Field            nField = new Field("NewField", FieldType.String);
            FormPropertyGrid dlg    = new FormPropertyGrid(nField);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                nField = dlg.SelectedObject as Field;

                var alterTable = await GetAlterTable();

                if (alterTable == null)
                {
                    MessageBox.Show("Change properties is not implemented for this feature...");
                    return;
                }

                if (!await alterTable.AlterTable(_exObject.Name, null, nField))
                {
                    MessageBox.Show("ERROR: " + ((alterTable is IDatabase) ? ((IDatabase)alterTable).LastErrorMessage : ""));
                    return;
                }

                await this.OnShow();
            }
        }
        private void contextItem_Properties_Click(object sender, EventArgs e)
        {
            if (_contextItem is FieldListViewItem)
            {
                Field            oField = ((FieldListViewItem)_contextItem).Field;
                FormPropertyGrid dlg    = new FormPropertyGrid(
                    new Field(oField));

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Field nField = dlg.SelectedObject as Field;
                    if (!oField.Equals(nField))
                    {
                        if (AlterTable == null)
                        {
                            MessageBox.Show("Change properties is not implemented for this feature...");
                            return;
                        }

                        if (!AlterTable.AlterTable(_exObject.Name, oField, nField))
                        {
                            MessageBox.Show("ERROR: " + ((AlterTable is IDatabase) ? ((IDatabase)AlterTable).lastErrorMsg : ""));
                            return;
                        }

                        this.OnShow();
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void buttonDialogs_Click(object sender, EventArgs e)
        {
            int i;

            GraphicsWindow.Show();
            Primitive items  = "";
            Primitive images = "";

            for (i = 1; i <= 5; i++)
            {
                items[i]  = "Item " + i;
                images[i] = "C:\temp\test.jpg";
            }
            LDDialogs.AddRightClickMenu(items, images);

            TextWindow.WriteLine(System.Windows.Media.RenderCapability.Tier >> 16);
            Primitive a1 = LDArray.Create(1000);

            Shapes.AddEllipse(50, 50);
            FormPropertyGrid grid = new FormPropertyGrid();

            grid.Display("_mainCanvas");
            Primitive properties = grid.GetProperties("_mainCanvas");

            for (i = 1; i <= SBArray.GetItemCount(properties); i++)
            {
                TextWindow.WriteLine(properties[i]);
            }

            grid.SetProperty("_mainCanvas.Children.Ellipse1.Opacity", 0.5);

            Primitive font     = LDDialogs.Font("");
            Primitive font2    = LDDialogs.Font(font);
            Primitive fileName = LDDialogs.OpenFile("Small Basic File (*.sb) |*.sb", "");

            LDUtilities.Version();
            GraphicsWindow.Show();
            TextWindow.WriteLine(LDDialogs.Calendar(LDDateTime.Add(LDDateTime.Now(), 7))); //Now + 7 days
            //LDUtilities.PauseUpdates();
            LDDialogs.Wait("Please wait for a few seconds while I draw something...", LDColours.SetOpacity(LDColours.Violet, 200));
            double start = Clock.ElapsedMilliseconds;

            i = 1;
            while (Clock.ElapsedMilliseconds < start + 5000)
            {
                Primitive ball = Shapes.AddEllipse(20, 20);
                Shapes.Move(ball, SBMath.GetRandomNumber(GraphicsWindow.Width) - 10, SBMath.GetRandomNumber(GraphicsWindow.Height) - 10);
                LDDialogs.ToolTip(ball, "Ball " + i++);
                SBProgram.Delay(100);
            }
            //LDUtilities.ResumeUpdates();
            LDDialogs.EndWait();
        }
        private void gridFcs_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || lstWeights.SelectedItems.Count != 1)
            {
                return;
            }

            IGraphWeight             weight = ((WeightListViewItem)lstWeights.SelectedItems[0]).GraphWeight;
            int                      fcId   = Convert.ToInt32(gridFcs.Rows[e.RowIndex].Cells[0].Value);
            IGraphWeightFeatureClass gwfc   = weight.FeatureClasses[fcId];

            if (gwfc != null && gwfc.SimpleNumberCalculation != null && e.ColumnIndex == 4)
            {
                FormPropertyGrid dlg = new FormPropertyGrid(gwfc.SimpleNumberCalculation);
                dlg.ShowDialog();
            }
        }
        private void btnAdvanced_Click(object sender, EventArgs e)
        {
            FormPropertyGrid grid = new FormPropertyGrid(_advancedSettings);

            grid.ShowDialog();
        }