示例#1
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame is null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content is null)
                {
                    // FileUtil
                    await FileUtil.DeleteAllInTemporaryFolder();

                    // Projects
                    foreach (StorageFolder zipFolder in await FileUtil.FIndAllZipFolders())
                    {
                        // [StorageFolder] --> [projectViewItem]
                        IProjectViewItem item = await FileUtil.ConstructProjectViewItem(zipFolder);

                        App.Projects.Add(item);
                    }

                    // Setting
                    Setting setting = await XML.ConstructSettingFile();

                    App.SettingViewModel.ConstructSetting(setting);

                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }
                    // Ensure the current window is active
                    Window.Current.Activate();
                }
            }
        }
示例#2
0
        //Setting
        private async Task ConstructSetting()
        {
            //Setting
            Setting setting = await XML.ConstructSettingFile();

            if (setting != null)
            {
                this.SettingViewModel.Setting = setting;
            }

            //Theme
            this.SettingViewModel.ConstructTheme();

            //DeviceLayout
            this.SettingViewModel.ConstructDeviceLayout();

            //DeviceLayout
            this.SettingViewModel.ConstructLayersHeight();

            //MenuType
            this.SettingViewModel.ConstructMenuType(this.TipViewModel.Menus);

            //Key
            this.SettingViewModel.ConstructKey();
            if (this.SettingViewModel.Move == null)
            {
                this.SettingViewModel.Move += (moveMode) =>
                {
                    switch (moveMode)
                    {
                    case MoveMode.None: return;

                    case MoveMode.Left: this.ViewModel.CanvasTransformer.Position += new Vector2(50, 0); break;

                    case MoveMode.Up: this.ViewModel.CanvasTransformer.Position += new Vector2(0, 50); break;

                    case MoveMode.Right: this.ViewModel.CanvasTransformer.Position -= new Vector2(50, 0); break;

                    case MoveMode.Down: this.ViewModel.CanvasTransformer.Position -= new Vector2(0, 50); break;
                    }
                    this.ViewModel.CanvasTransformer.ReloadMatrix();
                    this.ViewModel.Invalidate();//Invalidate
                };
            }
            if (this.SettingViewModel.Edit == null)
            {
                this.SettingViewModel.Edit += (editMode) =>
                {
                    switch (editMode)
                    {
                    case EditMode.None: return;

                    case EditMode.Cut: this.MethodViewModel.MethodEditCut(); break;

                    case EditMode.Duplicate: this.MethodViewModel.MethodEditDuplicate(); break;

                    case EditMode.Copy: this.MethodViewModel.MethodEditCopy(); break;

                    case EditMode.Paste: this.MethodViewModel.MethodEditPaste(); break;

                    case EditMode.Clear: this.MethodViewModel.MethodEditClear(); break;

                    case EditMode.All: this.MethodViewModel.MethodSelectAll(); break;

                    case EditMode.Deselect: this.MethodViewModel.MethodSelectDeselect(); break;

                    case EditMode.Invert: this.MethodViewModel.MethodSelectInvert(); break;

                    case EditMode.Group: this.MethodViewModel.MethodGroupGroup(); break;

                    case EditMode.UnGroup: this.MethodViewModel.MethodGroupUnGroup(); break;

                    case EditMode.Release: this.MethodViewModel.MethodGroupRelease(); break;

                    case EditMode.Undo: this.MethodViewModel.MethodEditUndo(); break;
                    }
                };
            }
        }