Example #1
0
        private void ShowFloatingWindow()
        {
            // check the size of floating window

            /*if (loadedDisplaySizeIndex == 0)
             * {
             *  sfw = new SmallFloatingWindow();
             *  sfw.Show();
             * }*/
            if (!commonSet.StartProcess(floatingWindowName))
            {
                if (this.LanguageSelectionBox.SelectedIndex == 1)
                {
                    MessageBox.Show("懸浮窗模組已損壞或不存在。\n請重新下載本程式。");
                }
                // *** Japanese is added
                else if (this.LanguageSelectionBox.SelectedIndex == 2)
                {
                    MessageBox.Show("フローティング・ウィンドウのファイルが破損しているか存在しない。\nもう一度プログラムをダウンロードしてください。");
                }
                else
                {
                    MessageBox.Show("Floating Window module is corrupted or doesn't exist.\nPlease download the program again.");
                }
            }/*
              * try
              * {
              * System.Diagnostics.Process.Start(System.AppDomain.CurrentDomain.BaseDirectory + floatingWindowName);
              * }
              * catch
              * {
              * MessageBox.Show("Floating Window file corrupted or not exist\nPlease download the program again");
              * }*/
        }
        private void Booter_Load(object sender, EventArgs e)
        {
            if (!commonSet.StartProcess(commonSet.baseProgramExecutableName))
            {
                MessageBox.Show("Main program may be corrupted\nPlease download this program again", "SNTM Error");
                this.Close();
            }

            // hide the booting window
            this.ShowInTaskbar = false;
            this.Visible       = false;
        }
Example #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // init the commonset
            commonSet.InitCommonSet();

            // check if this computer has any network interfaces
            if (!commonSet.CheckIfHaveInterface())
            {
                MessageBox.Show("There is no network interface enabled in this computer.\nPlease make sure your network interfaces are enabled and start this monitor again.");
                commonSet.EndAllProcess();
            }


            // check if the same program is running already
            if (commonSet.CheckIfRunningSameProcess(commonSet.baseProgramProcessName))
            {
                MessageBox.Show("Simple Network Traffic Monitor is running already.\nPlease try to find it in system tray.");
                this.Close();
            }

            // check if the program name is changed
            if (commonSet.CheckIfNameChanged(commonSet.baseProgramProcessName))
            {
                MessageBox.Show("Executable file name changed or corrupted.\nPlease download the program again.");
                this.Close();
            }

            // Load configuration file
            LoadSetting();

            // check if need to show bubble message
            if (commonSet.loadedShowBubbleCheck)
            {
                // show message to tell te user the program is running in background
                if (commonSet.loadedLanguageIndex == 0)
                {
                    // show English message
                    BGWorkNotifyIcon.BalloonTipText = "Windows Simple Network Monitor is running in system tray.\n(right click the icon to open menu)";
                }
                else if (commonSet.loadedLanguageIndex == 1)
                {
                    // show Chinese message
                    BGWorkNotifyIcon.BalloonTipText = "Windows 網絡監測器現於系統盤中運行\n(右擊圖標以顯示操作選項)";
                }
                else if (commonSet.loadedLanguageIndex == 2)
                {
                    // show Japanese message
                    BGWorkNotifyIcon.BalloonTipText = "ネットワークモニタはシステムトレイで実行されている。\n (アイコンを右クリックして、メニューを開く)";
                }

                BGWorkNotifyIcon.ShowBalloonTip(1000);
            }

            // Check if need to show the floating window
            if (loadedDisplayMethodIndex == 0 || loadedDisplayMethodIndex == 2)
            {
                if (!commonSet.StartProcess(commonSet.floatingWindowExecutableName))
                {
                    if (loadedLanguageIndex == 1)
                    {
                        MessageBox.Show("不能顯示懸浮窗。\n請重新下載本程式。");
                    }
                    else if (loadedLanguageIndex == 2)
                    {
                        MessageBox.Show("フローティング・ウィンドウが表示できない。\nもう一度プログラムをダウンロードしてください。");
                    }
                    else
                    {
                        // show erroe message if the floating window cannot be shown
                        MessageBox.Show("Cannot show the floating window.\nPlease download the program again.");
                    }
                }
            }


            // hide the loading window
            this.ShowInTaskbar = false;
            this.Visible       = false;
            //this.WindowState = FormWindowState.Minimized;
        }