private void LoadDeck() { if (_unsaved) { MessageBoxResult result = TopMostMessageBox.Show("This deck contains unsaved modifications. Save?", "Warning", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning); switch (result) { case MessageBoxResult.Yes: Save(); break; case MessageBoxResult.No: break; default: return; } } // Show the dialog to choose the file var ofd = new OpenFileDialog { Filter = "Octgn deck files (*.o8d) | *.o8d", InitialDirectory = new Game().GetDefaultDeckPath() }; if (ofd.ShowDialog() != true) { return; } // Try to load the file contents ObservableDeck newDeck; try { newDeck = new Deck().Load(ofd.FileName).AsObservable(); Game = GameManager.Get().Games.First(x => x.Id == newDeck.GameId); } catch (UserMessageException ex) { TopMostMessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } catch (Exception ex) { TopMostMessageBox.Show("Octgn couldn't load the deck.\r\nDetails:\r\n\r\n" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } //Game = Program.GamesRepository.Games.First(g => g.Id == newDeck.GameId); Deck = newDeck; _deckFilename = ofd.FileName; CommandManager.InvalidateRequerySuggested(); }
public static void KapanmaSorusu() { System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.SoundLocation = "kapat.wav"; try { Console.WriteLine("KapanmaSorusu"); System.Timers.Timer t = new System.Timers.Timer(30000); player.Play(); t.Elapsed += new System.Timers.ElapsedEventHandler(Saniye); t.Start(); Task.Run(() => { Program p = new Program(); trayIconSayacM(); p.MyMethod(); var dialogResult = TopMostMessageBox.Show("Kapatmak istiyor musunuz?", "Sistem", MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { string siteUrl = "http://" + site + ".com/pc/pckontrol/" + MAC + "/0"; var httpWebRequest = (HttpWebRequest)WebRequest.Create(siteUrl); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "GET"; var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); if (httpResponse.StatusCode == HttpStatusCode.OK) { Console.WriteLine("Kapaniyor"); } player.Stop(); Process.Start("shutdown", "-s -f -t 00"); } else { Console.WriteLine("Else"); player.Stop(); t.Stop(); d = false; EkranAl(); GPSAl(); IlkAcilis(); } }); } catch (Exception Exc) { errorLine = "IP: " + IP + Environment.NewLine + "MAC: " + MAC + Environment.NewLine + "WORKGROUP: " + work + Environment.NewLine + "PC: " + pcadi + Environment.NewLine + "Hata: " + Exc.Message + Environment.NewLine + "Program: " + prgName + Environment.NewLine + "Tarih: " + DateTime.Now.ToString() + Environment.NewLine + "------------------------------------" + Environment.NewLine; string file_path = @winDirShortVersion + @":\n0kayip\Logs\error_log.txt"; // Process.Start(@winDirShortVersion + @":\n0kayip\GPS.exe"); System.IO.File.AppendAllText(file_path, errorLine); PcKapat(); } }
private void DownloadUpdate(UpdateDetails details) { _realCloseWindow = true; Log.Info("Not up to date."); IsClosingDown = true; var downloadUri = new Uri(details.InstallUrl); string filename = System.IO.Path.GetFileName(downloadUri.LocalPath); if (details.UpdateDownloaded) { UpdateStatus("Launching Updater"); Log.Info("Launching updater"); Close(); return; } UpdateStatus("Downloading new version."); var fd = new FileDownloader(downloadUri, Path.Combine(Config.Instance.Paths.UpdatesPath, filename)); progressBar1.Maximum = 100; progressBar1.IsIndeterminate = false; progressBar1.Value = 0; var myBinding = new Binding("Progress"); myBinding.Source = fd; progressBar1.SetBinding(ProgressBar.ValueProperty, myBinding); var downloadTask = fd.Download(); downloadTask.ContinueWith((t) => { Log.Info("Download Complete"); if (fd.DownloadFailed || !fd.DownloadComplete) { Log.Info("Download Failed"); UpdateStatus("Downloading the new version failed. Please manually download."); TopMostMessageBox.Show("Downloading the latest version of OCTGN failed. Please visit http://www.octgn.net to download manually.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); } else { Log.Info("Launching updater"); UpdateStatus("Launching Updater"); } Dispatcher.Invoke(new Action(() => { progressBar1.IsIndeterminate = true; Close(); })); }); downloadTask.Start(); }
protected override void OnClosing(CancelEventArgs e) { if (TopMostMessageBox.Show( "Are you sure you want to quit?", "Octgn", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { e.Cancel = true; } base.OnClosing(e); }
static int Main(string[] args) { if (args.Length > 0) { switch (args[0]) { case "register": try { var sti = new Sti(); var stillImage = (IStillImage)sti; stillImage.RegisterLaunchApplication("NAPS2: Scan to profile", Application.ExecutablePath); return(0); } catch (Exception ex) { TopMostMessageBox.Show( String.Format( "Error registering as scanner button event: {0}\n\nAre you an administrator?", ex.Message), "NAPS2: Scan to profile", MessageBoxButtons.OK); } return(-1); case "unregister": try { var sti = new Sti(); var stillImage = (IStillImage)sti; stillImage.UnregisterLaunchApplication("NAPS2: Scan to profile"); return(0); } catch (Exception ex) { TopMostMessageBox.Show( String.Format( "Error registering as scanner button event: {0}\n\nAre you an administrator?", ex.Message), "NAPS2: Scan to profile", MessageBoxButtons.OK); } return(-1); } } var evtHandler = new EventHandler(); if (evtHandler.HandleEvent()) { return(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new EventsFrm()); return(0); }
/// <summary> /// Пройти обследование /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 250) { GameCharacter.Set("Money", -250); ReducingNeeds_Health(350, 650); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
public void OpenQueryDescription(string url) { try { _applicationObject.ItemOperations.Navigate(url, vsNavigateOptions.vsNavigateOptionsDefault); } catch (Exception ex) { Logger.Create().Error(ex.ToString()); TopMostMessageBox.Show(ex.Message); } }
/// <summary> /// Кафе /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonCafe_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 100) { GameCharacter.Set("Money", -100); ReducingNeeds_Food(250, 500); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
public Task Launch() { try { Deck = (DeckPath == null) ? null : new MetaDeck(DeckPath); var win = new DeckBuilderWindow(Deck, true); Application.Current.MainWindow = win; win.Show(); } catch (UserMessageException e) { TopMostMessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk); this.Shutdown = true; } return(Task.CompletedTask); }
/// <summary> /// Посетить тренинг /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_Training_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 30) { GameCharacter.Set("Money", -30); AddFeature("Charm", 10, 15); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
/// <summary> /// Пройти обучение /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_Education_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 120) { GameCharacter.Set("Money", -120); AddFeature("Intelligence", 15, 25); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
private void button_Trainer_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 150) { GameCharacter.Set("Money", -150); AddFeature("PhysicalDevelopment", 15, 25); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
/// <summary> /// Execute system command, like "Save All", "Close" etc /// </summary> /// <param name="commandName"></param> public void ExecuteSystemCommand(string commandName, string args) { try { _applicationObject.ExecuteCommand(commandName, args); } catch (Exception ex) { Logger.Create().Error(ex.ToString()); TopMostMessageBox.Show(string.Format("Can't execute {0} command", commandName)); } }
private void Open(object sender, RoutedEventArgs e) { e.Handled = true; if (this.PreGameLobby.Visibility == Visibility.Visible) { return; } if (Player.LocalPlayer.Spectator) { return; } var loadDirectory = Program.GameEngine.Definition.GetDefaultDeckPath(); // Show the dialog to choose the file var ofd = new OpenFileDialog { Filter = "Octgn deck files (*.o8d) | *.o8d", InitialDirectory = loadDirectory }; //ofd.InitialDirectory = Program.Game.Definition.DecksPath; if (ofd.ShowDialog() != true) { return; } // Try to load the file contents try { var game = GameManager.Get().GetById(Program.GameEngine.Definition.Id); var newDeck = new Deck().Load(game, ofd.FileName); //DataNew.Entities.Deck newDeck = Deck.Load(ofd.FileName, // Program.GamesRepository.Games.First(g => g.Id == Program.Game.Definition.Id)); // Load the deck into the game Program.GameEngine.LoadDeck(newDeck); if (!String.IsNullOrWhiteSpace(newDeck.Notes)) { this.table.AddNote(100, 0, newDeck.Notes); } } catch (DeckException ex) { TopMostMessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception ex) { TopMostMessageBox.Show("Octgn couldn't load the deck.\r\nDetails:\r\n\r\n" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void MenuDeckEditorClick(object sender, RoutedEventArgs e) { if (GameManager.Get().GameCount == 0) { TopMostMessageBox.Show( "You need to install a game before you can use the deck editor.", "OCTGN", MessageBoxButton.OK, MessageBoxImage.Error); return; } Program.JodsEngine.LaunchDeckEditor(); }
private void buttonCollege_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 250) { GameCharacter.Set("Money", -250); _myStudy(new CurrentStudy("Техникум", 36, 15, 1800)); Close(); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
private void buttonBaccalaureate_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 500) { GameCharacter.Set("Money", -500); _myStudy(new CurrentStudy("Балакавриат", 48, 35, 2880)); Close(); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
private void buttonMaster_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 750) { GameCharacter.Set("Money", -750); _myStudy(new CurrentStudy("Магистратура", 24, 60, 1680)); Close(); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
private void buttonGraduateSchool_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 1000) { GameCharacter.Set("Money", -1000); _myStudy(new CurrentStudy("Аспирантура", 48, 90, 3840)); Close(); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
private void buttonPhD_Click(object sender, EventArgs e) { if (GameCharacter.Money >= 1250) { GameCharacter.Set("Money", -1250); _myStudy(new CurrentStudy("Доктор наук", 60, 100, 5100)); Close(); } else { TopMostMessageBox.Show("Недостаточно денег.", "Событие"); } }
internal static void KillOtherOctgn(bool force = false) { if (Environment.GetCommandLineArgs().Any(x => x.ToLowerInvariant().Contains("table"))) { return; } Log.Info("Getting octgn processes..."); var pList = Process.GetProcessesByName("OCTGN"); Log.Info("Got process list"); if (pList != null && pList.Length > 0 && pList.Any(x => x.Id != Process.GetCurrentProcess().Id)) { Log.Info("Found other octgn processes"); if (!force) { var res = TopMostMessageBox.Show( "Another instance of OCTGN is current running. Would you like to close it?", "OCTGN", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { foreach (var p in Process.GetProcessesByName("OCTGN")) { if (p.Id != Process.GetCurrentProcess().Id) { Log.Info("Killing process..."); p.Kill(); Log.Info("Killed Process"); } } } } else { foreach (var p in Process.GetProcessesByName("OCTGN")) { if (p.Id != Process.GetCurrentProcess().Id) { Log.Info("Killing process..."); p.Kill(); Log.Info("Killed Process"); } } } } }
private void ImportImagesClicked(object sender, RoutedEventArgs e) { if (Game == null) { return; } if (SubscriptionModule.Get().IsSubscribed == false) { TopMostMessageBox.Show("You must be a subscriber to use this functionality", "Subscriber Warning", MessageBoxButton.OK, MessageBoxImage.Information); return; } var dlg = new ImportImages(Game); dlg.ShowDialog(); }
private async Task SetStateOnline() { Dispatcher.VerifyAccess(); ProfileTab.IsEnabled = true; await ProfileTabContent.Load(Program.LobbyClient.Me); if (Program.LobbyClient.Me.DisplayName.Contains(" ")) { TopMostMessageBox.Show( "WARNING: You have a space in your username. This will cause a host of problems on here. If you don't have a subscription, it would be best to make yourself a new account.", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void ImportClicked(object sender, RoutedEventArgs e) { if (Items.Where(x => x.Path == null).Any()) { var res = TopMostMessageBox.Show("Not all cards have an image matched. Continue?", "Missing Images Warning", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (res == MessageBoxResult.No) { return; } } foreach (var item in Items) { var file = item.Path; if (!File.Exists(file)) { continue; } var card = item.Card; var set = card.GetSet(); var garbage = Config.Instance.Paths.GraveyardPath; if (!Directory.Exists(garbage)) { Directory.CreateDirectory(garbage); } var imageUri = card.GetImageUri(); var files = Directory.GetFiles(set.ImagePackUri, imageUri + ".*") .Where(x => Path.GetFileNameWithoutExtension(x).Equals(imageUri, StringComparison.InvariantCultureIgnoreCase)) .OrderBy(x => x.Length) .ToArray(); // Delete all the old picture files foreach (var f in files.Select(x => new FileInfo(x))) { f.MoveTo(System.IO.Path.Combine(garbage, f.Name)); } var newPath = System.IO.Path.Combine(set.ImagePackUri, imageUri + Path.GetExtension(file)); File.Copy(file, newPath); } this.Close(); }
private void LoadSearchClick(object sender, RoutedEventArgs e) { if ((SubscriptionModule.Get().IsSubscribed ?? false) == false) { var res = TopMostMessageBox.Show( "Bummer. This is a subscriber only feature...If you would like to enable this, please visit http://www.octgn.net and subscribe, I know I would!" + Environment.NewLine + "Would you like to go there now?", "Oh No!", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (res == MessageBoxResult.Yes) { var url = SubscriptionModule.Get().GetSubscribeUrl(new SubType() { Description = "", Name = "" }); if (url != null) { Program.LaunchUrl(url); } } return; } if (!IsGameLoaded) { return; } var save = SearchSave.Load(); if (save == null) { return; } var ctrl = new SearchControl(Game, save) { SearchIndex = Searches.Count == 0 ? 1 : Searches.Max(x => x.SearchIndex) + 1 }; ctrl.CardAdded += AddResultCard; ctrl.CardRemoved += RemoveResultCard; ctrl.CardSelected += CardSelected; LoadFonts(ctrl.resultsGrid); Searches.Add(ctrl); searchTabs.SelectedIndex = Searches.Count - 1; }
public void NavigateToQueryDescription(object sender, EventArgs e) { try { QueryDescriptionEventArg nodeData = (QueryDescriptionEventArg)e; CxRESTApiPortalConfiguration rESTApiPortalConfiguration = new CxRESTApiPortalConfiguration(); rESTApiPortalConfiguration.InitPortalBaseUrl(); string urlToDescription = new QueryDescriptionUrlBuilder().Build(nodeData.QueryId, nodeData.QueryName, nodeData.QueryVersionCode); _applicationObject.ItemOperations.Navigate(urlToDescription, vsNavigateOptions.vsNavigateOptionsDefault); } catch (Exception ex) { Logger.Create().Error(ex.ToString()); TopMostMessageBox.Show(ex.Message); } }
private void Save() { if (_deckFilename == null) { SaveAs(); return; } try { Deck.Save(_game, _deckFilename); _unsaved = false; } catch (UserMessageException ex) { TopMostMessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public override void Initialize() { BeatmapManager.Initialize(); BeatmapManager.DatabaseSerialize(); if (!(ConfigManager.sSaveUsername && ConfigManager.sSavePassword)) { TopMostMessageBox.Show(LocalisationManager.GetString(OsuString.Tournament_MessageRememberCredentials)); OsuMain.ExitImmediately(); return; } int connectPeriod = 10000; while (!BanchoClient.Connected && (connectPeriod -= 50) > 0) { Thread.Sleep(50); } if (!BanchoClient.Connected) { TopMostMessageBox.Show(LocalisationManager.GetString(OsuString.Tournament_ClientCouldNotConnect)); OsuMain.ExitImmediately(); return; } #if !DEBUG if ((BanchoClient.Permission & Permissions.Tournament) == 0) { TopMostMessageBox.Show(LocalisationManager.GetString(OsuString.Tournament_MessageNoAccess)); OsuMain.ExitImmediately(); return; } #endif initializeSprites(); clients = new TournamentClientManager(this, spriteManager); Lobby = new TournamentLobby(this, spriteManager, 1.01f); base.Initialize(); StateChanged += stateChanged; State = TourneyState.Idle; }
private void MenuDeckEditorClick(object sender, RoutedEventArgs e) { if (GameManager.Get().GameCount == 0) { TopMostMessageBox.Show( "You need to install a game before you can use the deck editor.", "OCTGN", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (WindowManager.DeckEditor == null) { WindowManager.DeckEditor = new DeckBuilderWindow(); WindowManager.DeckEditor.Show(); } }
private void btnOk_Click(object sender, System.EventArgs e) { int sel = 0; // see if a call is selected if (callsList.SelectedItems.Count == 0) { TopMostMessageBox.Show(ResourceStrings.SELECT_CALL_DLG_SELECT_A_CALL, this.Text, MessageBoxButtons.OK); DialogResult = DialogResult.None; } else { sel = callsList.SelectedIndices[0]; selectedCall = (CallClassProvider)callsList.Items[sel].Tag; DialogResult = DialogResult.OK; } }