Ejemplo n.º 1
0
 private void PopulateConfig(MultiRenameForm dlg)
 {
     if (config != null && config.Count > 0)
     {
         dlg.Formula = config.GetString("Formula");
         dlg.Counter = new StringHelper.CounterDetails(config.GetUInt("CounterStart", 1),
                                                       config.GetUInt("CounterStep", 1),
                                                       (int)config.GetUInt("CounterDigits", 3));
         dlg.FormatIndex = (int)config.GetUInt("FormatIndex");
     }
 }
Ejemplo n.º 2
0
        private void CheckVersion()
        {
            PersistentStorageData data = PersistentStorageHelper.Load(PersistantStorageName);
            bool executeCheck          = false;

            if (data != null && data.Count > 0)
            {
                // get the last update date from the registry:
                lastUpdateCheck = data.GetDateTime("LastUpdateDate");
                sleepTime       = (int)data.GetUInt("SleepTimeBeforeUpdateCheck", SleepTimeBeforeUpdateCheck) * 1000;

                // check if update-check was performed at least one week ago:
                if (lastUpdateCheck.AddDays(PeriodBeforeUpdateCheck) < DateTime.Today)
                {
                    executeCheck = true;
                }
                else
                {
                    // prevent updating the date inside the registry:
                    lastUpdateCheck = DateTime.MinValue;
                }
            }
            else
            {
                executeCheck = true;
            }

            if (executeCheck && sleepTime != 0)
            {
                // start asynchronously new thread that will perform check and update the registry:
                Thread threadCheck = new Thread(PerformUpdateCheck);
                threadCheck.Start();
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initialize components when all actions has been already setup.
 /// </summary>
 public void AfterApplicationInit(bool setupUI)
 {
     if (tytanToolbar != null)
     {
         tytanToolbar.Visible = config.GetUInt(ShowTytanToolbarOption, 1) > 0;
     }
 }
Ejemplo n.º 4
0
        protected override void ConfigurationPresent()
        {
            config = ObjectFactory.LoadConfiguration(VisualStudioCloseQuestion.ConfigurationName);

            // present configuration on the screen:
            promptOnClosing.Checked = config.GetUInt(VisualStudioCloseQuestion.Config_Prompt, 0) > 0;
        }
Ejemplo n.º 5
0
 void SolutionEvents_SolutionQueryClose(object sender, Solution s, ref bool bCancel)
 {
     if (config == null || config.GetUInt(Config_Prompt, 0) > 0)
     {
         if (MessageBox.Show(SharedStrings.SolutionClose_Question, SharedStrings.SolutionClose_DialogTitle,
                             MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             bCancel = true;
         }
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Writes the particular data to the persistent storage area.
        /// </summary>
        public static bool Save(PersistentStorageData data)
        {
            try
            {
                RegistryKey key = OpenKey(data.Name, true);

                // store the data:
                if (key != null)
                {
                    // remove deleted keys:
                    foreach (string k in data.Removed)
                    {
                        key.DeleteValue(k, false);
                    }

                    // set values for the others:
                    foreach (string k in data.KeysStrings)
                    {
                        key.SetValue(k, data.GetString(k), RegistryValueKind.String);
                    }

                    foreach (string k in data.KeysMultiString)
                    {
                        key.SetValue(k, data.GetMultiString(k), RegistryValueKind.MultiString);
                    }

                    foreach (string k in data.KeysBytes)
                    {
                        key.SetValue(k, data.GetByte(k), RegistryValueKind.Binary);
                    }

                    foreach (string k in data.KeysUInts)
                    {
                        key.SetValue(k, data.GetUInt(k), RegistryValueKind.DWord);
                    }
                }

                CloseKey(key);
                return(true);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                Trace.WriteLine(ex.StackTrace);
                return(false);
            }
        }