示例#1
0
 private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     PersistControlValue.SaveLocalAppSetting(regPath, "Left", left.ToString());
     PersistControlValue.SaveLocalAppSetting(regPath, "Top", top.ToString());
     PersistControlValue.SaveLocalAppSetting(regPath, "Width", width.ToString());
     PersistControlValue.SaveLocalAppSetting(regPath, "Height", height.ToString());
     PersistControlValue.SaveLocalAppSetting(regPath, "Visible", visible.ToString());
 }
示例#2
0
        public static void StoreControlValue(Control control)
        {
            string solutionPath = @"Leden.Net";

            if (control.GetType() == typeof(TextBox))
            {
                TextBox c = (TextBox)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Text);
            }
            else if (control.GetType() == typeof(currencyTextBox))
            {
                currencyTextBox c = (currencyTextBox)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Text);
            }
            else if (control.GetType() == typeof(CheckBox))
            {
                CheckBox c = (CheckBox)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Checked ? "True" : "False");
            }
            else if (control.GetType() == typeof(RadioButton))
            {
                RadioButton c = (RadioButton)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Checked ? "True" : "False");
            }
            else if (control.GetType() == typeof(Label))
            {
                Label c = (Label)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Text);
            }
            else if (control.GetType() == typeof(NumericUpDown))
            {
                NumericUpDown c = (NumericUpDown)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Value.ToString());
            }
            else if (control.GetType() == typeof(ComboBox))
            {
                ComboBox c = (ComboBox)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Text);
            }
            else if (control.GetType() == typeof(DateTimePicker))
            {
                DateTimePicker c = (DateTimePicker)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Text);
            }
            else if (control.GetType() == typeof(RichTextBox))
            {
                RichTextBox c = (RichTextBox)control;
                PersistControlValue.SaveLocalAppSetting(solutionPath, c.Name, c.Text);
            }
        }
示例#3
0
        public void SaveList()
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < ItemsSaveLimit && i < mruList.Count; i++)
            {
                string name = mruList[i] as string;
                if (name != null && name.Length > 0)
                {
                    sb.Append(name);
                    sb.Append(Environment.NewLine);
                }
            }
            PersistControlValue.SaveLocalAppSetting(IsolatedStoragePath, IsolatedStorageFile, sb.ToString());
        }
示例#4
0
        private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            PersistControlValue.SaveLocalAppSetting(m_regPath, "Left", m_normalLeft.ToString());
            PersistControlValue.SaveLocalAppSetting(m_regPath, "Top", m_normalTop.ToString());
            PersistControlValue.SaveLocalAppSetting(m_regPath, "Width", m_normalWidth.ToString());
            PersistControlValue.SaveLocalAppSetting(m_regPath, "Height", m_normalHeight.ToString());

            // check if we are allowed to save the state as minimized (not normally)
            if (!m_allowSaveMinimized)
            {
                if (m_windowState == FormWindowState.Minimized)
                {
                    m_windowState = FormWindowState.Normal;
                }
            }
            PersistControlValue.SaveLocalAppSetting(m_regPath, "WindowState", ((int)m_windowState).ToString());
        }