Пример #1
0
        private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;
            //TitleBar.Height = coreTitleBar.Height;
            Window.Current.SetTitleBar(MainTitleBar);
            coreTitleBar.LayoutMetricsChanged += CoreTitleBar_LayoutMetricsChanged;
            ProgramMenu.Closed += ProgramMenuOnClosed;

            var view = ApplicationView.GetForCurrentView();

            view.TitleBar.ButtonBackgroundColor = Colors.Transparent;

            var showWelcome = StorageHelper.GetSetting("show-welcome", true);

            if (showWelcome)
            {
                var val = await WelcomeDialog.ShowAsync();

                if (dontShowCb.IsChecked ?? false)
                {
                    StorageHelper.StoreSetting("show-welcome", false, true);
                }
            }
            CustomInput.Focus(FocusState.Programmatic);
        }
Пример #2
0
        /// <summary>
        /// Initializes the Properties.Settings .NET applications settings.
        /// Used for all settings that we want to persist, even if the user decides to delete the
        /// json settings file or starts AML from different folders.
        /// </summary>
        private static void InitAppSettings()
        {
            var appSettings    = Properties.Settings.Default;
            var currentVersion = GetCurrentVersion().ToString(3);

            // Upgrade settings from previous version if required
            if (appSettings.IsSettingsUpgradeRequired)
            {
                Log.Info($"Upgrading ApplicationSettings from version '{appSettings.Version}' to '{currentVersion}'.");
                appSettings.Upgrade();
                appSettings.IsSettingsUpgradeRequired = false;

                // Show Welcome Dialog and ask user to opt-in for Sentry error reporting
                WelcomeDialog dlg = new WelcomeDialog();
                dlg.ShowDialog();

                appSettings.IsSentryEnabled = dlg.UseSentry;
            }

            // Initialize GUID (used for error reporting)
            if (string.IsNullOrEmpty(appSettings.Guid))
            {
                appSettings.Guid = Guid.NewGuid().ToString();
            }

            // Version information can be used to perform version specific migrations if required.
            if (appSettings.Version != currentVersion)
            {
                // IF required at some point
                appSettings.Version = currentVersion;
            }

            appSettings.Save();
        }
Пример #3
0
 protected override void Run()
 {
     if (!PropertyService.HasValue(Constants.Properties.HasDisplayedWelcomeKey))
     {
         var dialog = new WelcomeDialog();
         dialog.Show();
     }
 }
Пример #4
0
        public MainForm(string[] args)
        {
            pluginsModels         = new List <PluginModel>();
            pluginControlStatuses = new List <PluginControlStatus>();

            // Set drawing optimizations
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // Displaying Welcome screen
            var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            blackScreen = new WelcomeDialog(version)
            {
                StartPosition = FormStartPosition.CenterScreen
            };
            blackScreen.Show(this);
            blackScreen.SetWorkingMessage("Loading...");

            // Loading XrmToolBox options
            string errorMessage;

            if (!Options.Load(out currentOptions, out errorMessage))
            {
                MessageBox.Show(this,
                                "An error ocurred when loading XrmToolBox options. A new options file has been created.\n\n" +
                                errorMessage);
            }
            if (currentOptions.RememberSession)
            {
                if (!string.IsNullOrEmpty(currentOptions.LastConnection))
                {
                    initialConnectionName = currentOptions.LastConnection;
                }
                if (!string.IsNullOrEmpty(currentOptions.LastPlugin))
                {
                    initialPluginName = currentOptions.LastPlugin;
                }
            }
            // Read arguments to detect if a plugin should be displayed automatically
            if (args.Length > 0)
            {
                initialConnectionName = ExtractSwitchValue("/connection:", ref args);
                initialPluginName     = ExtractSwitchValue("/plugin:", ref args);
            }

            InitializeComponent();

            ProcessMenuItemsForPlugin();
            MouseWheel += (sender, e) => pnlPlugins.Focus();

            Text = string.Format("{0} (v{1})", Text, Assembly.GetExecutingAssembly().GetName().Version);

            // Loading connection controls
            blackScreen.SetWorkingMessage("Loading connection controls...");
            ManageConnectionControl();
            ccsb.MergeConnectionsFiles = currentOptions.MergeConnectionFiles;
        }
Пример #5
0
        public void CreateNewModel()
        {
            WelcomeDialog.ClickButton("CreateNewButton");
            Wait.UntilResponsive(WelcomeDialog.Window);
            Wait.UntilResponsive(MainWindow.Window);

            Assert.IsFalse(WelcomeDialog.IsEnabled);
            Assert.AreEqual(0, MainWindow.Document.GetBodyItems().Count());
        }
Пример #6
0
        private void tsmiAbout_Click(object sender, System.EventArgs e)
        {
            var aForm = new WelcomeDialog(false)
            {
                StartPosition = FormStartPosition.CenterParent
            };

            aForm.ShowDialog(this);
        }
Пример #7
0
        private void aboutXrmToolBoxToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            var aForm   = new WelcomeDialog(version, false)
            {
                StartPosition = FormStartPosition.CenterParent
            };

            aForm.ShowDialog(this);
        }
Пример #8
0
        private void ShowWelcome()
        {
            WelcomeDialog dlg = new WelcomeDialog();

            dlg.Owner = MainWindow.Window;
            dlg.HorizontalAlignment  = System.Windows.HorizontalAlignment.Center;
            dlg.VerticalAlignment    = System.Windows.VerticalAlignment.Center;
            dlg.ShowWelcomeOnStartup = ViewModel.ShowWelcomeOnStartup;
            dlg.ShowDialog();
            ViewModel.ShowWelcomeOnStartup = dlg.ShowWelcomeOnStartup;
        }
Пример #9
0
 private Task LaunchWelcomeDialog()
 {
     return(new Task(() => this.Invoke(new Action(() =>
     {
         var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
         var blackScreen = new WelcomeDialog(version)
         {
             StartPosition = FormStartPosition.CenterScreen
         };
         blackScreen.ShowDialog(this);
     }))));
 }
Пример #10
0
        public void OpenSampleModel()
        {
            WelcomeDialog.ClickButton("OpenSampleButton");
            string path = "WoodpeckerCase.model";

            FileDialogAdaptor.DoLoadModel(WelcomeDialog, path);

            Wait.UntilResponsive(WelcomeDialog.Window);
            Wait.UntilResponsive(MainWindow.Window);

            Assert.IsFalse(WelcomeDialog.IsEnabled);
            Assert.Greater(MainWindow.Document.GetBodyItems().Count(), 0);
        }
        public CommandResult ShowWelcomeDialog()
        {
            WelcomeDialog dlg = new WelcomeDialog();
            DialogResult  r   = GCUtil.ShowModalDialog(_frame, dlg);

            if (r == DialogResult.OK)
            {
                if (dlg.CID != CID.NOP)
                {
                    GApp.GlobalCommandTarget.Exec(dlg.CID);
                }
            }
            return(CommandResult.Success);
        }
Пример #12
0
        /// <summary>
        /// Initializes GlobalSettings class.
        /// Used for all settings that we want to persist, even if the user decides to delete the
        /// json settings file or starts AML from different folders.
        /// </summary>
        private static void InitAppSettings()
        {
            var appSettings    = GlobalSettings.Instance;
            var currentVersion = GetCurrentVersion();

            if (appSettings.MaxVersion < currentVersion)
            {
                Log.Info($"AML was upgraded from '{appSettings.MaxVersion}' to '{currentVersion}'.");

                // Show Welcome Dialog and ask user to opt-in for Sentry error reporting.
                WelcomeDialog dlg = new WelcomeDialog();
                dlg.ShowDialog();
                appSettings.IsSentryEnabled = dlg.UseSentry;

                appSettings.MaxVersion = currentVersion;
            }

            appSettings.Save();
        }
Пример #13
0
        public void OpenExistingModel()
        {
            WelcomeDialog.ClickButton("OpenExistingButton");
            var fileDlg = new FileDialogAdaptor(WelcomeDialog);

            Assert.AreEqual("Open Model...", fileDlg.Title);
            fileDlg.ClickButton(FileDialogAdaptor.Button.Cancel);
            Assert.IsTrue(WelcomeDialog.IsEnabled);

            WelcomeDialog.ClickButton("OpenExistingButton");
            string path = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Data\UITests\SourceData\Cylinder.model"));

            FileDialogAdaptor.DoLoadModel(WelcomeDialog, path);

            Wait.UntilResponsive(WelcomeDialog.Window);
            Wait.UntilResponsive(MainWindow.Window);

            Assert.IsFalse(WelcomeDialog.IsEnabled);
            Assert.Greater(MainWindow.Document.GetBodyItems().Count(), 0);
        }
Пример #14
0
        /// <summary>
        /// Initializes GlobalSettings class.
        /// Used for all settings that we want to persist, even if the user decides to delete the
        /// json settings file or starts AML from different folders.
        /// </summary>
        private static void InitAppSettings()
        {
            var appSettings    = GlobalSettings.Instance;
            var currentVersion = new Version(GitVersionInfo.MajorMinorPatch);

            if (appSettings.MaxVersion < currentVersion)
            {
                appSettings.MaxVersion = currentVersion;
            }

            // AML will either be used for XCOM2 or Chimera Squad
            // Create Steam application id file if it does not exist (depending on game choice of the user)
            if (!File.Exists(Workshop.APPID_FILENAME))
            {
                // Show Welcome Dialog and ask user to opt-in for Sentry error reporting.
                WelcomeDialog dlg = new WelcomeDialog();
                dlg.ShowDialog();
                appSettings.IsSentryEnabled = dlg.UseSentry;

                try
                {
                    using (var file = File.CreateText(Workshop.APPID_FILENAME))
                    {
                        file.WriteLine((uint)dlg.Game);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Unable to create {Workshop.APPID_FILENAME}. {Environment.NewLine} {ex.Message} ");
                    return;
                }
            }

            // Use Steam Application id file to determine which game this AML installation is used for.
            string appIdStr;

            try
            {
                appIdStr = File.ReadAllText(Workshop.APPID_FILENAME);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Unable to access {Workshop.APPID_FILENAME}. {Environment.NewLine} {ex.Message} ");
                return;
            }

            if (uint.TryParse(appIdStr, out uint appId))
            {
                switch ((GameId)appId)
                {
                case GameId.X2:
                    XEnv = new Xcom2Env();
                    break;

                case GameId.ChimeraSquad:
                    XEnv = new XComChimeraSquadEnv();
                    break;

                default:
                    MessageBox.Show($"The {Workshop.APPID_FILENAME} file contains an unexpected application id: {appId}.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }


            appSettings.Save();
        }
		void window_Loaded(object sender, RoutedEventArgs e)
		{
			var project = MainMenu.AddContainer("Project");
			project.AddAction("New", NewMission);
			project.AddAction("Open", LoadMission);
			project.AddAction("Save", QuickSave);
			project.AddAction("Save As", SaveMission);

            var welcomeScreen = new WelcomeDialog { ShowInTaskbar = true, Owner = this };
            welcomeScreen.ShowDialog();
            if (Mission == null)
            {
                MessageBox.Show("A mission needs to be selected");
                Environment.Exit(0);
            }

            var mission = MainMenu.AddContainer("Mission");
            mission.AddAction("Create Mutator", () => BuildMission());
            mission.AddAction("Create Invisible Mutator", () => BuildMission(true));
            mission.AddAction("Test Mission", TestMission);
            mission.AddAction("Export Localization File", ExportLocalizationFile);
            mission.AddAction("Publish", ShowMissionManagement);
            mission.AddAction("Settings", ShowMissionSettings);

            var newMenu = MainMenu.AddContainer("New");
            newMenu.AddAction("New Trigger", CreateNewTrigger);
            newMenu.AddAction("New Trigger (Repeating)", CreateNewRepeatingTrigger);
            newMenu.AddAction("New Region", CreateNewRegion);
            newMenu.AddAction("Copy Trigger", () => Mission.CopyTrigger(CurrentTrigger));
            newMenu.Items.Add(GetNewConditionMenu(delegate
            {
                if (logicGrid.SelectedItem is Trigger) return CurrentTrigger;
                if (logicGrid.SelectedItem is ActionsFolder) return CurrentActionsFolder.Trigger;
                if (logicGrid.SelectedItem is ConditionsFolder) return CurrentConditionsFolder.Trigger;
                if (logicGrid.SelectedItem is TriggerLogic) return Mission.FindLogicOwner(CurrentLogic);
                return null;
            }));
            newMenu.Items.Add(GetNewActionMenu(() => CurrentTrigger));

            var editMenu = MainMenu.AddContainer("Edit");
            editMenu.AddAction("Rename", RenameCurrentItem);
            editMenu.AddAction("Delete", DeleteCurrentItem);
            editMenu.AddAction("Move Up", () => MoveCurrentItem(MoveDirection.Up));
            editMenu.AddAction("Move Up 5 Spaces", () => MoveCurrentItem(MoveDirection.Up, 5));
            editMenu.AddAction("Move To Top", () => MoveCurrentItem(MoveDirection.Up, true));
            editMenu.AddAction("Move Down", () => MoveCurrentItem(MoveDirection.Down));
            editMenu.AddAction("Move Down 5 Spaces", () => MoveCurrentItem(MoveDirection.Down, 5));
            editMenu.AddAction("Move To Bottom", () => MoveCurrentItem(MoveDirection.Down, true));
            editMenu.AddAction("Expand All Triggers", ExpandAllTriggers);
            editMenu.AddAction("Collapse All Triggers", CollapseAllTriggers);

			var menu = new ContextMenu();
			menu.AddAction("New Trigger", CreateNewTrigger);
			menu.AddAction("New Trigger (Repeating)", CreateNewRepeatingTrigger);
			menu.AddAction("New Region", CreateNewRegion);
			logicGrid.ContextMenu = menu;

            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fileVersionInfo.FileVersion;
            var aboutString = String.Format("Mission Editor {0}\n\nby Quantum and KingRaptor\n\nFor help with the program, visit {1}", version, GlobalConst.BaseSiteUrl + "/Wiki/MissionEditorStartPage");
            var help = MainMenu.AddContainer("Help");
            help.AddAction("About", () => MessageBox.Show(aboutString, "About Mission Editor", MessageBoxButton.OK, MessageBoxImage.Information));

            autosaveTimer.Start();
		}
Пример #16
0
        void IMainViewAccess.DisplayWelcomeDialog()
        {
            var welcomeDialog = new WelcomeDialog(this, LayoutInflater, viewModel, FragmentManager);

            welcomeDialog.Show();
        }
Пример #17
0
        private void glControl1_Load(object sender, EventArgs e)
        {
            OpenGLConnection = new OpenGLConnection();
            try
            {
                splashForm.Hide();
                splashForm.Show();
                splashForm.TopMost = true;
                OpenGLConnection.OnLoad(glControl1, Form1.debugLogger);
                InitGUI();
                var slicer_connection = (SlicerConnectionBase) new M3D.Slicer.Cura15_04.SlicerConnectionCura(Paths.WorkingFolder, Paths.ResourceFolder);
                model_loading_manager = new ModelLoadingManager();
                spooler_connection    = new SpoolerConnection(messagebox, informationbox, settingsManager);
                SoftwareUpdater       = new Updater(this, messagebox, spooler_connection, settingsManager);
                controlbar            = new ControlBar(this, m_gui_host, settingsManager, messagebox, informationbox, spooler_connection, model_loading_manager, SoftwareUpdater);
                var frame = new Frame(24680);
                frame.SetPosition(0, 0);
                frame.RelativeWidth  = 1f;
                frame.RelativeHeight = 1f;
                frame.BGColor        = new Color4(0.913725f, 0.905882f, 0.9098f, 1f);
                m_gui_host.AddElement(frame);
                libraryview = new LibraryView(10001, frame, glControl1, m_gui_host, informationbox, model_loading_manager);
                m_gui_host.SetFocus(1001);
                m_gui_host.Refresh();
                Form1.debugLogger.Add("glControl1_Load()", "LibraryView created.", DebugLogger.LogType.Secondary);
                printerView = new PrinterView(this, m_gui_host, OpenGLConnection, spooler_connection, slicer_connection, model_loading_manager, messagebox, informationbox, settingsManager, libraryview);
                printerView.SetViewPointPos(0.0f, 100f, 400f);
                Form1.debugLogger.Add("glControl1_Load()", "GLPrinterView created.", DebugLogger.LogType.Secondary);
                frame.AddChildElement(printerView);
                frame.AddChildElement(libraryview);
                Form1.debugLogger.Add("glControl1_Load()", "Views added to background view.", DebugLogger.LogType.Secondary);
                model_loading_manager.Init(settingsManager, libraryview, printerView, messagebox, informationbox);
                Form1.debugLogger.Add("glControl1_Load()", "Model Loading Manager Initialized.", DebugLogger.LogType.Secondary);
                printer_status_dialog_organizer = new PrinterStatusDialogOrganizer(spooler_connection, model_loading_manager, settingsManager, this, m_gui_host, printerView, messagebox);
                Form1.debugLogger.Add("glControl1_Load()", "PrinterStatusDialogOrganizer Initialized.", DebugLogger.LogType.Secondary);
                spooler_connection.SpoolerStartUp(Form1.debugLogger);
                Form1.debugLogger.Add("glControl1_Load()", "spooler_connection.SpoolerStartUp() completed.", DebugLogger.LogType.Secondary);
                controlbar.UpdateSettings();
                Form1.debugLogger.Add("glControl1_Load()", "controlbar.UpdateSettings() completed.", DebugLogger.LogType.Secondary);
                if (settingsManager.CurrentAppearanceSettings.StartFullScreen)
                {
                    WindowState = FormWindowState.Maximized;
                }
                else
                {
                    WindowState = FormWindowState.Normal;
                }

                splashForm.Close();
                Form1.debugLogger.Add("glControl1_Load()", "splash form closed.", DebugLogger.LogType.Secondary);
                glControl1.MakeCurrent();
                glControl1.VSync = false;
                Form1.debugLogger.Add("glControl1_Load()", "glcontrol sync", DebugLogger.LogType.Secondary);
                if (SplashFormFirstRun.WasRunForTheFirstTime)
                {
                    var welcomeDialog = new WelcomeDialog(1209, messagebox);
                    welcomeDialog.Init(m_gui_host);
                    m_gui_host.GlobalChildDialog += welcomeDialog;
                }
                else
                {
                    messagebox.AllowMessages = true;
                }

                Form1.debugLogger.Add("glControl1_Load()", "Welcome Initialized", DebugLogger.LogType.Secondary);
                CheckFileAssociations();
                Form1.debugLogger.Add("glControl1_Load()", "File Associations Checked", DebugLogger.LogType.Secondary);
                var num = spooler_connection.PrintSpoolerClient.IsPrinting ? 0 : (!Program.runfirst_start ? 1 : 0);
                SoftwareUpdater.CheckForUpdate(false);
                Form1.debugLogger.Add("glControl1_Load()", "Checked for updates", DebugLogger.LogType.Secondary);
            }
            catch (Exception ex)
            {
                ExceptionForm.ShowExceptionForm(ex);
            }
            if (args.Length != 0)
            {
                model_loading_manager.LoadModelIntoPrinter(args[0]);
            }

            FileAssociationSingleInstance.OnNewInstance += new NewInstanceEvent(OnNewInstanceEvent);
        }