Наследование: System.Windows.Forms.Form
Пример #1
0
        public popupImport(formOptions form)
        {
            optionsform = form;
            InitializeComponent();

            oheight = Height;
        }
Пример #2
0
        public popupImport(formOptions form)
        {
            optionsform = form;
            InitializeComponent();

            oheight = Height;
        }
Пример #3
0
        public formMain(bool full)
        {
            #if DEBUG
            DateTime time = DateTime.Now;
            #endif
            string cfgpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\", "");
            string userpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            if (File.Exists(cfgpath + "\\" + Settings.Default.cfgfilepath)) Settings.Default.cfgpath = cfgpath + "\\" + Settings.Default.cfgfilepath;
            else if (File.Exists(userpath + "\\" + Settings.Default.cfgfilepath)) Settings.Default.cfgpath = userpath + "\\" + Settings.Default.cfgfilepath;
            else
            {
                try
                {
                    Settings.Default.cfgpath = cfgpath + "\\" + Settings.Default.cfgfilepath;
                    XmlCreate();
                }
                catch (UnauthorizedAccessException)
                {
                    if (!File.Exists(userpath))
                    {
                        try
                        {
                            Settings.Default.cfgpath = userpath + "\\" + Settings.Default.cfgfilepath;
                            XmlCreate();
                        }
                        catch (UnauthorizedAccessException)
                        {
                            Error("No really, I could not find nor write my configuration file :'(\rPlease check your user permissions.");
                            Environment.Exit(-1);
                        }
                    }
                }
            }

            if (!full) return;
            InitializeComponent();

            FindSwitch(false);
            cbType.SelectedIndex = 0;
            if (XmlConfigGet("password") != "") Settings.Default.password = XmlConfigGet("password");
            if (XmlConfigGet("multicolumnwidth") != "") Settings.Default.multicolumnwidth = Convert.ToInt32(XmlConfigGet("multicolumnwidth"));
            if (XmlConfigGet("multicolumn").ToLower() == "true") Settings.Default.multicolumn = true;
            if (XmlConfigGet("minimize").ToLower() == "false") Settings.Default.minimize = false;
            if (XmlConfigGet("putty") != "") Settings.Default.puttypath = XmlConfigGet("putty");
            if (XmlConfigGet("puttyexecute").ToLower() == "true") Settings.Default.puttyexecute = true;
            if (XmlConfigGet("puttycommand") != "") Settings.Default.puttycommand = XmlConfigGet("puttycommand");
            if (XmlConfigGet("puttykey").ToLower() == "true") Settings.Default.puttykey = true;
            if (XmlConfigGet("puttykeyfile") != "") Settings.Default.puttykeyfile = XmlConfigGet("puttykeyfile");
            if (XmlConfigGet("puttyforward").ToLower() == "true") Settings.Default.puttyforward = true;
            if (XmlConfigGet("remotedesktop") != "") Settings.Default.rdpath = XmlConfigGet("remotedesktop");
            if (XmlConfigGet("rdfilespath") != "") Settings.Default.rdfilespath = XmlConfigGet("rdfilespath");
            if (XmlConfigGet("rdadmin").ToLower() == "true") Settings.Default.rdadmin = true;
            if (XmlConfigGet("rddrives").ToLower() == "true") Settings.Default.rddrives = true;
            if (XmlConfigGet("rdspan").ToLower() == "true") Settings.Default.rdspan = true;
            if (XmlConfigGet("rdsize") != "") Settings.Default.rdsize = XmlConfigGet("rdsize");
            if (XmlConfigGet("vnc") != "") Settings.Default.vncpath = XmlConfigGet("vnc");
            if (XmlConfigGet("vncfilespath") != "") Settings.Default.vncfilespath = XmlConfigGet("vncfilespath");
            if (XmlConfigGet("vncfullscreen").ToLower() == "true") Settings.Default.vncfullscreen = true;
            if (XmlConfigGet("vncviewonly").ToLower() == "true") Settings.Default.vncviewonly = true;
            if (XmlConfigGet("winscp") != "") Settings.Default.winscppath = XmlConfigGet("winscp");
            if (XmlConfigGet("winscpkey").ToLower() == "true") Settings.Default.winscpkey = true;
            if (XmlConfigGet("winscpkeyfile") != "") Settings.Default.winscpkeyfile = XmlConfigGet("winscpkeyfile");

            optionsform = new formOptions(this);

            IntPtr sysMenuHandle = GetSystemMenu(Handle, false);
            //It would be better to find the position at run time of the 'Close' item, but...

            InsertMenu(sysMenuHandle, 5, MF_BYPOSITION | MF_SEPARATOR, 0, string.Empty);
            InsertMenu(sysMenuHandle, 6, MF_BYPOSITION, IDM_ABOUT, "About");

            notifyIcon.Visible = Settings.Default.minimize;
            notifyIcon.ContextMenu = cmSystray;

            int i = 0;
            MenuItem connectmenu = new MenuItem();
            connectmenu.Index = i;
            connectmenu.Text = "Connect";
            connectmenu.Click += lbList_DoubleClick;
            cmList.MenuItems.Add(connectmenu);
            i++;
            MenuItem sepmenu1 = new MenuItem();
            sepmenu1.Index = i;
            sepmenu1.Text = "-";
            cmList.MenuItems.Add(sepmenu1);
            i++;
            foreach (string type in cbType.Items)
            {
                int j = i;
                MenuItem listmenu = new MenuItem();
                listmenu.Index = i;
                listmenu.Text = type;
                listmenu.Click += delegate { Connect(listmenu.Text); };
                cmList.MenuItems.Add(listmenu);
                i++;
            }
            MenuItem sepmenu2 = new MenuItem();
            sepmenu2.Index = i;
            sepmenu2.Text = "-";
            cmList.MenuItems.Add(sepmenu2);
            i++;
            MenuItem deletemenu = new MenuItem();
            deletemenu.Index = i;
            deletemenu.Text = "Delete";
            deletemenu.Click += mDelete_Click;
            cmList.MenuItems.Add(deletemenu);

            XmlToList();
            if (lbList.Items.Count > 0) lbList.SelectedIndex = 0;
            BeginInvoke(new InvokeDelegate(lbList.Focus));

            AutoSize = false;
            MinimumSize = Size;
            #if DEBUG
            MessageBox.Show("StartUp Time :" + (DateTime.Now - time));
            #endif
        }
Пример #4
0
 public popupRecrypt(formOptions form)
 {
     optionsform = form;
     InitializeComponent();
 }
Пример #5
0
 public popupRecrypt(formOptions form)
 {
     optionsform = form;
     InitializeComponent();
 }