private void UpdateParameters()
 {
     // get selected component
     Pic.DAL.SQLite.PPDataContext db   = new Pic.DAL.SQLite.PPDataContext();
     Pic.DAL.SQLite.Component     comp = Pic.DAL.SQLite.Component.GetByGuid(db, _guid);
     // set description
     lbDescription.Text = comp.Document.Description;
     // initialize plugin viewer
     _pluginViewCtrl.PluginPath  = comp.Document.File.Path(db);
     _pluginViewCtrl.ParamValues = Pic.DAL.SQLite.Component.GetParamDefaultValues(db, _guid);
 }
Пример #2
0
 public string GetFilePathFromGuid(Guid guid)
 {
     // get db constext
     Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
     // retrieve component
     Pic.DAL.SQLite.Component comp = Pic.DAL.SQLite.Component.GetByGuid(db, guid);
     if (null == comp)
     {
         throw new PluginException(string.Format("Failed to load Component with Guid = {0}", guid.ToString()));
     }
     // return path
     return(comp.Document.File.Path(db));
 }
 private void SaveParameters()
 {
     // data context
     Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
     // get component by guid
     Pic.DAL.SQLite.Component comp = Pic.DAL.SQLite.Component.GetByGuid(db, _guid);
     if (null == comp)
     {
         return;
     }
     // get user entered values
     comp.UpdateDefaultParamValueSet(db, _pluginViewCtrl.ParamValues);
 }
Пример #4
0
 public double GetDoubleParameterDefaultValue(Guid guid, string name)
 {
     Pic.DAL.SQLite.PPDataContext db   = new Pic.DAL.SQLite.PPDataContext();
     Pic.DAL.SQLite.Component     comp = Pic.DAL.SQLite.Component.GetByGuid(db, guid);
     if (null == comp)
     {
         throw new PluginException(string.Format("Failed to load Component with Guid = {0}", guid.ToString()));
     }
     try
     { return(comp.GetParamDefaultValueDouble(db, name)); }
     catch (Exception ex)
     {
         _log.Error(ex.Message);
         // rethrow exception
         throw ex;
     }
 }
        public FormEditDefaultParamValues(List <Guid> dependanciesGUID)
        {
            InitializeComponent();

            _pluginViewCtrl.Localizer = LocalizerImpl.Instance;

            // fill combo
            Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
            // load component from Guids
            foreach (Guid guid in dependanciesGUID)
            {
                Pic.DAL.SQLite.Component cp = Pic.DAL.SQLite.Component.GetByGuid(db, guid);
                cbComponent.Items.Add(new CompComboItem(cp.Document.Name, cp.Guid));
            }
            // initialize _pluginViewCtrl
            _pluginViewCtrl.SearchMethod = new ComponentSearchMethodDB();
            _pluginViewCtrl.ShowSummary  = false;
            // initialize combo
            if (cbComponent.Items.Count > 0)
            {
                cbComponent.SelectedIndex = 0;
            }
        }
        private void UpdateParameters()
        {
            // get selected component
            Pic.DAL.SQLite.PPDataContext db   = new Pic.DAL.SQLite.PPDataContext();
            Pic.DAL.SQLite.Component     comp = Pic.DAL.SQLite.Component.GetByGuid(db, _guid);
            // set description
            lbDescription.Text = comp.Document.Description;
            // initialize plugin viewer
            _pluginViewCtrl.PluginPath = comp.Document.File.Path(db);

            Dictionary <string, Pic.Plugin.Parameter> dictParameters = new Dictionary <string, Pic.Plugin.Parameter>();

            foreach (var kvp in Pic.DAL.SQLite.Component.GetParamDefaultValues(db, _guid))
            {
                dictParameters.Add(kvp.Key, new Pic.Plugin.ParameterDouble(kvp.Key, kvp.Key, false, 0.0, false, 0.0, kvp.Value)
                {
                    Value = kvp.Value
                });
            }


            _pluginViewCtrl.ParamValues = dictParameters;
        }
        private void SaveParameters()
        {
            // data context
            Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
            // get component by guid
            Pic.DAL.SQLite.Component comp = Pic.DAL.SQLite.Component.GetByGuid(db, _guid);
            if (null == comp)
            {
                return;
            }

            Dictionary <string, double> dictNameValue = new Dictionary <string, double>();

            foreach (var v in _pluginViewCtrl.ParamValues)
            {
                if (v.Value is Pic.Plugin.ParameterDouble p)
                {
                    dictNameValue[p.Name] = p.Value;
                }
            }

            // get user entered values
            comp.UpdateDefaultParamValueSet(db, dictNameValue);
        }