Exemple #1
0
        private void LoadSettings()
        {
            //LINE NUMBERS
            if (AppSettings.Values.ContainsKey("editor_linenumbers"))
            {
                if ((bool)AppSettings.Values["editor_linenumbers"])
                {
                    ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ lineNumbers: true });");
                }
                else
                {
                    ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ lineNumbers: false });");
                }
            }

            //WRAPPING CODE
            if (AppSettings.Values.ContainsKey("editor_wordwrap"))
            {
                if ((bool)AppSettings.Values["editor_wordwrap"])
                {
                    ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ wordWrap: 'wordWrapColumn', wordWrapMinified: true });");
                }
                else
                {
                    ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ wordWrap: 'none', wordWrapMinified: false });");
                }
            }
        }
Exemple #2
0
        private async void SetMonacoTheme()
        {
            if (EditorIsLoaded)
            {
                var MonacoTheme = ModulesAccessManager.GetModuleViaID(ModulesAccessManager.GetCurrentThemeMonacoID());
                ContentViewer.SendAndExecuteJavaScript(await new ThemeReader(ModulesAccessManager.GetCurrentThemeMonacoID()).GetThemeJSContentAsync());
                ContentViewer.SendAndExecuteJavaScript("monaco.editor.setTheme('" + MonacoTheme.ModuleMonacoThemeName + "');");

                //Debug.WriteLine(MonacoTheme.ModuleMonacoThemeName);
            }
        }
Exemple #3
0
        private void LoadSettings()
        {
            //LINE NUMBERS
            if (AppSettings.Values.ContainsKey("editor_linenumbers"))
            {
                ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ lineNumbers: " + ((bool)AppSettings.Values["editor_linenumbers"]).ToString().ToLower() + "});");
            }

            //QUICK SUGGESTIONS
            if (AppSettings.Values.ContainsKey("editor_quicksuggestions"))
            {
                ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ quickSuggestions: " + ((bool)AppSettings.Values["editor_quicksuggestions"]).ToString().ToLower() + "});");
            }

            //WRAPPING CODE
            if (AppSettings.Values.ContainsKey("editor_wordwrap"))
            {
                ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ wordWrap: " + ((bool)AppSettings.Values["editor_wordwrap"]).ToString().ToLower() + "});");
            }

            //MINIMAP
            if (AppSettings.Values.ContainsKey("editor_minimap"))
            {
                ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ minimap: { enabled: " + ((bool)AppSettings.Values["editor_minimap"]).ToString().ToLower() + "} });");
            }

            //FONT FAMILY
            if (AppSettings.Values.ContainsKey("editor_fontfamily"))
            {
                ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ fontFamily: '" + (string)AppSettings.Values["editor_fontfamily"] + "' });");
            }

            //FONT SIZE
            if (AppSettings.Values.ContainsKey("editor_fontsize"))
            {
                ContentViewer.SendAndExecuteJavaScript("editor.updateOptions({ fontSize: " + (int)AppSettings.Values["editor_fontsize"] + " });");
            }
        }
Exemple #4
0
        /* =============
         * = FUNCTIONS =
         * =============
         */



        private void SetMessenger()
        {
            Messenger.Default.Register <TabSelectedNotification>(this, async(notification) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    try
                    {
                        switch (notification.contactType)
                        {
                        case ContactTypeSCEE.SetCodeForEditor:
                            Queue_Tabs.Add(notification);
                            ManageQueueTabs();

                            if (GlobalVariables.CurrentDevice == SCEELibs.Editor.CurrentDevice.Desktop)
                            {
                                SetTilebarText(notification.tabName);
                            }
                            break;

                        case ContactTypeSCEE.SetCodeForEditorWithoutUpdate:
                            ContentViewer.MonacoModelID = notification.monacoModelID; ContentViewer.CodeLanguage = notification.typeCode; ContentViewer.Code = notification.code;

                            if (GlobalVariables.CurrentDevice == SCEELibs.Editor.CurrentDevice.Desktop)
                            {
                                SetTilebarText(notification.tabName);
                            }
                            break;

                        case ContactTypeSCEE.ReloadLanguage:
                            if (GlobalVariables.CurrentIDs.ID_Tab == notification.tabID && GlobalVariables.CurrentIDs.ID_TabsList == notification.tabsListID)
                            {
                                ContentViewer.CodeLanguage = notification.typeLanguage;
                                ContentViewer.ForceUpdateLanguage();
                            }
                            break;
                        }
                    }
                    catch { }
                });
            });

            Messenger.Default.Register <EditorViewNotification>(this, async(notification_ui) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    try
                    {
                        SetTheme();
                        SetMonacoTheme();
                    }
                    catch { }
                });
            });

            Messenger.Default.Register <BonjourViewControl>(this, async(notification_bjrview) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    try
                    {
                        PopupGrid.Visibility     = Visibility.Collapsed;
                        FrameBonjourView.Content = null;
                    }
                    catch { }
                });
            });

            Messenger.Default.Register <SheetViewerNotification>(this, async(notification_ui) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    try
                    {
                        switch (notification_ui)
                        {
                        case SheetViewerNotification.DeployViewer:
                            UpdateUI(true, false);
                            break;

                        case SheetViewerNotification.MinimizeViewer:
                            UpdateUI(false, false);
                            break;

                        case SheetViewerNotification.DisableAutoDeployer:
                            AutoDeployerEnabled = false;
                            break;

                        case SheetViewerNotification.EnableAutoDeployer:
                            AutoDeployerEnabled = true;
                            break;

                        case SheetViewerNotification.PinViewer:
                            SheetViewerPinned          = true;
                            SheetViewSplit.DisplayMode = SplitViewDisplayMode.Inline;
                            SheetsManager.Visibility   = Visibility.Collapsed;

                            ContentViewerGrid.Margin = new Thickness(SheetViewSplit.OpenPaneLength, BackgroundPrincipalUIControl.ActualHeight, 0, 0);
                            break;

                        case SheetViewerNotification.UnpinViewer:
                            SheetViewerPinned = false;

                            if (AppSettings.Values.ContainsKey("ui_leftpanelength"))
                            {
                                ContentViewerGrid.Margin = new Thickness((int)AppSettings.Values["ui_leftpanelength"], BackgroundPrincipalUIControl.ActualHeight, 0, 0);
                            }
                            else
                            {
                                ContentViewerGrid.Margin = new Thickness(60, BackgroundPrincipalUIControl.ActualHeight, 0, 0);
                            }

                            UpdateUI(true, true);
                            break;
                        }
                    }
                    catch { }
                });
            });

            Messenger.Default.Register <SettingsNotification>(this, async(notification_settings) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    try
                    {
                        if (notification_settings.SettingsUpdatedName == DefaultSettings.DefaultSettingsMenuList[0].Name && EditorIsLoaded) //If settings updated for Editor, then...
                        {
                            LoadSettings();
                        }
                        else if (notification_settings.SettingsUpdatedName == DefaultSettings.DefaultSettingsMenuList[1].Name)
                        {
                            SetInterface();
                        }
                    }
                    catch { }
                });
            });

            Messenger.Default.Register <SCEENotification>(this, async(notification_scee) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(async() =>
                {
                    try
                    {
                        switch (notification_scee.type)
                        {
                        case SCEENotifType.Injection:
                            ContentViewer.SendAndExecuteJavaScript((string)notification_scee.content);
                            break;

                        case SCEENotifType.SaveCurrentTab when !notification_scee.answerNotification:
                            string content = await ContentViewer.GetCode();
                            await TabsWriteManager.PushTabContentViaIDAsync(GlobalVariables.CurrentIDs, content, false);
                            Messenger.Default.Send(new SCEENotification {
                                type = SCEENotifType.SaveCurrentTab, answerNotification = true
                            });
                            ChangePushed = false;
                            break;

                        case SCEENotifType.InjectionAndReturn when !notification_scee.answerNotification:
                            Messenger.Default.Send(new SCEENotification {
                                type = SCEENotifType.InjectionAndReturn, answerNotification = true, content = await ContentViewer.SendAndExecuteJavaScriptWithReturn((string)notification_scee.content)
                            });
                            break;
                        }
                    }
                    catch { }
                });
            });
        }
Exemple #5
0
        /* =============
         * = FUNCTIONS =
         * =============
         */



        private void SetMessenger()
        {
            Messenger.Default.Register <TabSelectedNotification>(this, async(notification) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    try
                    {
                        switch (notification.contactType)
                        {
                        case ContactTypeSCEE.SetCodeForEditor:
                            Queue_Tabs.Add(notification);
                            ManageQueueTabs();
                            break;

                        case ContactTypeSCEE.SetCodeForEditorWithoutUpdate:
                            ContentViewer.CodeLanguage = notification.typeCode; ContentViewer.Code = notification.code;
                            break;
                        }
                    }
                    catch { }
                });
            });

            Messenger.Default.Register <EditorViewNotification>(this, async(notification_ui) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    try
                    {
                        SetTheme();
                        SetMonacoTheme();
                    }
                    catch { }
                });
            });

            Messenger.Default.Register <SettingsNotification>(this, async(notification_settings) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    try
                    {
                        if (notification_settings.SettingsUpdatedName == DefaultSettings.DefaultSettingsMenuList[0].Name && EditorIsLoaded) //If settings updated for Editor, then...
                        {
                            LoadSettings();
                        }
                        else if (notification_settings.SettingsUpdatedName == DefaultSettings.DefaultSettingsMenuList[1].Name)
                        {
                            SetInterface();
                        }
                    }
                    catch { }
                });
            });

            Messenger.Default.Register <SCEENotification>(this, async(notification_scee) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(async() =>
                {
                    try
                    {
                        switch (notification_scee.type)
                        {
                        case SCEENotifType.Injection:
                            ContentViewer.SendAndExecuteJavaScript((string)notification_scee.content);
                            break;

                        case SCEENotifType.SaveCurrentTab when !notification_scee.answerNotification:
                            string content = await ContentViewer.GetCode();
                            await TabsWriteManager.PushTabContentViaIDAsync(GlobalVariables.CurrentIDs, content, false);
                            Messenger.Default.Send(new SCEENotification {
                                type = SCEENotifType.SaveCurrentTab, answerNotification = true
                            });
                            break;

                        case SCEENotifType.InjectionAndReturn when !notification_scee.answerNotification:
                            Messenger.Default.Send(new SCEENotification {
                                type = SCEENotifType.InjectionAndReturn, answerNotification = true, content = await ContentViewer.SendAndExecuteJavaScriptWithReturn((string)notification_scee.content)
                            });
                            break;
                        }
                    }
                    catch { }
                });
            });
        }