Example #1
0
 protected override void MenEdit_Click(object sender, EventArgs e)
 {
     using (var editForm = new EditParameterForm())
     {
         if (editForm.ShowDialog(OwnerDefinition, FirstSelectedItem) == DialogResult.OK)
         {
             RaiseGridUpdated();
         }
     }
 }
Example #2
0
        /// <summary>
        /// Редактируем параметр
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editParameter_Click(object sender, EventArgs e)
        {
            if (listViewParameters.SelectedItems != null)
            {
                if (listViewParameters.SelectedItems.Count > 0)
                {
                    Parameter selected = listViewParameters.SelectedItems[0].Tag as Parameter;
                    if (selected != null)
                    {
                        EditParameterForm frm = new EditParameterForm(selected);
                        if (frm.ShowDialog(this) == DialogResult.OK)
                        {
                            // ------- тут необходимо применить в силу внесенные изменения -------

                            if (listViewParameters.SelectedItems != null)
                            {
                                if (listViewParameters.SelectedItems.Count > 0)
                                {
                                    ListViewItem selItem = listViewParameters.SelectedItems[0];
                                    if (selItem != null)
                                    {
                                        Parameter selPar = selItem.Tag as Parameter;
                                        if (selPar != null)
                                        {
                                            selItem.SubItems[1].Text = selPar.Name;

                                            PDescription[] pars = DevManClient.Parameters;
                                            try
                                            {
                                                foreach (PDescription param in pars)
                                                {
                                                    if (param.Number == selPar.Channel.Number)
                                                    {
                                                        selPar.Channel.Type = param.Type;
                                                        break;
                                                    }
                                                }
                                            }
                                            catch
                                            {
                                            }
                                        }
                                    }
                                }
                            }

                            _app.UpdateTechGraphics();
                        }
                    }
                }
            }
        }
Example #3
0
        private void パラメーターToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var sheet = WindowUtility.LayerManager.SelectedPpdSheet;

            if (sheet == null)
            {
                return;
            }
            var marks = Utility.GetSelectedMarks();

            if (marks.Length == 0)
            {
                MessageBox.Show(Utility.Language["NoSelectedMarks"]);
                return;
            }

            var commanParameters = Utility.GetCommonParameters(marks, out string[] existKeys);
            var form             = new EditParameterForm();

            form.SetLang();
            form.Parameters = commanParameters;
            form.ExistKeys  = existKeys;
            if (form.ShowDialog() == DialogResult.OK)
            {
                var newParameters    = form.Parameters;
                var removeParameters = new HashSet <string>();
                foreach (var key in commanParameters.Keys)
                {
                    if (!newParameters.ContainsKey(key))
                    {
                        removeParameters.Add(key);
                    }
                }
                sheet.StartGroupCommand();
                foreach (var key in removeParameters)
                {
                    sheet.RemoveParameter(key);
                }
                foreach (var pair in newParameters)
                {
                    sheet.ChangeParameter(pair.Key, pair.Value);
                }
                sheet.EndGroupCommand();
                UpdateParameters();
            }
        }