Esempio n. 1
0
        private void OnNewTabAcceptButtonPressed(string tabName)
        {
            UIUtils.ShutDownWindow(ref _windowAddTab);

            GamesConfigLoader gamesConfigLoader = MainApp.GetInstance().GetConfig().GetGameConfig();
            GameConfigDB      newGameConfig     = gamesConfigLoader.AddNewGameConfig(tabName);

            CreateNewTab(newGameConfig);
        }
Esempio n. 2
0
        private void OnDeleteTabAccept(UITabPage tabPage)
        {
            int pages = notebook1.NPages;

            for (int i = 0; i < pages; ++i)
            {
                Widget    currentPage    = notebook1.GetNthPage(i);
                UITabPage currentTabPage = Utils.static_cast <UITabPage>(currentPage.Data["UITabPage"]);
                if (currentTabPage == tabPage)
                {
                    notebook1.RemovePage(i);
                    if (i > 0)
                    {
                        notebook1.Page = i - 1;
                    }

                    GamesConfigLoader gamesConfigLoader = MainApp.GetInstance().GetConfig().GetGameConfig();
                    gamesConfigLoader.DeleteGameConfig(currentTabPage.GetGameConfig());
                    return;
                }
            }
        }
Esempio n. 3
0
        protected void OnExportCommandsButtonPress(object sender, EventArgs e)
        {
            Gtk.FileChooserDialog fileChooser = new Gtk.FileChooserDialog
                                                    ("Choose files"
                                                    , this
                                                    , FileChooserAction.SelectFolder
                                                    , "Select"
                                                    , ResponseType.Accept
                                                    , "Cancel"
                                                    , ResponseType.Close);
            int response = fileChooser.Run();

            if (response == Utils.static_cast <int>(ResponseType.Close))
            {
                UIUtils.ShutDownWindow(ref fileChooser);
            }
            else if (response == Utils.static_cast <int>(ResponseType.Accept))
            {
                string fullPath = fileChooser.Filename + "/exported_commands.xml";
                UIUtils.ShutDownWindow(ref fileChooser);
                UITabPage currentTabPage = GetCurrentTabPage();
                currentTabPage.GetGameConfig();

                GamesConfigLoader   gamesLoader         = MainApp.GetInstance().GetConfig().GetGameConfig();
                FileOperationResult fileOperationResult = gamesLoader.Export(fullPath, currentTabPage.GetGameConfig());

                if (!fileOperationResult.IsSuccess())
                {
                    UIUtils.ShutDownWindowSafe(ref _windowPrompt);
                    _windowPrompt = new WindowPrompt(fileOperationResult.GetResult());
                    _windowPrompt.OnAcceptEvent += OnAlertAccept;
                    _windowPrompt.SetCancelVisible(false);
                    _windowPrompt.Show();
                    MainApp.GetInstance().MoveWindowToMousePos(_windowPrompt);
                }
            }
        }
Esempio n. 4
0
 public Config()
 {
     _applicationConfigLoader = new ApplicationConfigLoader();
     _gamesLoader             = new GamesConfigLoader();
 }