/* ============= * = FUNCTIONS = * ============= */ public void LoadPage(string path, int id) { if (!isLoaded) { html_view = new WebView(WebViewExecutionMode.SeparateThread); html_view.NavigationStarting += Html_view_NavigationStarting; html_view.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Visible); MasterGrid.Children.Insert(0, html_view); isLoaded = true; } if (!string.IsNullOrEmpty(path)) { current_id = id; InfosModule ModuleAccess = ModulesAccessManager.GetModuleViaID(id); if (ModuleAccess.ModuleSystem) { html_view.Navigate(new Uri("ms-appx-web:///SerrisModulesServer/SystemModules/Addons/" + id + "/" + path)); } else { html_view.Navigate(new Uri("ms-appdata:///local/modules/" + id + "/" + path)); Debug.WriteLine("ms-appdata:///local/modules/" + id + "/" + path); } } }
public ThemeReader(int ID) { id_module = ID; InfosModule ModuleAccess = ModulesAccessManager.GetModuleViaID(ID); system_module = ModuleAccess.ModuleSystem; }
public ModuleInfo getModuleInfosViaID(string ID) { var module = ModulesAccessManager.GetModuleViaID(ID); return(new ModuleInfo { ID = module.ID, moduleSystem = module.ModuleSystem, moduleName = module.ModuleName, moduleAuthor = module.ModuleAuthor, moduleDescription = module.ModuleDescription, moduleWebsiteLink = module.ModuleWebsiteLink, containMonacoTheme = module.ContainMonacoTheme, isEnabled = module.IsEnabled, isPinnedToToolbar = module.CanBePinnedToToolBar, moduleVersion = new ModuleInfoVersion { major = module.ModuleVersion.Major, minor = module.ModuleVersion.Minor, revision = module.ModuleVersion.Revision } }); }
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); } }
private async void IntializeChakraAndExecute(string function_name) { /* * ============================= * = ADDONS EXECUTOR VARIABLES = * ============================= */ host.Chakra.ProjectObjectToGlobal(_SCEELibs, "sceelibs"); /* * =========================== * = ADDONS EXECUTOR CONTENT = * =========================== */ InfosModule ModuleAccess = ModulesAccessManager.GetModuleViaID(_id); StorageFile MainFile = AsyncHelpers.RunSync(async() => await StorageFile.GetFileFromApplicationUriAsync(new Uri(ModulesAccessManager.GetModuleFolderPath(ModuleAccess.ID, ModuleAccess.ModuleSystem) + "main.js"))); foreach (string Path in ModuleAccess.JSFilesPathList) { try { StorageFile FileFromPath = AsyncHelpers.RunSync(async() => await StorageFile.GetFileFromApplicationUriAsync(new Uri(ModulesAccessManager.GetModuleFolderPath(ModuleAccess.ID, ModuleAccess.ModuleSystem) + Path))); host.Chakra.RunScript(AsyncHelpers.RunSync(async() => await FileIO.ReadTextAsync(FileFromPath))); } catch { Debug.WriteLine("Erreur ! :("); } } try { string code = AsyncHelpers.RunSync(async() => await FileIO.ReadTextAsync(MainFile)); host.Chakra.RunScript(code); } catch (Exception ex) { Debug.WriteLine(ex.Message); } try { host.Chakra.CallFunction(function_name); } catch { } }
private async void UpdateTabInformations() { //Set temp tab + tabs list ID try { current_tab = TabsAccessManager.GetTabViaID(new TabID { ID_Tab = current_tab.ID, ID_TabsList = current_list }); name_tab.Text = current_tab.TabName; //Tooltip name ToolTip ButtonTooltip = new ToolTip(); ButtonTooltip.Content = current_tab.TabName; ToolTipService.SetToolTip(IconAndTabNameGrid, ButtonTooltip); switch (current_tab.TabContentType) { case ContentType.File: string ModuleIDIcon = LanguagesHelper.GetModuleIDOfLangageType(current_tab.TabType); TabIcon.Source = await ModulesAccessManager.GetModuleIconViaIDAsync(ModuleIDIcon, ModulesAccessManager.GetModuleViaID(ModuleIDIcon).ModuleSystem); if (!string.IsNullOrEmpty(current_tab.TabOriginalPathContent)) { switch (current_tab.TabStorageMode) { case StorageListTypes.LocalStorage: path_tab.Text = current_tab.TabOriginalPathContent; break; case StorageListTypes.OneDrive: path_tab.Text = "OneDrive file"; break; } Size_Stackpanel.Visibility = Visibility.Visible; Modified_Stackpanel.Visibility = Visibility.Visible; Created_Stackpanel.Visibility = Visibility.Visible; Rename_Tab.IsEnabled = false; } else { Size_Stackpanel.Visibility = Visibility.Collapsed; Modified_Stackpanel.Visibility = Visibility.Collapsed; Created_Stackpanel.Visibility = Visibility.Collapsed; Rename_Tab.IsEnabled = true; } Notification.ShowBadge = current_tab.TabNewModifications; TabsListGrid.Visibility = Visibility.Collapsed; TabIcon.Visibility = Visibility.Visible; FolderIcon.Visibility = Visibility.Collapsed; StackInfos.Visibility = Visibility.Visible; MaxHeightAnimShow.Value = 200; MaxHeightAnimRemove.Value = 200; break; case ContentType.Folder: Notification.ShowBadge = false; Rename_Tab.IsEnabled = false; More_Tab.Visibility = Visibility.Visible; TabsListGrid.Visibility = Visibility.Visible; StackInfos.Visibility = Visibility.Collapsed; TabIcon.Visibility = Visibility.Collapsed; FolderIcon.Visibility = Visibility.Visible; if (TempTabID != current_tab.ID && TabsList.ListID != current_list) { if (current_tab.FolderOpened) { ShowInfos.Begin(); infos_opened = true; } else { infos_opened = false; } TabsList.ListTabs.Items.Clear(); TempTabID = current_tab.ID; TabsList.ListID = current_list; foreach (int ID in current_tab.FolderContent) { try { if (TabsAccessManager.GetTabViaID(new TabID { ID_Tab = ID, ID_TabsList = current_list }) != null) { TabsList.ListTabs.Items.Add(new TabID { ID_Tab = ID, ID_TabsList = current_list }); if ((int)AppSettings.Values["Tabs_tab-selected-index"] == ID && (int)AppSettings.Values["Tabs_list-selected-index"] == current_list) { TabsList.ListTabs.SelectedIndex = TabsList.ListTabs.Items.Count - 1; } } } catch { } } } MaxHeightAnimShow.Value = 1500; MaxHeightAnimRemove.Value = 1500; break; } } catch { } }
public TemplatesReader(int ID) : base(ID) { ModuleContent = ModulesAccessManager.GetModuleViaID(ID); }
private async void UpdateTabInformations() { //Set temp tab + tabs list ID try { current_tab = TabsAccessManager.GetTabViaID(new TabID { ID_Tab = current_tab.ID, ID_TabsList = current_list }); name_tab.Text = current_tab.TabName; switch (current_tab.TabContentType) { case ContentType.File: int ModuleIDIcon = LanguagesHelper.GetModuleIDOfLangageType(current_tab.TabType); TabIcon.Source = await ModulesAccessManager.GetModuleIconViaIDAsync(ModuleIDIcon, ModulesAccessManager.GetModuleViaID(ModuleIDIcon).ModuleSystem); if (!string.IsNullOrEmpty(current_tab.PathContent)) { path_tab.Text = current_tab.PathContent; encoding_file.Text = Encoding.GetEncoding(current_tab.TabEncoding).EncodingName; More_Tab.Visibility = Visibility.Visible; } else { More_Tab.Visibility = Visibility.Collapsed; } TabsListGrid.Visibility = Visibility.Collapsed; TabIcon.Visibility = Visibility.Visible; FolderIcon.Visibility = Visibility.Collapsed; StackInfos.Visibility = Visibility.Visible; break; case ContentType.Folder: More_Tab.Visibility = Visibility.Visible; TabsListGrid.Visibility = Visibility.Visible; StackInfos.Visibility = Visibility.Collapsed; TabIcon.Visibility = Visibility.Collapsed; FolderIcon.Visibility = Visibility.Visible; if (TempTabID != current_tab.ID && TabsList.ListID != current_list) { ShowInfos.Begin(); TabsList.ListTabs.Items.Clear(); TempTabID = current_tab.ID; TabsList.ListID = current_list; foreach (int ID in current_tab.FolderContent) { try { if (TabsAccessManager.GetTabViaID(new TabID { ID_Tab = ID, ID_TabsList = current_list }) != null) { TabsList.ListTabs.Items.Add(new TabID { ID_Tab = ID, ID_TabsList = current_list }); if ((int)AppSettings.Values["Tabs_tab-selected-index"] == ID && (int)AppSettings.Values["Tabs_list-selected-index"] == current_list) { TabsList.ListTabs.SelectedIndex = TabsList.ListTabs.Items.Count - 1; } } } catch { } } } break; } } catch { } }
public async void createNewSheet(string sheetName, string pathHTMLPage) { await DispatcherHelper.ExecuteOnUIThreadAsync(async() => { ModuleHTMLView view = new ModuleHTMLView(); view.LoadPage(pathHTMLPage, id); Messenger.Default.Send(new ModuleSheetNotification { id = id, sheetName = sheetName, type = ModuleSheetNotificationType.NewSheet, sheetContent = view, sheetIcon = await ModulesAccessManager.GetModuleIconViaIDAsync(id, ModulesAccessManager.GetModuleViaID(id).ModuleSystem), sheetSystem = false }); }); }
public async Task <string> GetLanguageDefinitionContent() { try { StorageFile LanguageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(ModuleFolderPath + "language.js")); return("var content = function() { " + await FileIO.ReadTextAsync(LanguageFile) + " }; monaco.languages.setMonarchTokensProvider('" + ModulesAccessManager.GetModuleViaID(ModuleID).ProgrammingLanguageMonacoDefinitionName + "', content());"); } catch { return(""); } }