示例#1
0
        /// <summary>
        /// Method Responsible for Applying the ListView Options we just call it in the form load once
        /// and we do not need it again
        /// </summary>
        private void ApplyViewOptions()
        {
            try
            {
                //Open the key according to the user name, so we let each user
                //has his own settigs
                RegistryKey InnerReg = Registry.LocalMachine.OpenSubKey
                                           (@"Software\AlQademoUn\StartEdit\" + Environment.UserName, true);

                // Check The "save The columns width" option
                if (bool.Parse(InnerReg.GetValue("SaveColWidth", "false").ToString()))
                {
                    for (int Cols = 0; Cols <= 5; Cols++) // Because we have only 5 columns
                    {
                        ViewMain.Columns[Cols].Width = int.Parse(
                            InnerReg.GetValue("Col" + Cols.ToString(), 150).ToString());
                    }
                }

                // to remeber the last view applied by the user details, list,
                //small icons or larg icons
                if (bool.Parse(InnerReg.GetValue("RememberView", "false").ToString()))
                {
                    SwitchViewTo(InnerReg.GetValue("LastView", "Details").ToString());
                }

                // to Expand the treeview if the user wishes that
                if (bool.Parse(InnerReg.GetValue("ExpandOnStart", "false").ToString()))
                {
                    TreeMain.ExpandAll();
                    TreeMain.Nodes[0].EnsureVisible();
                }

                InnerReg.Close();
            }
            catch (System.Security.SecurityException MyExp)
            {
                MessageBox.Show
                    ("An error returned while trying to access the windows registry" +
                    "Error is " + MyExp.Message + "\n" +
                    "Startup Editor requires an administrartor privileges to run properly", "Access is denied");
                return;
            }
            catch (ArgumentNullException MyEx)
            {
                MessageBox.Show("Error applying settings" + "\n" + MyEx.Message);
            }
            catch (NullReferenceException MyEx)
            {
                MessageBox.Show("Error applying settings" + "\n" + MyEx.Message);
            }
            catch (Exception MyEx)
            {
                MessageBox.Show("Error applying settings" + "\n" + MyEx.Message);
            }
        }
示例#2
0
 private void IsdalTreeExpandAll_Click(object sender, System.EventArgs e)
 {
     TreeMain.ExpandAll();
 }
示例#3
0
 private void IsdalTreeCollapseAll_Click(object sender, System.EventArgs e)
 {
     TreeMain.CollapseAll();
 }
 void Awake()
 {
     tree = GetComponentInParent <TreeMain>();
 }