Example #1
0
        public void Editing(object sender, ContextMenuClickedEventArgs<CustomVectorField> e)
        {
            CustomVectorField vf = e.ContextObject as CustomVectorField;
            CreateVF.Arguments a = new CreateVF.Arguments();

            using (ITransaction txn = DataManager.NewTransaction())
            {
                txn.Lock(vf);
                a.AzField = vf.Azimutfieldic;
                a.HeiField = vf.Heigtfieldic;
                a.Step = (int)vf.gridStep;
                a.VectorField = vf;
                CreateVFUI wnd = new CreateVFUI(wrapper.Workstep as CreateVF, a, null as WorkflowContext);
                Form das = new Form();
                das.Icon = Icon.FromHandle(PetrelImages.Modules.GetHicon());
                das.Text = "CreateVF";
                das.Width = 550;
                das.Height = 256;
                wnd.Parent = das;
                wnd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right)));
                das.Show();
                txn.Commit();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateVFUI"/> class.
        /// </summary>
        /// <param name="workstep">the workstep instance</param>
        /// <param name="args">the arguments</param>
        /// <param name="context">the underlying context in which this UI is being used</param>
        public CreateVFUI(CreateVF workstep, CreateVF.Arguments args, WorkflowContext context)
        {
            InitializeComponent();
            this.workstep = workstep;
            this.args = args;
            this.context = context;

            if (args.VectorField != null)
            {
                textBoxK.Text = args.VectorField.koeff.ToString();
                colorPicker1.Color = args.VectorField.arrowColor;
                textBoxN.Text = args.VectorField.partition.ToString();
                if (args.VectorField.haveGrid == true)
                {
                    comboBox1.SelectedItem = comboBox1.Items[0];
                }
                else
                {
                    comboBox1.SelectedItem = comboBox1.Items[1];
                }
                textBoxStep.Text = ((int)args.VectorField.gridStep).ToString();
            }
            workstep.CopyArgumentPackage(args, tmpargs);
            UpdateUiFormArgs();
        }