Example #1
0
        /// <summary>
        /// Initialize the main form.
        /// </summary>
        public void Initialize(WmUiBroker broker)
        {
            InitializeComponent();
            panel1.Size = panel1.Parent.ClientSize;
            m_uiBroker = broker;
            kwsHeader.UiBroker = broker;
            createKwsHeader.UiBroker = broker;
            // Show the advanced view if so desired. Otherwise, stay with
            // the default value, which is hidden.
            if (Misc.ApplicationSettings.ShowMainFormAdvancedView)
                ShowAdvancedView();

            // Initialize the resource manager. This cannot be done before
            // this form is loaded.
            Misc.InitResourceMngr(typeof(frmMain).Assembly);

            // Correctly order the toolstrips.
            toolStripContainer1.TopToolStripPanel.Controls.Clear();
            toolStripContainer1.TopToolStripPanel.Join(myMainMenu, 0);
            toolStripContainer1.TopToolStripPanel.Join(toolStripKfs, 1);
            toolStripContainer1.TopToolStripPanel.Join(toolStripInvite, 1);
            toolStripContainer1.TopToolStripPanel.Join(toolStripCommands, 1);

            // Save the main form handle so that another instance of KWM can
            // send messages to it. There is a race condition here that is
            // difficult to fix.
            RegistryKey key = Base.GetKwmCURegKey();
            key.SetValue("kwmWindowHandle", Handle, RegistryValueKind.String);

            this.AllowDrop = true;
            ApplicationsTabControl.AllowDrop = true;

            InitializeImages();

            m_trayNotifier = new TrayIconNotifier(trayIcon);

            ApplyOptions();

            // Set some visual controls properties.
            lstUsers.Columns.Add(Misc.GetString("Members"), -2);

            InitializeApplications();

            Logging.Log("KWM started.");

            // Handle minimization.
            this.MinimumSize = this.Size;

            foreach (string arg in Environment.GetCommandLineArgs())
            {
                if (arg == "/minimized")
                {
                    m_startMinimized = true;
                    break;
                }
            }

            // Initialize our blinking array.
            for (int i = 0; i < 16; i++)
            {
                String obj = "anim" + (i < 10 ? "0" : "") + i;
                Bitmap b = (Bitmap)kwm.Properties.Resources.ResourceManager.GetObject(obj);
                m_blinkingIcons[i] = Misc.MakeIcon(b, 16, true);
            }

            trayIcon.Icon = m_blinkingIcons[0];

            // Handle blinking icons.
            m_blinkingTimer = new Timer();
            m_blinkingTimer.Interval = 100;
            m_blinkingTimer.Tick += new EventHandler(TrayIconFlashTimer_Tick);
            this.Activated += new EventHandler(frmMain_Activated);

            // Restore the window state.
            m_lastWindowState = this.WindowState;
            RestoreMainFormSettings();

            StatusBarManager = new StatusBarHelper(this);
            // SaveWindowSettingsFlag will be set to true in the frmMain_Shown event handler.
        }
Example #2
0
File: frmMain.cs Project: tmbx/kwm
        /// <summary>
        /// Initialize the main form.
        /// </summary>
        public void Initialize(WmUiBroker broker)
        {
            m_uiBroker = broker;

            // Initialize the resource manager. This cannot be done before
            // this form is loaded.
            Misc.InitResourceMngr(typeof(frmMain).Assembly);

            // Save the main form handle so that another instance of KWM can
            // send messages to it. There is a race condition here that is
            // difficult to fix.
            RegistryKey key = Registry.CurrentUser.CreateSubKey(Base.GetKwmRegKey());
            key.SetValue("kwmWindowHandle", Handle, RegistryValueKind.String);

            InitializeComponent();
            this.AllowDrop = true;
            ApplicationsTabControl.AllowDrop = true;
            tblFileSharing.AllowDrop = true;

            InitializeImages();

            m_trayNotifier = new TrayIconNotifier(trayIcon);

            ApplyOptions();

            // Set some visual controls properties.
            CenterTitleLabel();
            lstUsers.Columns.Add(Misc.GetString("Members"), -2);

            InitializeApplications();

            Logging.Log("KWM started.");

            // Handle minimization.
            this.MinimumSize = this.Size;

            foreach (string arg in Environment.GetCommandLineArgs())
            {
                if (arg == "/minimized")
                {
                    m_startMinimized = true;
                    break;
                }
            }

            // Initialize our blinking array.
            for (int i = 0; i < 16; i++)
            {
                String obj = "anim" + (i < 10 ? "0" : "") + i;
                Bitmap b = (Bitmap)kwm.Properties.Resources.ResourceManager.GetObject(obj);
                m_blinkingIcons[i] = Misc.MakeIcon(b, 16, true);
            }

            trayIcon.Icon = m_blinkingIcons[0];

            // Handle blinking icons.
            m_blinkingTimer = new Timer();
            m_blinkingTimer.Interval = 100;
            m_blinkingTimer.Tick += new EventHandler(TrayIconFlashTimer_Tick);
            this.Activated += new EventHandler(frmMain_Activated);

            // Restore the window state.
            m_lastWindowState = this.WindowState;
            RestoreMainFormSettings();

            noSelectionPane.UiBroker = broker;
            // SaveWindowSettingsFlag will be set to true in the frmMain_Shown event handler.
        }