private void updateForm_Shown(object sender, EventArgs e) { //read local settings settingsFile.Read(); if (settingsFile.wowPath() == "null") { Form3 wowPathForm = new Form3(); wowPathForm.ShowDialog(this); } //check server status bool serverReply = PingHost(settingsFile.serverAddress()); if (serverReply == false) { MessageBox.Show("ERROR: {0} or Your internet connectionis down. Exiting ...", settingsFile.serverAddress()); Environment.Exit(0); } statusLabel.Text = "checking for update"; this.Refresh(); //check for update updateLabelLoopWorker.RunWorkerAsync(); updateBackgroundDownloader.RunWorkerAsync(); }
private void playButton_Click_1(object sender, EventArgs e) { ReadSettingsFile readedSettings = new ReadSettingsFile(); readedSettings.Read(); if (readedSettings.wowPath() == "" || readedSettings.wowPath() == null) { MessageBox.Show("WoW dir not set! Configure it in settings menu."); } else { try { System.Diagnostics.Process.Start(readedSettings.wowPath() + "wow.exe"); this.Hide(); trayIcon.Visible = true; trayIcon.ShowBalloonTip(1000); } catch (FileNotFoundException) { MessageBox.Show("ERROR: can't find wow.exe in: \n\n '" + readedSettings.wowPath() + "' \n\n Use settings button to set World of Warcraft directory!", "Error!"); } catch (DirectoryNotFoundException) { MessageBox.Show("ERROR: can't find wow.exe in: \n\n '" + readedSettings.wowPath() + "' \n\n Use settings button to set World of Warcraft directory!", "Error!"); } } }
private void Form3_Shown(object sender, EventArgs e) { if (this.Owner.Name == "mainForm") { ReadSettingsFile settingsFile = new ReadSettingsFile(); settingsFile.Read(); wowPathInput.Text = settingsFile.wowPath(); startUpSoundCheckBox.Checked = settingsFile.startUpSound(); minimizeToTrayCheckBox.Checked = settingsFile.minimizeToTray(); } }
private void mainForm_Shown(object sender, EventArgs e) { //morhpeus font for prettier labels. not mandatory //MorpheusFont morpheusFont = new MorpheusFont(); //morpheusFont.Load(); //playButtonLabel.Font = new Font(morpheusFont.fontFamily(), 12, FontStyle.Regular); settingsFile.Read(); if (settingsFile.startUpSound() == true) { WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer(); player.URL = @Directory.GetCurrentDirectory() + "\\sound\\startup.mp3"; player.controls.play(); } //change control properties on runtime //upArrowPicture.Parent = newsTextLabel; //upArrowPicture.Location = new Point(436, -2); //downArrowPicture.Parent = newsTextLabel; //downArrowPicture.Location = new Point(436, 73); trayIcon.BalloonTipTitle = "TrueWoW Launcher"; trayIcon.BalloonTipText = "Launcher minimized to tray. Right click icon for menu."; if (settingsFile.minimizeToTray() == true) { trayIcon.Visible = true; } else { trayIcon.Visible = false; } #region BLP-TEST //try //{ // if (this.blpLoader != null) // { // this.blpLoader.close(); // this.blpLoader = null; // } // FileStream file = new FileStream("example.blp", FileMode.Open); // this.blpLoader = new SereniaBLPLib.BlpFile(file); // // loading bitmap level 0 // loadedBLP = this.blpLoader.getBitmap(0); // Rectangle imgDimensions = new Rectangle(); // imgDimensions.Location = new Point(50, 15); // imgDimensions.Width = 155; // imgDimensions.Height = 32; // playButtonBitmap = loadedBLP.Clone(imgDimensions, loadedBLP.PixelFormat); // playButton.Image = playButtonBitmap; // if (this.blpLoader != null) // { // this.blpLoader.close(); // this.blpLoader = null; // } // file.Close(); // file = new FileStream("Glues-BigButton-Glow.blp", FileMode.Open); // this.blpLoader = new SereniaBLPLib.BlpFile(file); // loadedBLP = this.blpLoader.getBitmap(0); // imgDimensions = new Rectangle(); // imgDimensions.Location = new Point(43, 7); // imgDimensions.Width = 170; // imgDimensions.Height = 50; // playButtonBitmap = loadedBLP.Clone(imgDimensions, loadedBLP.PixelFormat); // playButtonHoover.Image = playButtonBitmap; //} //catch (FileNotFoundException fe) //{ // MessageBox.Show("The 'example.blp' was not found!"); //} #endregion //read data inside zip ZipStorer newsZIP = ZipStorer.Open(@Directory.GetCurrentDirectory() + "\\news\\news.zip", FileAccess.Read); // Read all directory contents List <ZipStorer.ZipFileEntry> dir = newsZIP.ReadCentralDir(); // Extract all files in target directory string path; bool result; foreach (ZipStorer.ZipFileEntry entry in dir) { path = Path.Combine(@Directory.GetCurrentDirectory() + "\\news\\", Path.GetFileName(entry.FilenameInZip)); result = newsZIP.ExtractFile(entry, path); } newsZIP.Close(); this.Refresh(); readedNews.Read(); for (int i = 0; i < readedNews.newsCount(); i++) { Label tmpControl = new Label(); if (i == 0) { tmpControl.BackColor = System.Drawing.Color.Aqua; } else { tmpControl.BackColor = System.Drawing.Color.Gray; } tmpControl.Cursor = System.Windows.Forms.Cursors.Hand; tmpControl.Name = "newsSelector" + i.ToString(); //tmpControl. = "newsSelector" + i.ToString(); tmpControl.Size = new System.Drawing.Size(10, 10); tmpControl.Click += new System.EventHandler(this.newsSelectorSelected_Click); this.Controls.Add(tmpControl); tmpControl.Parent = this.newsPicture; tmpControl.Location = new System.Drawing.Point((3 + (i * 16)), 3); newsSelector.Add(tmpControl); } newsPicture.ImageLocation = @Directory.GetCurrentDirectory() + "\\news\\" + readedNews.newsImg(0); newsTittleLabel.Text = readedNews.newsTittle(0); newsTextLabel.Text = readedNews.newsText(0); newsSelectorHistory = 0; newsLoopWorker.RunWorkerAsync(); }