コード例 #1
0
        private void NewFolderClick(object sender, RoutedEventArgs e)
        {
            if (SelectedList == null)
            {
                return;
            }
            var id   = new InputDlg("Create a New Folder", "Please enter a folder name", "");
            var name = id.GetString();

            if (String.IsNullOrWhiteSpace(name))
            {
                return;
            }
            try
            {
                var path = Path.Combine(SelectedList.Path, name);
                Directory.CreateDirectory(path);
                SelectedList.DeckLists.Add(new DeckList(path, this.Dispatcher, SelectedList, false));
            }
            catch (Exception ex)
            {
                Log.Warn("NewFolderClick", ex);
                TopMostMessageBox.Show(
                    "This folder name is invalid.",
                    "Invalid",
                    MessageBoxButton.OK,
                    MessageBoxImage.Information);
            }
        }
コード例 #2
0
        private void RenameFolderClick(object sender, RoutedEventArgs e)
        {
            if (SelectedList == null)
            {
                return;
            }
            var id   = new InputDlg("Rename Folder", "Please enter a new folder name", "");
            var name = id.GetString();

            if (String.IsNullOrWhiteSpace(name))
            {
                return;
            }
            try
            {
                var di      = new DirectoryInfo(SelectedList.Path);
                var newPath = Path.Combine(di.Parent.FullName, name);
                Directory.Move(SelectedList.Path, newPath);
                var parent = SelectedList.Parent;
                parent.DeckLists.Remove(SelectedList);
                parent.DeckLists.Add(new DeckList(newPath, this.Dispatcher, parent));
            }
            catch (Exception ex)
            {
                Log.Warn("RenameFolderClick", ex);
                TopMostMessageBox.Show(
                    "This folder name is invalid.",
                    "Invalid",
                    MessageBoxButton.OK,
                    MessageBoxImage.Information);
            }
        }
コード例 #3
0
        private void viewResult_SelectedRowChanged(object sender, EventArgs e)
        {
            try
            {
                ResultData data = (ResultData)e;
                CxViewerAction.CxVSWebService.CxWSResultPath resultPath = PerspectiveHelper.GetResultPath(data.ScanId, data.Result.PathId);

                PerspectiveGraphCtrl viewGraph = null;
                if (_graphWin != null)
                {
                    viewGraph = _graphWin.Window as PerspectiveGraphCtrl;
                    if (viewGraph != null)
                    {
                        CxViewerAction.BaseInterfaces.IGraphPath path = viewGraph.FindPath(resultPath);
                        viewGraph.SelectEdgeGraphByPath(path.DirectFlow[0], path.DirectFlow[1], path);
                        viewGraph.BindData();
                        viewGraph.PathItemClick = GraphClick;
                    }
                }

                #region [Bind path view]
                if (_pathWin != null)
                {
                    IPerspectivePathView viewPath = _pathWin.Window as IPerspectivePathView;
                    CxViewerAction.Entities.WebServiceEntity.ReportQueryItemResult path = new CxViewerAction.Entities.WebServiceEntity.ReportQueryItemResult()
                    {
                        Column   = resultPath.Nodes[0].Column,
                        FileName = resultPath.Nodes[0].FileName,
                        Line     = resultPath.Nodes[0].Line,
                        NodeId   = resultPath.Nodes[0].PathNodeId,
                        PathId   = resultPath.PathId,
                        Query    = data.NodeData.QueryResult
                    };
                    path.Paths = GraphHelper.ConvertNodesToPathes(resultPath.Nodes, data.NodeData.QueryResult, path);
                    viewPath.PathButtonClickHandler = PathButtonClick;

                    viewPath.QueryItemResult = path;

                    viewPath.BindData(resultPath.Nodes[0].PathNodeId);

                    showView(_pathWin);
                }
                #endregion

                ShowFile(resultPath.Nodes[0].FileName, resultPath.Nodes[0].Line, resultPath.Nodes[0].Column, resultPath.Nodes[0].Length);
            }
            catch (Exception ex)
            {
                if (ex is System.Net.WebException)
                {
                    Logger.Create().Error(ex.ToString());
                    TopMostMessageBox.Show(ex.Message, "Error");
                }
                else
                {
                    Logger.Create().Error(ex.ToString());
                    TopMostMessageBox.Show("General error occured, please check the log", "Error");
                }
            }
        }
コード例 #4
0
 public void PickGameMode(GameMode g)
 {
     if (g == null)
     {
         Log.Warn("Tried to pick null game mode?");
         return;
     }
     if (g.Name == "Back")
     {
         Log.Info("Going back to choose game");
         ResetToBeginning();
         return;
     }
     if (WindowManager.PlayWindow != null)
     {
         TopMostMessageBox.Show(
             "You are currently in a game or game lobby. Please leave before you start matchmaking.",
             "OCTGN",
             MessageBoxButton.OK,
             MessageBoxImage.Error);
         ResetToBeginning();
         return;
     }
     Log.InfoFormat("Picking game mode {0}", g.Name);
     Mode = g;
     DoStartMatchmaking();
 }
コード例 #5
0
 private bool SaveToFile(string filename)
 {
     try
     {
         var bf = new BinaryFormatter();
         using (var fs = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None))
         {
             bf.Serialize(fs, this);
             fs.Flush(true);
         }
         this.FileName = filename;
         this.Name     = new FileInfo(this.FileName).Name;
         return(true);
     }
     catch (Exception e)
     {
         Log.Warn("SaveToFile Error " + filename, e);
         TopMostMessageBox.Show(
             "There was an error saving your search. Please consult the log files.",
             "Error",
             MessageBoxButton.OK,
             MessageBoxImage.Error);
     }
     return(false);
 }
コード例 #6
0
 public static SearchSave Load(string filename)
 {
     try
     {
         var ret = new SearchSave();
         var bf  = new BinaryFormatter();
         using (var fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None))
         {
             ret = (SearchSave)bf.Deserialize(fs);
         }
         ret.FileName = filename;
         ret.Name     = new FileInfo(ret.FileName).Name;
         return(ret);
     }
     catch (Exception e)
     {
         Log.Warn("Load Error " + filename, e);
         TopMostMessageBox.Show(
             "There was an error loading your search. Please consult the log files.",
             "Error",
             MessageBoxButton.OK,
             MessageBoxImage.Error);
     }
     return(null);
 }
コード例 #7
0
 private void save()
 {
     try
     {
         if (!Connect.IsLoaded)
         {
             MessageBox.Show("Checkmarx Visual Studio Plugin is disable. \r\nPlease enable the plugin in Tools->Add-In Manager", "Information", MessageBoxButtons.OK);
             return;
         }
         string errorMessage;
         if (txtExcludeFileExtValidating(out errorMessage) && txtExcludeFolderValidating(out errorMessage) &&
             txtZipMazSizeValidating(out errorMessage))
         {
             LoginData currentLogin = BindDataFromView();
             LoginHelper.Save(currentLogin);
         }
         else
         {
             TopMostMessageBox.Show(errorMessage, "Error");
         }
     }
     catch (Exception ex)
     {
         Common.Logger.Create().Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK);
     }
 }
コード例 #8
0
        /// <summary>
        /// Событие происходящее раз в пол года
        /// Проверка выполнения плана
        /// </summary>
        private void ImplementationPlan()
        {
            if (_currentJob.Plan <= _currentJob.WorkPlan)
            {
                GameCharacter.Set("Money", _currentJob.Salary_End * 2);

                TopMostMessageBox.Show("Вы выполнили план. В качестве премии вам начислили " + (_currentJob.Salary_End * 2).ToString() + " $", "Событие");
            }
            else
            {
                var randomValue = random.Next(0, 4);

                if (randomValue == 0)
                {
                    QuitWork_Click(new object(), new EventArgs());
                    TopMostMessageBox.Show("Вы не выполнили план и поэтому вас уволили с работы", "Событие");
                }
                else
                {
                    TopMostMessageBox.Show("Вы не выполнили план", "Событие");
                }
            }

            _currentJob.WorkPlan = 0;
            TextOutput(labelWorkPlan, "Выполнение плана: 0%");
        }
コード例 #9
0
 private void LoadDeck(string path)
 {
     try
     {
         var game    = GameManager.Get().GetById(Program.GameEngine.Definition.Id);
         var newDeck = new Deck().Load(game, path);
         //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, false);
         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);
     }
 }
コード例 #10
0
 private static void theIdleTimeout(object source, ElapsedEventArgs e)
 {
     if (Program.m_IdleTimerStopFlg == Program.IDLETIMER_PAUSE)
     {
         return;
     }
     if (Program.m_IdleTimeSet <= 0)
     {
         return;
     }
     Program.m_IdleCounter++;
     if (Program.m_IdleCounter >= Program.m_IdleTimeSet)
     {
         Program.m_IdleTimer.Stop();
         string para = "0230003\nAAA";
         ClientAPI.RemoteCall(100, 1, para, 10000);
         ClientAPI.Logout();
         ClientAPI.StopBroadcastChannel();
         EcoGlobalVar.stopalltimer(true);
         ControlAccess.ConfigControl config = delegate(Control control, object obj)
         {
             TopMostMessageBox.Show(EcoLanguage.getMsginThread("ThreadPopMsg_IdleTimeout", new string[0]), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         };
         ControlAccess controlAccess = new ControlAccess(EcoGlobalVar.gl_mainForm, config);
         controlAccess.Access(EcoGlobalVar.gl_mainForm, null);
         Program.ExitApp();
     }
 }
コード例 #11
0
        public void Setup(bool isLocalGame, Window owner)
        {
            //this.Owner = owner;
            //this.Topmost = false;
            if (this.Visibility != Visibility.Visible)
            {
                this.Show();
            }
            this.Focus();
            this.Content = null;
            this.lobby   = null;

            if (Program.GameEngine == null || Program.GameEngine.Definition == null)
            {
                TopMostMessageBox.Show(
                    "Something went wrong. Please tell someone!",
                    "Error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Question);
                return;

                this.Close();
            }

            lobby          = new PreGameLobby();
            lobby.OnClose += PreGameLobbyOnOnClose;
            this.Content   = lobby;
        }
コード例 #12
0
 private void maskedTextBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (panel1.Visible)
     {
         if (e.KeyCode == Keys.Return & textBox1.Text.Length > 0)
         {
             if (ListaFolderowMontaz.Contains(textBox1.Text))
             {
                 progressBar1.Visible = true;
                 panel1.Visible       = false;
                 ThreadFinished       = false;
                 ThreadTimer.Enabled  = true;
                 pictureBox1.Image    = Properties.Resources.hexLoader;
                 pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
                 pictureBox2.Image    = Properties.Resources.hexLoader;
                 pictureBox2.SizeMode = PictureBoxSizeMode.CenterImage;
                 label12NC.Text       = textBox1.Text;
                 new Thread(delegate()
                 {
                     LoadImages(textBox1.Text);
                 }).Start();
             }
             else
             {
                 TopMostMessageBox.Show("Nieprawidłowe 12NC");
             }
         }
         if (e.KeyCode == Keys.Escape)
         {
             ShowButtons();
         }
     }
 }
コード例 #13
0
        /// <summary>
        /// Kills an application and its children with user prompts.
        /// </summary>
        /// <param name="App">Process to kill</param>
        public static void AppKill(Process App)
        {
            //Minimize application before processing.
            appMin(App);

            //Verify that user wants to kill app
            DialogResult res = TopMostMessageBox.Show("Would you like to terminate " + App.ProcessName + "\nThis may result in lost work.", "WARNING", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop);

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    //kill App.
                    KillProcessAndChildren(App.Id);
                }
                catch
                {
                    MessageBox.Show(App.ProcessName + " could not be killed.");
                }
            }
            if (res == DialogResult.Cancel)
            {
                //Restore App
                appRestore(App);
            }
        }
コード例 #14
0
        private static void databaseDeserialize()
        {
            DatabaseHelper.Read(DATABASE_FILENAME, sr =>
            {
                DatabaseVersion = sr.ReadInt32();
                FolderFileCount = sr.ReadInt32();
                BanchoClient.AllowUserSwitching            = sr.ReadBoolean();
                BanchoClient.AllowUserSwitchingRestoration = sr.ReadDateTime().ToLocalTime();

                string checkUsername = sr.ReadString();
                if (!BanchoClient.AllowUserSwitching && ConfigManager.sUsername != checkUsername)
                {
                    ConfigManager.sUsername = checkUsername;
                }

                Beatmaps = (List <Beatmap>)sr.ReadBList <Beatmap>();

                if (!BanchoClient.PermissionsReceivedOnce && GameBase.HasLogin)
                {
                    BanchoClient.Permission = (Permissions)sr.ReadInt32();
                }

                ReloadDictionaries();
            }, () =>
            {
                TopMostMessageBox.Show(
                    "The local beatmap database seems corrupt.  Will create from scratch (this may take a while...).");
            });

            databasePostProcess();
        }
コード例 #15
0
        private void DeleteFolderClick(object sender, RoutedEventArgs e)
        {
            if (SelectedList == null)
            {
                return;
            }
            var res =
                TopMostMessageBox.Show(
                    "Are you sure you want to delete this folder? All of the decks inside will also be deleted.",
                    "Delete Folder Prompt",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Asterisk);

            if (res != MessageBoxResult.Yes)
            {
                return;
            }
            try
            {
                Directory.Delete(SelectedList.Path, true);
                SelectedList.Parent.DeckLists.Remove(SelectedList);
            }
            catch (Exception ex)
            {
                Log.Warn("DeleteFolderClick", ex);
                TopMostMessageBox.Show(
                    "This folder could not be deleted. Please try restarting OCTGN or your computer.",
                    "Error Deleting Folder",
                    MessageBoxButton.OK,
                    MessageBoxImage.Information);
            }
        }
コード例 #16
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            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:
                    e.Cancel = true;
                    return;
                }
            }
            Game = null; // Close DB if required
            WindowManager.DeckEditor = null;
            if (this.exitOnClose)
            {
                Program.Exit();
            }
        }
コード例 #17
0
        private void ShowSavedResults()
        {
            LoginData login = LoginHelper.LoadSaved();

            CxViewerAction.CxVSWebService.CxWSQueryVulnerabilityData[] scanData = null;
            long scanId = 0;

            scanId = CommonData.SelectedScanId;
            if (scanId == 0)
            {
                TopMostMessageBox.Show("No Stored Results Found", "Information");
                return;
            }
            scanData = SavedResultsManager.Instance.LoadStoredScanData(scanId);

            if (scanData.Length > 0)
            {
                PerspectiveHelper.ShowStored(scanData, login, scanId);
                CommonActionsInstance.getInstance().ShowReportView();
            }
            else
            {
                TopMostMessageBox.Show("No Stored Results Found", "Information");
            }
        }
コード例 #18
0
ファイル: GameManagement.xaml.cs プロジェクト: rerbes/OCTGN
        private void ButtonAddo8gClick(object sender, RoutedEventArgs e)
        {
            var of = new System.Windows.Forms.OpenFileDialog();

            of.Filter = "Octgn Game File (*.o8g) |*.o8g";
            var result = of.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (!File.Exists(of.FileName))
                {
                    return;
                }
                try
                {
                    GameFeedManager.Get().AddToLocalFeed(of.FileName);
                    OnPropertyChanged("Packages");
                }
                catch (UserMessageException ex)
                {
                    Log.Warn("Could not add " + of.FileName + " to local feed.", ex);
                    TopMostMessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                catch (Exception ex)
                {
                    Log.Warn("Could not add " + of.FileName + " to local feed.", ex);
                    TopMostMessageBox.Show(
                        "Could not add file " + of.FileName
                        + ". Please make sure it isn't in use and that you have access to it.",
                        "Error",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error);
                }
            }
        }
コード例 #19
0
 private void NewDeckCommand(object sender, ExecutedRoutedEventArgs e)
 {
     e.Handled = true;
     if (Game == null)
     {
         if (GameManager.Get().GameCount == 1)
         {
             Game = GameManager.Get().Games.First();
         }
         else
         {
             TopMostMessageBox.Show("You have to select a game before you can use this command.", "Error",
                                    MessageBoxButton.OK);
             return;
         }
         //if (Program.GamesRepository.Games.Count == 1)
         //    Game = Program.GamesRepository.Games[0];
         //else
         //{
         //    MessageBox.Show("You have to select a game before you can use this command.", "Error",
         //                    MessageBoxButton.OK);
         //    return;
         //}
     }
     Deck = Game.CreateDeck().AsObservable();
     //Deck = new Deck(Game);
     _deckFilename = null;
 }
コード例 #20
0
        private void SharedDeckDeleteClick(object sender, RequestNavigateEventArgs e)
        {
            try
            {
                var str = e.Uri.ToString();
                var res = TopMostMessageBox.Show(
                    "Are you sure you want to delete '" + str + "'? You can not undo this.",
                    "Are You Sure?",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Asterisk);

                if (res != MessageBoxResult.Yes)
                {
                    return;
                }
                var result = new ApiClient().DeleteSharedDeck(Prefs.Username, Program.LobbyClient.Password, str);
                if (result.Error)
                {
                    throw new UserMessageException(result.Message);
                }
                Messenger.Default.Send(new RefreshSharedDecksMessage());
            }
            catch (UserMessageException ex)
            {
                throw;
            }
            catch (Exception ex)
            {
                Log.Warn("SharedDeckDeleteClick", ex);
                throw new UserMessageException("An unknown error occurred.");
            }
        }
コード例 #21
0
ファイル: LimitedDialog.xaml.cs プロジェクト: wlk0/OCTGN
        private void StartClicked(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            if (Player.All.Any(p => p.Groups.Any(x => x.Count > 0)))
            {
                if (MessageBoxResult.Yes ==
                    TopMostMessageBox.Show(
                        "Some players have cards currently loaded.\n\nReset the game before starting limited game?",
                        "Warning", MessageBoxButton.YesNo))
                {
                    Program.Client.Rpc.ResetReq();
                }
            }
            if (addCards.Visibility == Visibility.Visible)
            {
                if (addCards.SelectedIndex == 1)
                {
                    Program.Client.Rpc.AddPacksReq(Packs.Select(p => p.Id).ToArray(), false);
                }
                else if (addCards.SelectedIndex == 0)
                {
                    Program.Client.Rpc.AddPacksReq(Packs.Select(p => p.Id).ToArray(), true);
                }
            }
            else
            {
                Program.Client.Rpc.StartLimitedReq(Packs.Select(p => p.Id).ToArray());
            }
            Close();
            // Solves an issue where Dialog isn't the active window anymore if the confirmation dialog above was shown
            //fix MAINWINDOW bug
            WindowManager.PlayWindow.Activate();
        }
コード例 #22
0
        internal static bool Elevate(string arguments = null, bool waitForExit = false)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                UseShellExecute  = true,
                WorkingDirectory = Environment.CurrentDirectory,
                FileName         = FullPath,
                Arguments        = arguments ?? string.Empty,
                Verb             = "runas"
            };


            try
            {
                Process pr = Process.Start(startInfo);
                if (waitForExit)
                {
                    if (pr == null || pr.WaitForExit(60000))
                    {
                        return(true);
                    }
                    TopMostMessageBox.Show(@"osu! took a bit too long while trying to perform an elevated operation (" + (arguments ?? @"unknown") + @").\nPlease report this.");
                    return(false);
                }
            }
            catch
            {
                return(false);
            }

            ExitImmediately();
            return(true);
        }
コード例 #23
0
ファイル: Diagnostics.xaml.cs プロジェクト: traemyn/OCTGN
 private void SavePreviousLog(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!File.Exists(Config.Instance.Paths.CurrentLogPath))
         {
             TopMostMessageBox.Show(
                 "Log file doesn't exist at " + Config.Instance.Paths.PreviousLogPath,
                 "Error",
                 MessageBoxButton.OK,
                 MessageBoxImage.Error);
             return;
         }
         var sfd = new SaveFileDialog();
         sfd.Title            = "Save Log File To...";
         sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
         sfd.FileName         = "prevlog.txt";
         sfd.OverwritePrompt  = true;
         if ((sfd.ShowDialog() ?? false))
         {
             var str = File.ReadAllText(Config.Instance.Paths.PreviousLogPath);
             File.WriteAllText(sfd.FileName, str);
         }
     }
     catch (Exception ex)
     {
         TopMostMessageBox.Show(
             "Error " + ex.Message,
             "Error",
             MessageBoxButton.OK,
             MessageBoxImage.Error);
     }
 }
コード例 #24
0
        private void MenuOpenPreviousLogClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!File.Exists(Config.Instance.Paths.PreviousLogPath))
                {
                    TopMostMessageBox.Show(
                        "Log file doesn't exist at " + Config.Instance.Paths.PreviousLogPath,
                        "Error",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error);
                    return;
                }
                var process = new Process();
                process.StartInfo = new ProcessStartInfo()
                {
                    UseShellExecute = true,
                    FileName        = Config.Instance.Paths.PreviousLogPath
                };

                process.Start();
            }
            catch (Exception ex)
            {
                Log.Warn("MenuOpenPreviousLogClick Error", ex);
            }
        }
コード例 #25
0
ファイル: Program.cs プロジェクト: wlk0/OCTGN
        public static void DoCrazyException(Exception e, string action)
        {
            var res = TopMostMessageBox.Show(action + Environment.NewLine + Environment.NewLine + "Are you going to be ok?", "Oh No!",
                                             MessageBoxButton.YesNo, MessageBoxImage.Question);
//            dieinfireplz
//            if (res == MessageBoxResult.No)
//            {
//                res = TopMostMessageBox.Show(
//                    "There there...It'll all be alright..." + Environment.NewLine + Environment.NewLine +
//                    "Do you feel that we properly comforted you in this time of great sorrow?", "Comfort Dialog",
//                    MessageBoxButton.YesNo, MessageBoxImage.Question);
//                if (res == MessageBoxResult.Yes)
//                {
//                    TopMostMessageBox.Show(
//                        "Great! Maybe you could swing by my server room later and we can hug it out.",
//                        "Inappropriate Gesture Dialog", MessageBoxButton.OK, MessageBoxImage.Question);
//                    TopMostMessageBox.Show("I'll be waiting...", "Creepy Dialog Box", MessageBoxButton.OK,
//                        MessageBoxImage.Information);
//                }
//                else if (res == MessageBoxResult.No)
//                {
//                    TopMostMessageBox.Show(
//                        "Ok. We will sack the person responsible for that not so comforting message. Have a nice day!",
//                        "Repercussion Dialog", MessageBoxButton.OK, MessageBoxImage.Exclamation);
//                }
//            }
        }
コード例 #26
0
        private void MenuShareCurrentLogClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!File.Exists(Config.Instance.Paths.CurrentLogPath))
                {
                    TopMostMessageBox.Show(
                        "Log file doesn't exist at " + Config.Instance.Paths.CurrentLogPath,
                        "Error",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error);
                    return;
                }

                var res = TextUploader.Instance.UploadText(File.ReadAllText(Config.Instance.Paths.CurrentLogPath));

                Clipboard.SetText(res);

                this.LobbyChat.ChatInput.Text = res;
                TopMostMessageBox.Show(
                    "Your log file has been shared. The URL to your log file has been copied to your clipboard. You can press ctrl+v to paste it.");
            }
            catch (UserMessageException)
            {
                throw;
            }
            catch (Exception ex)
            {
                TopMostMessageBox.Show(
                    "Error " + ex.Message,
                    "Error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }
        }
コード例 #27
0
 /// <summary>
 /// The set state online.
 /// </summary>
 private void SetStateOnline()
 {
     Dispatcher.BeginInvoke(
         new Action(
             () =>
     {
         this.MatchmakingTab.IsEnabled = true;
         TabCommunityChat.IsEnabled    = true;
         ProfileTab.IsEnabled          = true;
         ProfileTabContent.Load(Program.LobbyClient.Me);
         var subbed = SubscriptionModule.Get().IsSubscribed;
         if (subbed == null || subbed == false)
         {
             menuSub.Visibility = Visibility.Visible;
         }
         else
         {
             menuSub.Visibility = Visibility.Collapsed;
         }
         if (Program.LobbyClient.Me.UserName.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);
         }
     }));
 }
コード例 #28
0
ファイル: Connect.cs プロジェクト: marwamhna/CxViewerAction
        /// <summary>
        ///     Initialize Project and Solution menu.
        /// </summary>
        private void InitMenu()
        {
            try
            {
                ExecuteCommandHandler output;

                if (!Dispatcher.CommandExecutors.TryGetValue(typeof(LoginData), out output))
                {
                    Dispatcher.CommandExecutors.Add(typeof(LoginData), CommandExecutor.Login);
                }

                if (!Dispatcher.CommandExecutors.TryGetValue(typeof(Upload), out output))
                {
                    Dispatcher.CommandExecutors.Add(typeof(Upload), CommandExecutor.Upload);
                }

                if (!Dispatcher.CommandExecutors.TryGetValue(typeof(Scan), out output))
                {
                    Dispatcher.CommandExecutors.Add(typeof(Scan), CommandExecutor.Scan);
                }

                if (!Dispatcher.CommandExecutors.TryGetValue(typeof(BindProjectEntity), out output))
                {
                    Dispatcher.CommandExecutors.Add(typeof(BindProjectEntity), CommandExecutor.BindProject);
                }
            }
            catch (Exception ex)
            {
                Logger.Create().Error(ex.ToString());
                TopMostMessageBox.Show(ex.Message);
            }
        }
コード例 #29
0
ファイル: Main.xaml.cs プロジェクト: rerbes/OCTGN
 private void MenuSaveAsCurrentLogClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!File.Exists(Paths.Get().CurrentLogPath))
         {
             TopMostMessageBox.Show(
                 "Log file doesn't exist at " + Paths.Get().CurrentLogPath,
                 "Error",
                 MessageBoxButton.OK,
                 MessageBoxImage.Error);
             return;
         }
         var sfd = new SaveFileDialog();
         sfd.Title            = "Save Log File To...";
         sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
         sfd.FileName         = "currentlog.txt";
         sfd.OverwritePrompt  = true;
         if ((sfd.ShowDialog() ?? false))
         {
             File.Copy(Paths.Get().CurrentLogPath, sfd.FileName, true);
             //var str = File.ReadAllText(Paths.Get().CurrentLogPath);
             //File.WriteAllText(sfd.FileName, str);
         }
     }
     catch (Exception ex)
     {
         TopMostMessageBox.Show(
             "Error " + ex.Message,
             "Error",
             MessageBoxButton.OK,
             MessageBoxImage.Error);
     }
 }
コード例 #30
0
 private void DeleteDeckClick(object sender, RoutedEventArgs e)
 {
     TopMostMessageBox.Show(
         "This has not yet been implemented",
         "Patience Dialog",
         MessageBoxButton.OK,
         MessageBoxImage.Stop);
 }