private void About_Load(object sender, EventArgs e) { commonSet.InitCommonSet(); commonSet.LoadSetting(); // Choose Language if (commonSet.loadedLanguageIndex == 0) { // show English this.label1.Text = "Version: " + version; this.linkLabel1.Text = "Check for Updates"; } else if (commonSet.loadedLanguageIndex == 1) { // show Chinese this.label1.Text = "版本:" + version; this.linkLabel1.Text = "檢查更新"; } else if (commonSet.loadedLanguageIndex == 2) { // show Japanese this.label1.Text = "バージョン:" + version; this.linkLabel1.Text = "更新を確認する"; } }
public MainWindow() { executableConfigName = commonSet.configurationExecutableName; configFileName = commonSet.configFileName; floatingWindowName = commonSet.floatingWindowExecutableName; InitializeComponent(); initCompleted = true; // check if the background process is running, if no, show message and end the program if (!commonSet.CheckIfRunning(commonSet.baseProgramProcessName)) { // **** removed /*if (this.LanguageSelectionBox.SelectedIndex == 1) * { * MessageBox.Show("請運行 \"StartProcess.exe\" 後進入配置視窗。"); * } * else * { * MessageBox.Show("Please run \"StartProcess.exe\" and use it to access the Configuration Window."); * }*/ MessageBox.Show("Please run \"StartProcess.exe\" and use it to access the Configuration Window."); this.Close(); } // check if any same process running, if yes, close all of them if (commonSet.CheckIfRunningSameProcess(commonSet.configurationProcessName)) { // *** removed /*if (this.LanguageSelectionBox.SelectedIndex == 1) * { * MessageBox.Show("配置視窗已開啟。"); * } * else * { * MessageBox.Show("Configuration Window is opened already."); * }*/ MessageBox.Show("Configuration Window is opened already."); this.Close(); } // check if the program name is changed if (commonSet.CheckIfNameChanged(commonSet.configurationProcessName)) { // *** removed /*if (this.LanguageSelectionBox.SelectedIndex == 1) * { * MessageBox.Show("執行檔 \".exe\" 已損壞或其檔案名稱已更改。\n請重新下載整個程式。"); * } * else * { * MessageBox.Show("Executable file name changed or corrupted.\nPlease download the program again."); * }*/ MessageBox.Show("Executable file name changed or corrupted.\nPlease download the program again."); this.Close(); } // get parameters from commonset minFrequency = commonSet.minFrequency; maxFrequency = commonSet.maxFrequency; // set the range of value of slider this.UpdateFrequencySlider.Minimum = minFrequency; this.UpdateFrequencySlider.Maximum = maxFrequency; // set the index of speed unit this.SpeedUnitSelectionBox.SelectedIndex = 1; // init common set commonSet.InitCommonSet(); GetInterfaceInformation(); LoadSetting(); GetTrafficInformation(); }
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; }
public MainWindow() { // set the floating window always on top this.Topmost = true; executableConfigName = commonSet.configurationExecutableName; configFileName = commonSet.configFileName; InitializeComponent(); // check if the background process is running, if no, show message and end the program if (!commonSet.CheckIfRunning(commonSet.baseProgramProcessName)) { MessageBox.Show("Please run \"StartProcess.exe\" and use it to access the Floating Window."); this.Close(); } // check if any same programm is running if (commonSet.CheckIfRunningSameProcess(commonSet.floatingWindowProcessName)) { MessageBox.Show("Floating Window is opened already."); this.Close(); } // check if the program name is changed if (commonSet.CheckIfNameChanged(commonSet.floatingWindowProcessName)) { MessageBox.Show("Executable file name changed or corrupted.\nPlease download the program again."); this.Close(); } // do not show in taskbar this.ShowInTaskbar = false; // init common set commonSet.InitCommonSet(); // get Interface information GetInterfaceInformation(); // load setting LoadSetting(); // apply auto start setting commonSet.ApplyAutoStartSetting(loadedAutoStartCheck); // resize window ResizeWindow(); // Get Traffic information GetTrafficInformation(); // Load and set the position of floating window LoadPosition(); // Save position of floating window SavePosition(); // check minized CheckMinimized(); }