예제 #1
0
        /// <summary>
        /// Initialize PuTTY STORM sessions form (Form2) and register hotkeys for
        /// easy and fast swithing between TabPages.
        /// </summary>
        public SessionsForm(List <ProcessInfo> _my_ProcessInfo_List_TC_1, TabControl _tabcontrol1, TabControl _tabcontrol2,
                            SplitContainer _SessionsSplitContainer, List <GroupBox> _containers_list, GlobalHotKeysWorker _TabPagesForwardGlobalHotKeyWorker,
                            GlobalHotKeysWorker _TabPagesBackwardGlobalHotKeyWorker, GlobalHotKeysWorker _SplitScreenGlobalHotKeyWorker,
                            GlobalHotKeysWorker _SFTPManagerGlobalHotKeyWorker, GlobalHotKeysWorker _KotarakGlobalHotKeyWorker)
        {
            this.tabcontrol1 = _tabcontrol1;
            this.tabcontrol2 = _tabcontrol2;
            this.my_ProcessInfo_List_TC_1 = _my_ProcessInfo_List_TC_1;
            this.SessionsSplitContainer   = _SessionsSplitContainer;
            this.containers_list          = _containers_list;

            // GlobalHotKeys Configuration settings
            tabPagesForwardGlobalHotKeySettings  = new TabPagesForwardGlobalHotKeySettings();
            tabPagesbackwardGlobalHotKeySettings = new TabPagesBackwardGlobalHotKeySettings();
            splitScreenGlobalHotKeySettings      = new SplitScreenGlobalHotKeySettings();
            sftpManagerGlobalHotKeySettings      = new SFTPManagerGlobalHotKeySettings();
            kotarakGlobalHotKeySettings          = new KotarakGlobalHotKeySettings();

            // GlobalHotKeys registration
            this.TabPagesForwardGlobalHotKeyWorker  = _TabPagesForwardGlobalHotKeyWorker;
            this.TabPagesBackwardGlobalHotKeyWorker = _TabPagesBackwardGlobalHotKeyWorker;
            this.SplitScreenGlobalHotKeyWorker      = _SplitScreenGlobalHotKeyWorker;
            this.SFTPManagerGlobalHotKeyWorker      = _SFTPManagerGlobalHotKeyWorker;
            this.KotarakGlobalHotKeyWorker          = _KotarakGlobalHotKeyWorker;

            saved_data     = new GetSavedSessions();
            IsPasswordLess = new PasswordLess();

            // Initialize GlobalHotKeys to the default values if config is empty (application first run)!
            GlobalHotKeysFirstStart();

            // Register GlobalHotKeys
            this.TabPagesForwardGlobalHotKeyWorker.Handle = this.Handle;
            this.TabPagesForwardGlobalHotKeyWorker.RegisterGlobalHotKey((int)GlobalHotKeysManager.ConvertFromStringToKey(tabPagesForwardGlobalHotKeySettings.key),
                                                                        tabPagesForwardGlobalHotKeySettings.modifier);

            this.TabPagesBackwardGlobalHotKeyWorker.Handle = this.Handle;
            this.TabPagesBackwardGlobalHotKeyWorker.RegisterGlobalHotKey((int)GlobalHotKeysManager.ConvertFromStringToKey(tabPagesbackwardGlobalHotKeySettings.key),
                                                                         tabPagesbackwardGlobalHotKeySettings.modifier);

            this.SplitScreenGlobalHotKeyWorker.Handle = this.Handle;
            this.SplitScreenGlobalHotKeyWorker.RegisterGlobalHotKey((int)GlobalHotKeysManager.ConvertFromStringToKey(splitScreenGlobalHotKeySettings.key),
                                                                    splitScreenGlobalHotKeySettings.modifier);

            this.SFTPManagerGlobalHotKeyWorker.Handle = this.Handle;
            this.SFTPManagerGlobalHotKeyWorker.RegisterGlobalHotKey((int)GlobalHotKeysManager.ConvertFromStringToKey(sftpManagerGlobalHotKeySettings.key),
                                                                    sftpManagerGlobalHotKeySettings.modifier);

            this.KotarakGlobalHotKeyWorker.Handle = this.Handle;
            this.KotarakGlobalHotKeyWorker.RegisterGlobalHotKey((int)GlobalHotKeysManager.ConvertFromStringToKey(kotarakGlobalHotKeySettings.key),
                                                                kotarakGlobalHotKeySettings.modifier);


            WindowEvents = new GlobalWindowEvents();
            SessionsForm.WindowEvents.SystemSwitch += new EventHandler <GlobalWindowEventArgs>(OnSystemSwitch);
        }