Ejemplo n.º 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());
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 4
0
        private void OnLoad(object sender, System.EventArgs e)
        {
            try
            {
                int  l = int.Parse(PersistControlValue.ReadLocalAppSetting(regPath, "Left"));
                int  t = int.Parse(PersistControlValue.ReadLocalAppSetting(regPath, "Top"));
                int  w = int.Parse(PersistControlValue.ReadLocalAppSetting(regPath, "Width"));
                int  h = int.Parse(PersistControlValue.ReadLocalAppSetting(regPath, "Height"));
                bool v = bool.Parse(PersistControlValue.ReadLocalAppSetting(regPath, "Visible"));

                control.Location = new Point(l, t);
                control.Size     = new Size(w, h);
                control.Visible  = v;
            }
            catch {}
        }
Ejemplo n.º 5
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());
        }
Ejemplo n.º 6
0
        private void LoadList()
        {
            mruList.Clear();
            string fileList = PersistControlValue.ReadLocalAppSetting(IsolatedStoragePath, IsolatedStorageFile);

            if (fileList == null || fileList.Length == 0)
            {
                return;
            }
            string[] files = fileList.Split(Environment.NewLine.ToCharArray());
            foreach (string file in files)
            {
                if (file != null && file.Length > 0 && !Contains(file))
                {
                    Add(file);
                }
            }
        }
Ejemplo n.º 7
0
        private void OnLoad(object sender, System.EventArgs e)
        {
            try
            {
                int left   = int.Parse(PersistControlValue.ReadLocalAppSetting(m_regPath, "Left"));
                int top    = int.Parse(PersistControlValue.ReadLocalAppSetting(m_regPath, "Top"));
                int width  = int.Parse(PersistControlValue.ReadLocalAppSetting(m_regPath, "Width"));
                int height = int.Parse(PersistControlValue.ReadLocalAppSetting(m_regPath, "Height"));

                int             tmp         = int.Parse(PersistControlValue.ReadLocalAppSetting(m_regPath, "WindowState"));
                FormWindowState windowState = (FormWindowState)tmp;

                m_parent.Location    = new Point(left, top);
                m_parent.Size        = new Size(width, height);
                m_parent.WindowState = windowState;
            }
            catch {}
        }
Ejemplo n.º 8
0
//		public static void ReadControlValue(Control control)
//		{
//			if (control.GetType() == typeof(TextBox))
//			{
//				TextBox c = (TextBox)control;
//				c.Text = PersistControlValue.ReadLocalAppSetting(@"Stand.Net", c.Name);
//			}
//			else if (control.GetType() == typeof(CheckBox))
//			{
//				CheckBox c = (CheckBox)control;
//				c.Checked = PersistControlValue.ReadLocalAppSetting(@"Stand.Net", c.Name) == "True" ? true : false;
//			}
//			else if (control.GetType() == typeof(RadioButton))
//			{
//				RadioButton c = (RadioButton)control;
//				c.Checked = PersistControlValue.ReadLocalAppSetting(@"Stand.Net", c.Name) == "True" ? true : false;
//			}
//			else if (control.GetType() == typeof(Label))
//			{
//				Label c = (Label)control;
//				c.Text = PersistControlValue.ReadLocalAppSetting(@"Stand.Net", c.Name);
//			}
//			else if (control.GetType() == typeof(NumericUpDown))
//			{
//				NumericUpDown c = (NumericUpDown)control;
//				try{c.Value = decimal.Parse(PersistControlValue.ReadLocalAppSetting("BatchFileGenerator", c.Name));}
//				catch {};
//			}
//			else if (control.GetType() == typeof(ComboBox))
//			{
//				ComboBox c = (ComboBox)control;
//				c.Text = PersistControlValue.ReadLocalAppSetting("BatchFileGenerator", c.Name);
//			}
//		}

        public static string ReadControlValue(Control control)
        {
            string solutionPath = @"Leden.Net";

            if (control.GetType() == typeof(TextBox))
            {
                TextBox c = (TextBox)control;
                c.Text = PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name);
                return(c.Text);
            }
            else if (control.GetType() == typeof(currencyTextBox))
            {
                currencyTextBox c = (currencyTextBox)control;
                c.Text = PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name);
                return(c.Text);
            }
            else if (control.GetType() == typeof(CheckBox))
            {
                CheckBox c = (CheckBox)control;
                c.Checked = PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name) == "True" ? true : false;
                return(c.Checked.ToString());
            }
            else if (control.GetType() == typeof(RadioButton))
            {
                RadioButton c = (RadioButton)control;
                c.Checked = PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name) == "True" ? true : false;
                return(c.Checked.ToString());
            }
            else if (control.GetType() == typeof(Label))
            {
                Label c = (Label)control;
                c.Text = PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name);
                return(c.Text);
            }
            else if (control.GetType() == typeof(NumericUpDown))
            {
                NumericUpDown c = (NumericUpDown)control;
                try
                {
                    c.Value = decimal.Parse(PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name));
                    return(c.Value.ToString());
                }
                catch {};
            }
            else if (control.GetType() == typeof(ComboBox))
            {
                ComboBox c = (ComboBox)control;
                c.Text = PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name);
                return(c.Text);
            }
            else if (control.GetType() == typeof(DateTimePicker))
            {
                DateTimePicker c = (DateTimePicker)control;
                c.Text = PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name);
            }
            else if (control.GetType() == typeof(RichTextBox))
            {
                RichTextBox c = (RichTextBox)control;
                c.Text = PersistControlValue.ReadLocalAppSetting(solutionPath, c.Name);
            }
            return(string.Empty);
        }