Пример #1
0
 private void OnSettings(object sender, EventArgs e)
 {
     try
     {
         // show option form
         OptionsFormPLMPackLib form = new OptionsFormPLMPackLib();
         DialogResult          dres = form.ShowDialog();
         if (DialogResult.OK == dres)
         {
             // need to force saving of Pic.Factory2D.Properties.Settings
             Pic.Factory2D.Control.Properties.Settings.Default.Save();
             // need to force saving of Pic.Plugin.ViewCtrl.Properties.Settings
             PluginViewCtrl.SaveSettings();
             // if need to restart application, indicate the user that the application will need to restart before exiting
             if (form.ApplicationMustRestart)
             {
                 MessageBox.Show(string.Format(Resources.ID_APPLICATIONMUSTRESTART, Application.ProductName));
                 Application.Exit();
             }
         }
     }
     catch (Exception ex)
     {
         Debug.Fail(ex.ToString());
         _log.Error(ex.ToString());
     }
 }
Пример #2
0
        public PropertiesForm(PluginViewCtrl pluginViewCtrl)
        {
            InitializeComponent();
            dataGridView1.ColumnCount          = 2;
            dataGridView1.ColumnHeadersVisible = true;
            dataGridView1.ReadOnly             = true;

            // Set the column header style.
            DataGridViewCellStyle columnHeaderStyle =
                new DataGridViewCellStyle();

            columnHeaderStyle.BackColor = Color.Aqua;
            columnHeaderStyle.Font      = new Font("Verdana", 10, FontStyle.Bold);
            dataGridView1.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

            // Set the column header names.
            dataGridView1.Columns[0].Name = "Propriété";
            dataGridView1.Columns[1].Name = "Valeur";


            _pluginViewCtrl = pluginViewCtrl;
            propertiesListView();
        }
        public FormEditMajorations(int compId, Profile currentProfile, ProfileLoader profileLoader)
        {
            InitializeComponent();

            _componentId   = compId;
            _profileLoader = profileLoader;

            if (!DesignMode)
            {
                // plugin viewer
                _pluginViewCtrl          = new PluginViewCtrl();
                _pluginViewCtrl.Size     = _pb.Size;
                _pluginViewCtrl.Location = _pb.Location;
                _pluginViewCtrl.Visible  = true;
                this.Controls.Add(_pluginViewCtrl);
                // hide
                _pb.Visible = false;
            }

            // fill combo box
            FillProfileComboBox(currentProfile.ToString());

            // get parameter stack
            Pic.Plugin.ParameterStack stack = null;
            using (Pic.Plugin.ComponentLoader loader = new Pic.Plugin.ComponentLoader())
            {
                PPDataContext            db        = new PPDataContext();
                Pic.DAL.SQLite.Component comp      = Pic.DAL.SQLite.Component.GetById(db, _componentId);
                Pic.Plugin.Component     component = loader.LoadComponent(comp.Document.File.Path(db));
                stack = component.BuildParameterStack(null);
                // load component in pluginviewer
                _pluginViewCtrl.Component = component;
            }

            // insert majoration label and textbox controls
            int lblX = 20, lblY = 60;
            int offsetX = 110, offsetY = 29;
            int tabIndex = bnCancel.TabIndex;
            int iCount   = 0;

            foreach (Parameter param in stack.ParameterList)
            {
                // only shows majorations
                if (!param.IsMajoration)
                {
                    continue;
                }
                ParameterDouble paramDouble = param as ParameterDouble;
                // create Label control
                Label lbl = new Label();
                lbl.Name     = string.Format("lbl_{0}", param.Name);
                lbl.Text     = param.Name;
                lbl.Location = new Point(
                    lblX + (iCount / 5) * offsetX
                    , lblY + (iCount % 5) * offsetY);
                lbl.Size     = new Size(30, 13);
                lbl.TabIndex = ++tabIndex;
                this.Controls.Add(lbl);
                // create NumericUpDown control
                NumericUpDown nud = new NumericUpDown();
                nud.Name          = string.Format("nud_{0}", param.Name);
                nud.Increment     = 0.1M;
                nud.Minimum       = paramDouble.HasValueMin ? (decimal)paramDouble.ValueMin : -10000.0M;
                nud.Maximum       = paramDouble.HasValueMax ? (decimal)paramDouble.ValueMax : 10000.0M;
                nud.DecimalPlaces = 1;
                nud.Value         = (decimal)paramDouble.Value;
                nud.Location      = new Point(
                    lblX + (iCount / 5) * offsetX + lbl.Size.Width + 1
                    , lblY + (iCount % 5) * offsetY);
                nud.Size          = new Size(60, 20);
                nud.TabIndex      = ++tabIndex;
                nud.ValueChanged += new EventHandler(nudValueChanged);
                nud.GotFocus     += new EventHandler(nud_GotFocus);
                nud.Click        += new EventHandler(nud_GotFocus);
                this.Controls.Add(nud);

                ++iCount;
            }

            UpdateMajorationValues();
        }
Пример #4
0
        public FormEditMajorations(Guid compGuid, Profile currentProfile, ProfileLoader profileLoader)
        {
            InitializeComponent();

            if (compGuid == Guid.Empty)
            {
                throw new Exception("Invalid component Guid");
            }

            _compGuid      = compGuid;
            _profileLoader = profileLoader;

            if (!DesignMode)
            {
                // plugin viewer
                _pluginViewCtrl          = new PluginViewCtrl();
                _pluginViewCtrl.Size     = _pb.Size;
                _pluginViewCtrl.Location = _pb.Location;
                _pluginViewCtrl.Visible  = true;
                this.Controls.Add(_pluginViewCtrl);
                // hide
                _pb.Visible = false;
            }

            // fill combo box
            FillProfileComboBox(currentProfile.ToString());

            // get parameter stack
            PLMPackServiceClient client = WCFClientSingleton.Instance.Client;

            Pic.Plugin.ParameterStack stack = null;
            using (Pic.Plugin.ComponentLoader loader = new Pic.Plugin.ComponentLoader())
            {
                DCComponent          comp      = client.GetComponentByGuid(_compGuid);
                Pic.Plugin.Component component = loader.LoadComponent(
                    treeDiM.FileTransfer.FileTransferUtility.DownloadFile(comp.File.Guid, comp.File.Extension));
                stack = component.BuildParameterStack(null);
                // load component in pluginviewer
                _pluginViewCtrl.Component = component;
            }

            // insert majoration label and textbox controls
            int lblX = 20, lblY = 60;
            int offsetX = 110, offsetY = 29;
            int tabIndex = bnCancel.TabIndex;
            int iCount   = 0;

            foreach (Parameter param in stack.ParameterList)
            {
                // only shows majorations
                if (!param.IsMajoration)
                {
                    continue;
                }
                ParameterDouble paramDouble = param as ParameterDouble;
                // create Label control
                Label lbl = new Label();
                lbl.Name     = string.Format("lbl_{0}", param.Name);
                lbl.Text     = param.Name;
                lbl.Location = new Point(
                    lblX + (iCount / 5) * offsetX
                    , lblY + (iCount % 5) * offsetY);
                lbl.Size     = new Size(30, 13);
                lbl.TabIndex = ++tabIndex;
                this.Controls.Add(lbl);
                // create NumericUpDown control
                NumericUpDown nud = new NumericUpDown();
                nud.Name          = string.Format("nud_{0}", param.Name);
                nud.Increment     = 0.1M;
                nud.Minimum       = paramDouble.HasValueMin ? (decimal)paramDouble.ValueMin : -10000.0M;
                nud.Maximum       = paramDouble.HasValueMax ? (decimal)paramDouble.ValueMax : 10000.0M;
                nud.DecimalPlaces = 1;
                nud.Value         = (decimal)paramDouble.Value;
                nud.Location      = new Point(
                    lblX + (iCount / 5) * offsetX + lbl.Size.Width + 1
                    , lblY + (iCount % 5) * offsetY);
                nud.Size          = new Size(60, 20);
                nud.TabIndex      = ++tabIndex;
                nud.ValueChanged += new EventHandler(nudValueChanged);
                nud.GotFocus     += new EventHandler(nud_GotFocus);
                nud.Click        += new EventHandler(nud_GotFocus);
                this.Controls.Add(nud);

                ++iCount;
            }

            UpdateMajorationValues();
        }
Пример #5
0
 public void UpdateToolCommands(NodeTag nodeTag, PluginViewCtrl pluginViewerCtrl)
 {
 }