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 });"); } } }
//Add new private void OpacityButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { ShowContentViewer = new ContentViewer(); ShowContentViewer.Background = new SolidColorBrush(Color.FromArgb(0, 255, 255, 255)); TB_Name.Text = Strings.ResStrings.Repeating + " " + (data.RepeatingControls.Count + 1); ShowContentViewer.MaxHeight = 150; SCV_ContentViewer.Content = ShowContentViewer; Value_ContentViewer contentViewer = new Value_ContentViewer(data, ShowContentViewer); CVEditor.Content = null; CVEditor.Content = contentViewer; contentViewer.Button_DeleteControl.Visibility = Visibility.Collapsed; contentViewer.Button_MakeRepeating.Visibility = Visibility.Collapsed; contentViewer.ChangedContentViewer -= ContentViewer_ChangedContentViewer; contentViewer.ChangedContentViewer += ContentViewer_ChangedContentViewer; TypeLabel.Content = Strings.ResStrings.AddNew; B_Edit.Visibility = Visibility.Collapsed; SP_EditName.Visibility = Visibility.Collapsed; TBL_EditName.Text = ""; DrawToCanvas(); AddListeners(); LB_IgnorePages.Items.Clear(); }
public async void ManageQueueTabs() { while (!CanManageQueue) { await Task.Delay(20); } if (CanManageQueue) { CanManageQueue = false; try { if (GlobalVariables.CurrentIDs.ID_Tab != 0) { //Code content string content = await ContentViewer.GetCode(); SerrisModulesServer.Manager.AsyncHelpers.RunSync(() => TabsWriteManager.PushTabContentViaIDAsync(GlobalVariables.CurrentIDs, content, false)); //Cursor position PositionSCEE CursorPosition = await ContentViewer.GetCursorPosition(); InfosTab Tab = TabsAccessManager.GetTabViaID(GlobalVariables.CurrentIDs); Tab.TabCursorPosition = new CursorPosition { column = CursorPosition.column, row = CursorPosition.row }; await TabsWriteManager.PushUpdateTabAsync(Tab, GlobalVariables.CurrentIDs.ID_TabsList, false); } } catch { } foreach (CoreApplicationView view in CoreApplication.Views) { if (Dispatcher != view.Dispatcher) { await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Messenger.Default.Send(new STSNotification { Type = TypeUpdateTab.TabUpdated, ID = GlobalVariables.CurrentIDs }); }); } } GlobalVariables.CurrentIDs = new TabID { ID_Tab = Queue_Tabs[0].tabID, ID_TabsList = Queue_Tabs[0].tabsListID }; ContentViewer.MonacoModelID = Queue_Tabs[0].monacoModelID; ContentViewer.CursorPositionColumn = Queue_Tabs[0].cursorPositionColumn; ContentViewer.CursorPositionRow = Queue_Tabs[0].cursorPositionLineNumber; ContentViewer.CodeLanguage = Queue_Tabs[0].typeLanguage; ContentViewer.Code = Queue_Tabs[0].code; ChangePushed = false; Queue_Tabs.RemoveAt(0); CanManageQueue = true; } }
private async void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); try { if (GlobalVariables.CurrentIDs.ID_Tab != 0) { //Code content string content = await ContentViewer.GetCode(); await TabsWriteManager.PushTabContentViaIDAsync(GlobalVariables.CurrentIDs, content, false); //Cursor position PositionSCEE CursorPosition = await ContentViewer.GetCursorPosition(); InfosTab Tab = TabsAccessManager.GetTabViaID(GlobalVariables.CurrentIDs); Tab.TabCursorPosition = new CursorPosition { column = CursorPosition.column, row = CursorPosition.row }; await TabsWriteManager.PushUpdateTabAsync(Tab, GlobalVariables.CurrentIDs.ID_TabsList, false); deferral.Complete(); } else { deferral.Complete(); } } catch { deferral.Complete(); } }
public Window_Repeating(DataStore datas, ContentViewer CcontentViewer) { InitializeComponent(); data = datas; TB_Name.Text = Strings.ResStrings.Repeating + " " + (data.RepeatingControls.Count + 1); ShowContentViewer.Background = new SolidColorBrush(Color.FromArgb(0, 255, 255, 255)); ShowContentViewer = (ContentViewer)ClassWorker.CloneObject(CcontentViewer); ShowContentViewer.MaxHeight = 150; SCV_ContentViewer.Content = ShowContentViewer; Canvas.SetLeft(ShowContentViewer, Canvas.GetLeft(CcontentViewer)); Canvas.SetTop(ShowContentViewer, Canvas.GetTop(CcontentViewer)); Value_ContentViewer contentViewer = new Value_ContentViewer(data, ShowContentViewer); contentViewer.ChangedContentViewer -= ContentViewer_ChangedContentViewer; contentViewer.ChangedContentViewer += ContentViewer_ChangedContentViewer; contentViewer.Button_DeleteControl.Visibility = Visibility.Collapsed; contentViewer.Button_MakeRepeating.Visibility = Visibility.Collapsed; CVEditor.Content = contentViewer; AddListeners(); DrawToCanvas(); UpdateAllControls(); }
public void LoadAsync() { if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPrompt.Visibility = Visibility.Visible; PagesBox.Visibility = Visibility.Hidden; Task task = new Task(() => { IJson userinfo = BiliApi.GetJsonResult("https://api.bilibili.com/x/web-interface/nav", null, false); if (cancellationToken.IsCancellationRequested) { return; } if (userinfo.GetValue("code").ToLong() == 0) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("mid", userinfo.GetValue("data").GetValue("mid").ToLong().ToString()); IJson json = BiliApi.GetJsonResult("https://api.bilibili.com/x/space/fav/nav", dic, false); if (cancellationToken.IsCancellationRequested) { return; } if (json.GetValue("code").ToLong() == 0) { Dispatcher.Invoke(new Action(() => { foreach (IJson folder in json.GetValue("data").GetValue("archive")) { FavItem favItem; if (folder.GetValue("Cover").Contains(0)) { favItem = new FavItem(folder.GetValue("name").ToString(), folder.GetValue("cover").GetValue(0).GetValue("pic").ToString(), folder.GetValue("cur_count").ToLong(), folder.GetValue("media_id").ToLong(), true); } else { favItem = new FavItem(folder.GetValue("name").ToString(), null, folder.GetValue("cur_count").ToLong(), folder.GetValue("media_id").ToLong(), true); } favItem.PreviewMouseLeftButtonDown += FavItem_PreviewMouseLeftButtonDown; ContentPanel.Children.Add(favItem); } })); } } Dispatcher.Invoke(new Action(() => { LoadingPrompt.Visibility = Visibility.Hidden; })); }); task.Start(); }
public ContentViewer CreateControl(DataStore data) { ContentViewer control = new ContentViewer(); Deserialize(control, data); return(control); }
public void Serialize(ContentViewer control, DataStore data) { SerializeDefault(control); brush.Serialize(control, control.Background, data); content = control.contentCreator; horizontalAlignment = control.HorizontalContentAlignment; verticalAlignment = control.VerticalContentAlignment; }
/// <summary> /// Search a text asynchronously. /// </summary> /// <param name="text">text</param> public void SearchAsync(string text, int pagenum) { SearchText = text; long aid = FindAid(text); if (aid >= 0) { HistoryBox.Insert(text); VideoSelected?.Invoke("Av" + aid.ToString(), aid); return; } if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); PagesBox.Visibility = Visibility.Hidden; if (text != null && text.Trim() != string.Empty) { HistoryBox.Insert(text); HistoryBox.Visibility = Visibility.Hidden; TypeBtn.IsChecked = true; cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPrompt.Visibility = Visibility.Visible; NoMoreGrid.Visibility = Visibility.Collapsed; ContentViewer.Visibility = Visibility.Collapsed; Task task = new Task(() => { string type = NavType; Json.Value json = GetResult(text, type, pagenum); if (json != null) { Dispatcher.Invoke(new Action(() => { if (cancellationToken.IsCancellationRequested) { return; } ShowResult(json, type); PagesBox.SetPage((int)json["data"]["numPages"], (int)json["data"]["page"], false); PagesBox.Visibility = Visibility.Visible; LoadingPrompt.Visibility = Visibility.Hidden; })); } }); task.Start(); } else { HistoryBox.Visibility = Visibility.Visible; } }
public void Deserialize(ContentViewer control, DataStore data) { DeserializeDefault(control); control.Background = brush.DeserializeToBrush(control, data); control.contentCreator = content; control.HorizontalContentAlignment = horizontalAlignment; control.VerticalContentAlignment = verticalAlignment; control.Content = control.contentCreator.Create(data); }
private void ShowFolder(int mediaId, int pagenum, bool init) { if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); MediaId = mediaId; cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPrompt.Visibility = Visibility.Visible; PagesBox.Visibility = Visibility.Hidden; Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("media_id", mediaId.ToString()); dic.Add("pn", pagenum.ToString()); dic.Add("ps", "20"); dic.Add("keyword", ""); dic.Add("order", "mtime"); dic.Add("type", "0"); dic.Add("tid", "0"); dic.Add("jsonp", "jsonp"); Task task = new Task(() => { IJson json = BiliApi.GetJsonResult("https://api.bilibili.com/medialist/gateway/base/spaceDetail", dic, false); if (cancellationToken.IsCancellationRequested) { return; } if (json.GetValue("code").ToLong() == 0) { Dispatcher.Invoke(new Action(() => { foreach (IJson media in json.GetValue("data").GetValue("medias")) { FavItem favItem = new FavItem(media.GetValue("title").ToString(), media.GetValue("cover").ToString(), media.GetValue("fav_time").ToLong(), media.GetValue("id").ToLong(), false); favItem.PreviewMouseLeftButtonDown += FavItem_PreviewMouseLeftButtonDown; ContentPanel.Children.Add(favItem); } if (init) { PagesBox.SetPage((int)Math.Ceiling((double)json.GetValue("data").GetValue("info").GetValue("media_count").ToLong() / 20), 1, true); } PagesBox.Visibility = Visibility.Visible; })); } Dispatcher.Invoke(new Action(() => { LoadingPrompt.Visibility = Visibility.Hidden; })); }); task.Start(); }
private void FavItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FavItem favItemSender = (FavItem)sender; if (favItemSender.IsFolder) { if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPrompt.Visibility = Visibility.Visible; Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("media_id", favItemSender.Id.ToString()); dic.Add("pn", "1"); dic.Add("ps", "20"); dic.Add("keyword", ""); dic.Add("order", "mtime"); dic.Add("type", "0"); dic.Add("tid", "0"); dic.Add("jsonp", "jsonp"); Task task = new Task(() => { IJson json = BiliApi.GetJsonResult("https://api.bilibili.com/medialist/gateway/base/spaceDetail", dic, false); if (cancellationToken.IsCancellationRequested) { return; } if (json.GetValue("code").ToLong() == 0) { Dispatcher.Invoke(new Action(() => { foreach (IJson media in json.GetValue("data").GetValue("medias")) { FavItem favItem = new FavItem(media.GetValue("title").ToString(), media.GetValue("cover").ToString(), media.GetValue("fav_time").ToLong(), media.GetValue("id").ToLong(), false); favItem.PreviewMouseLeftButtonDown += FavItem_PreviewMouseLeftButtonDown; ContentPanel.Children.Add(favItem); } })); } Dispatcher.Invoke(new Action(() => { LoadingPrompt.Visibility = Visibility.Hidden; })); }); task.Start(); } else { VideoSelected?.Invoke(favItemSender.Title, favItemSender.Id); } }
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); } }
public void LoadAsync() { if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPromptList.Visibility = Visibility.Visible; PagesBox.Visibility = Visibility.Hidden; Task task = new Task(() => { Json.Value userinfo = BiliApi.GetJsonResult("https://api.bilibili.com/x/web-interface/nav", null, false); if (cancellationToken.IsCancellationRequested) { return; } if (userinfo["code"] == 0) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("pn", "1"); dic.Add("ps", "100"); dic.Add("up_mid", ((uint)userinfo["data"]["mid"]).ToString()); dic.Add("is_space", "0"); Json.Value json = BiliApi.GetJsonResult("https://api.bilibili.com/medialist/gateway/base/created", dic, false); if (cancellationToken.IsCancellationRequested) { return; } if (json["code"] == 0) { Dispatcher.Invoke(new Action(() => { foreach (Json.Value folder in json["data"]["list"]) { AddFavFolder(new FavFolder(folder["title"], folder["media_count"], folder["id"])); } AddFavFolder(new FavFolder(FavFolder.SpecialFolder.ToView)); })); } } Dispatcher.Invoke(new Action(() => { LoadingPromptList.Visibility = Visibility.Hidden; })); }); task.Start(); }
public void LoadAsync(int mid, int page, bool init) { Mid = mid; if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); PagesBox.Visibility = Visibility.Hidden; cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPrompt.Visibility = Visibility.Visible; Task task = new Task(() => { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("mid", mid.ToString()); dic.Add("ps", "30"); dic.Add("pn", page.ToString()); try { Json.Value json = BiliApi.GetJsonResult("https://api.bilibili.com/x/space/arc/search", dic, true); Dispatcher.Invoke(new Action(() => { foreach (Json.Value v in json["data"]["list"]["vlist"]) { ResultBox.Video video = new ResultBox.Video(v); ResultVideo resultVideo = new ResultVideo(video); resultVideo.PreviewMouseLeftButtonDown += ResultVideo_PreviewMouseLeftButtonDown; ContentPanel.Children.Add(resultVideo); } if (init) { int pages = (int)Math.Ceiling((double)json["data"]["page"]["count"] / json["data"]["page"]["ps"]); PagesBox.SetPage(pages, 1, true); } PagesBox.Visibility = Visibility.Visible; LoadingPrompt.Visibility = Visibility.Hidden; })); } catch (Exception) { } Dispatcher.Invoke(new Action(() => { LoadingPrompt.Visibility = Visibility.Hidden; })); }, cancellationTokenSource.Token); task.Start(); }
public void LoadAsync(int mid, int page, bool init) { Mid = mid; if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); PagesBox.Visibility = Visibility.Hidden; cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPrompt.Visibility = Visibility.Visible; Task task = new Task(() => { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("mid", mid.ToString()); dic.Add("pagesize", "30"); dic.Add("page", page.ToString()); try { IJson json = BiliApi.GetJsonResult("https://space.bilibili.com/ajax/member/getSubmitVideos", dic, true); Dispatcher.Invoke(new Action(() => { foreach (IJson v in json.GetValue("data").GetValue("vlist")) { ResultBox.Video video = new ResultBox.Video(v); ResultVideo resultVideo = new ResultVideo(video); resultVideo.PreviewMouseLeftButtonDown += ResultVideo_PreviewMouseLeftButtonDown; ContentPanel.Children.Add(resultVideo); } if (init) { PagesBox.SetPage((int)json.GetValue("data").GetValue("pages").ToLong(), 1, true); } PagesBox.Visibility = Visibility.Visible; LoadingPrompt.Visibility = Visibility.Hidden; })); } catch (Exception) { } Dispatcher.Invoke(new Action(() => { LoadingPrompt.Visibility = Visibility.Hidden; })); }, cancellationTokenSource.Token); task.Start(); }
private async void SetMathView() { var vs = await GetMathSize(); int extra = 32; Size view = ContentViewer.RenderSize; if (vs != Size.Empty) { if (MathView.ActualWidth != vs.Width + extra || vs.Width > view.Width - extra) { MathView.Width = vs.Width + extra; ContentViewer.HorizontalContentAlignment = HorizontalAlignment.Center; } else { MathView.Width = view.Width - extra; } if (MathView.ActualHeight != vs.Height + extra || vs.Height > view.Height - extra) { MathView.Height = vs.Height + extra; } else { MathView.Height = view.Height - extra; } if (MathView.ActualWidth > ContentViewer.ActualWidth) { ContentViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible; } else { ContentViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; } if (MathView.ActualHeight > ContentViewer.ActualHeight) { ContentViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; } else { ContentViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; } //ContentViewer.UpdateLayout(); ContentViewer.ChangeView((MathView.ActualWidth - ContentViewer.ActualWidth) / 2.0, 0, 1, true); //ContentViewer.VerticalScrollMode = ScrollMode.Auto; } }
/// <summary> /// Search a text. /// </summary> /// <param name="text">text</param> public void Search(string text) { ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); if (text != null && text.Trim() != string.Empty) { TypeBtn.IsChecked = true; string type = NavType; IJson json = GetResult(text, type); if (json != null) { ShowResult(json, type); } } }
private void Edit() { if (CB_Listbox.SelectedIndex >= 0) { ContentViewer cont = ((ContentViewer)CB_Listbox.Items[CB_Listbox.SelectedIndex]); DWindow_Content contentW = new DWindow_Content(data, cont.contentCreator); contentW.ShowDialog(); if (contentW.IsOK == true) { cont.contentCreator = contentW.content; cont.Content = ""; cont.Content = cont.contentCreator.Create(data); } } }
protected void OnAttachCurrentViewer(ContentViewer viewer) { if (viewer == null) { return; } if (viewer is SheetViewer) { var sheetViewer = viewer as SheetViewer; sheetViewer.SheetDisplay = this.SheetViewer; sheetViewer.SceneManager = this.SceneManager; } viewer.BackColor = this.BackColor; AttachCurrentViewer?.Invoke(viewer); }
public async void ManageQueueTabs() { while (!CanManageQueue) { await Task.Delay(20); } if (CanManageQueue) { CanManageQueue = false; try { if (GlobalVariables.CurrentIDs.ID_Tab != 0) { string content = await ContentViewer.GetCode(); SerrisModulesServer.Manager.AsyncHelpers.RunSync(() => TabsWriteManager.PushTabContentViaIDAsync(GlobalVariables.CurrentIDs, content, false)); } } catch { } foreach (CoreApplicationView view in CoreApplication.Views) { if (Dispatcher != view.Dispatcher) { await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Messenger.Default.Send(new STSNotification { Type = TypeUpdateTab.TabUpdated, ID = GlobalVariables.CurrentIDs }); }); } } GlobalVariables.CurrentIDs = new TabID { ID_Tab = Queue_Tabs[0].tabID, ID_TabsList = Queue_Tabs[0].tabsListID }; ContentViewer.CodeLanguage = Queue_Tabs[0].typeLanguage; ContentViewer.Code = Queue_Tabs[0].code; Queue_Tabs.RemoveAt(0); CanManageQueue = true; } }
/// <summary> /// Search a text asynchronously. /// </summary> /// <param name="text">text</param> public void SearchAsync(string text, int pagenum) { if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); PagesBox.Visibility = Visibility.Hidden; if (text != null && text.Trim() != string.Empty) { HistoryBox.Insert(text); HistoryBox.Visibility = Visibility.Hidden; TypeBtn.IsChecked = true; cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPrompt.Visibility = Visibility.Visible; Task task = new Task(() => { string type = NavType; IJson json = GetResult(text, type, pagenum); if (json != null) { Dispatcher.Invoke(new Action(() => { if (cancellationToken.IsCancellationRequested) { return; } ShowResult(json, type); PagesBox.SetPage((int)json.GetValue("data").GetValue("numpages").ToLong(), (int)json.GetValue("data").GetValue("page").ToLong(), false); PagesBox.Visibility = Visibility.Visible; LoadingPrompt.Visibility = Visibility.Hidden; })); } }); task.Start(); } else { HistoryBox.Visibility = Visibility.Visible; } }
private void Button_Add_Click(object sender, RoutedEventArgs e) { ContentCreator contentCreator = new ContentCreator(); DWindow_Content contentW = new DWindow_Content(data, contentCreator); contentW.ShowDialog(); if (contentW.IsOK == true) { ContentViewer cont = new ContentViewer(); cont.contentCreator = contentW.content; cont.Content = ""; cont.Content = cont.contentCreator.Create(data); cont.MaxHeight = 80; CB_Listbox.Items.Add(cont); } }
public DWindow_ComboBox(DataStore datastore, List <ContentCreator> list) { InitializeComponent(); data = datastore; foreach (ContentCreator cont in list) { ContentViewer contV = new ContentViewer(); contV.contentCreator = cont; contV.Content = ""; contV.Content = cont.Create(data); contV.MaxHeight = 80; CB_Listbox.Items.Add(contV); } }
private void DrawToCanvas() { /* * ShowContentViewerV.contentCreator.contents = new List<Class.Serialization.Content_Ser.Content_Default>(ShowContentViewer.contentCreator.contents); * ShowContentViewerV.Content = ShowContentViewerV.contentCreator.Create(data); */ CanvasShow.Children.Clear(); ContentViewer ShowContentViewerV = (ContentViewer)ClassWorker.CloneObject(ShowContentViewer); ShowContentViewerV.Content = ShowContentViewerV.contentCreator.Create(data); ShowContentViewerV.Width = ShowContentViewer.Width; ShowContentViewerV.Height = ShowContentViewer.Height; ShowContentViewerV.MaxHeight = Double.PositiveInfinity; Canvas.SetLeft(ShowContentViewerV, Canvas.GetLeft(ShowContentViewer)); Canvas.SetTop(ShowContentViewerV, Canvas.GetTop(ShowContentViewer)); CanvasShow.Children.Add(ShowContentViewerV); }
/// <summary> /// Search a text. /// </summary> /// <param name="text">text</param> public void Search(string text) { ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); if (text != null && text.Trim() != string.Empty) { HistoryBox.Insert(text); HistoryBox.Visibility = Visibility.Hidden; TypeBtn.IsChecked = true; string type = NavType; IJson json = GetResult(text, type); if (json != null) { ShowResult(json, type); } } else { HistoryBox.Visibility = Visibility.Visible; } }
public Value_ContentViewer(DataStore datas, ContentViewer contentViewer) { InitializeComponent(); cont = contentViewer; data = datas; positionselector.SetData(cont); positionselector.LoadData(); effectselector.SetData(cont); effectselector.LoadData(); alignmentSelector.SetData(cont.HorizontalContentAlignment, cont.VerticalContentAlignment); alignmentSelector.ChangedAlign += AlignmentSelector_ChangedAlign; brushselector.SetData(cont, data, true); brushselector.LoadData(cont.Background); brushselector.ChangedBrush -= Brushselector_ChangedBrush; brushselector.ChangedBrush += Brushselector_ChangedBrush; }
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"] + " });"); } }
/// <summary> /// Search a text asynchronously. /// </summary> /// <param name="text">text</param> public void SearchAsync(string text) { if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); } ContentViewer.ScrollToHome(); ContentPanel.Children.Clear(); if (text != null && text.Trim() != string.Empty) { TypeBtn.IsChecked = true; cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellationToken = cancellationTokenSource.Token; LoadingPrompt.Visibility = Visibility.Visible; Task task = new Task(() => { string type = NavType; IJson json = GetResult(text, type); if (json != null) { Dispatcher.Invoke(new Action(() => { if (cancellationToken.IsCancellationRequested) { return; } ShowResult(json, type); LoadingPrompt.Visibility = Visibility.Hidden; })); } }); task.Start(); } }
/* ============= * = 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 { } }); }); }