private Task Add(Command command) { switch (command) { case Command.ToggleWindow: return(ToggleWindow.Add()); case Command.NextTab: return(NextTab.Add()); case Command.PreviousTab: return(PreviousTab.Add()); case Command.NewTab: return(NewTab.Add()); case Command.CloseTab: return(CloseTab.Add()); case Command.NewWindow: return(NewWindow.Add()); case Command.ShowSettings: return(ShowSettings.Add()); case Command.Copy: return(Copy.Add()); case Command.Paste: return(Paste.Add()); } return(Task.CompletedTask); }
public SolutionDocumentViewer() { dv.TabContainer.Clear(); this.Container = (IHTMLDiv)(object)dv.body; Action Deselect = delegate { }; dv.TabContainer.onmouseover += delegate { dv.TabContainer.style.height = "3em"; dv.TabContainer.style.overflowX = IStyle.OverflowEnum.auto; }; dv.TabContainer.onmouseout += delegate { dv.TabContainer.style.height = "2em"; dv.TabContainer.style.overflowX = IStyle.OverflowEnum.hidden; }; this.Tabs = new BindingList <SolutionDocumentViewerTab>().WithEvents( NewTab => { #region create var Current = new IHTMLDiv().AttachTo(dv.TabContainer); NewTab.TabElement = Current; Current.style.display = IStyle.DisplayEnum.inline_block; var Prototype = new SolutionDocumentViewerPage(); var ActiveTab = Prototype.ActiveTab.AttachTo(Current); var CandidateTab = Prototype.CandidateTab.AttachTo(Current); var InactiveTab = Prototype.InactiveTab.AttachTo(Current); ActiveTab.style.display = IStyle.DisplayEnum.none; CandidateTab.style.display = IStyle.DisplayEnum.none; Action TextChanged = delegate { Prototype.ActiveTabText.innerText = NewTab.Text; Prototype.CandidateTabText.innerText = NewTab.Text; Prototype.InactiveTabText.innerText = NewTab.Text; }; TextChanged(); NewTab.Changed += TextChanged; var IsActive = false; Current.onmouseover += delegate { if (IsActive) { return; } InactiveTab.style.display = IStyle.DisplayEnum.none; CandidateTab.style.display = IStyle.DisplayEnum.empty; }; Current.onmouseout += delegate { if (IsActive) { return; } InactiveTab.style.display = IStyle.DisplayEnum.empty; CandidateTab.style.display = IStyle.DisplayEnum.none; }; Action Activate = delegate { if (!IsActive) { IsActive = true; ActiveTab.style.display = IStyle.DisplayEnum.empty; CandidateTab.style.display = IStyle.DisplayEnum.none; InactiveTab.style.display = IStyle.DisplayEnum.none; Deselect(); Deselect = delegate { IsActive = false; ActiveTab.style.display = IStyle.DisplayEnum.none; InactiveTab.style.display = IStyle.DisplayEnum.empty; }; NewTab.RaiseActivated(); } }; NewTab.Activate = Activate; NewTab.Activated += delegate { (from kk in this where kk != NewTab select(Action) kk.RaiseDeactivated).Invoke(); }; Current.onclick += delegate { Activate(); }; #endregion return(delegate { Current.Orphanize(); }); } ); //this.Add("Tab1"); //this.Add("Tab2"); //this.Add("Tab3"); }
public SolutionFileDesigner() { var ToolbarHeight = "1.3em"; var Container = new IHTMLDiv(); this.Container = Container; Container.style.position = IStyle.PositionEnum.absolute; Container.style.left = "0px"; Container.style.top = "0px"; Container.style.right = "0px"; Container.style.bottom = "0px"; var Content = new IHTMLDiv().AttachTo(Container); this.Content = Content; Content.style.position = IStyle.PositionEnum.absolute; Content.style.left = "0px"; Content.style.top = "0px"; Content.style.right = "0px"; Content.style.bottom = ToolbarHeight; var Toolbar = new IHTMLDiv().AttachTo(Container); Toolbar.style.backgroundColor = Color.FromGray(0xef); Toolbar.style.position = IStyle.PositionEnum.absolute; Toolbar.style.left = "0px"; Toolbar.style.height = ToolbarHeight; Toolbar.style.right = "0px"; Toolbar.style.bottom = "0px"; this.Tabs = new BindingList <SolutionFileDesignerTab>().WithEvents( NewTab => { var span = new IHTMLSpan { innerText = NewTab.Text }; span.style.paddingLeft = "1.5em"; span.style.paddingRight = "0.3em"; var a = new IHTMLAnchor { NewTab.Image, span }; NewTab.TabElement = a; NewTab.Image.style.verticalAlign = "middle"; NewTab.Image.border = 0; NewTab.Image.style.position = IStyle.PositionEnum.absolute; a.style.backgroundColor = Color.FromGray(0xef); a.style.color = Color.Black; a.style.textDecoration = "none"; a.style.fontFamily = IStyle.FontFamilyEnum.Tahoma; a.href = "javascript: void(0);"; NewTab.Activated += delegate { (from k in this.Tabs.Source where k != NewTab select(Action) k.RaiseDeactivated).Invoke(); }; a.onclick += delegate { NewTab.RaiseActivated(); }; a.style.display = IStyle.DisplayEnum.inline_block; a.style.height = "100%"; a.onmousemove += delegate { a.style.backgroundColor = Color.FromGray(0xff); }; a.onmouseout += delegate { a.style.backgroundColor = Color.FromGray(0xef); }; Toolbar.Add(a); return(delegate { a.Orphanize(); }); } ); }
protected override void Execute(NativeActivityContext context) { var url = Url.Get(context); var browser = Browser.Get(context); var timeout = TimeSpan.FromSeconds(3); var newtab = NewTab.Get(context); if (browser != "chrome" && browser != "ff" && browser != "edge") { browser = "chrome"; } if (!string.IsNullOrEmpty(url)) { NMHook.enumtabs(); var tab = NMHook.FindTabByURL(browser, url); if (tab != null) { if (!tab.highlighted || !tab.selected) { var _tab = NMHook.selecttab(browser, tab.id); } } } var userDataFolderMode = UserDataFolderMode.Get(context); var userDataFolderPath = UserDataFolderPath.Get(context); string profilepath = ""; string profilename = ""; if (string.IsNullOrEmpty(userDataFolderMode)) { userDataFolderMode = "automatic"; } userDataFolderMode = userDataFolderMode.ToLower(); if (userDataFolderMode == "automatic") // child session uses a different folder than the default mode, automatically generated if UserDataFolderPath is not set { if (Plugin.client.isRunningInChildSession) { profilepath = userDataFolderPath; if (string.IsNullOrEmpty(profilepath)) { profilepath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\openrpa\\ChildSession\\" + browser; profilename = "ChildSession"; } } } else if (userDataFolderMode == "customfolder") { profilepath = userDataFolderPath; if (string.IsNullOrEmpty(profilepath)) { if (Plugin.client.isRunningInChildSession) { profilepath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\openrpa\\ChildSession\\" + browser; profilename = "ChildSession"; } else { profilepath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\openrpa\\" + browser; profilename = "openrpa"; } } } else if (userDataFolderMode == "defaultfolder") { // Uses the default browser folder, no matter what } NMHook.openurl(browser, url, newtab, profilename, profilepath); }