private void Initialize() { // When the program is run by the context menu entry, the working directory is not correct. // So the correct working directory (where ExploScripts is installed) is passed as a command line arg. if (Environment.GetCommandLineArgs().Length >= 2) { Directory.SetCurrentDirectory(Environment.GetCommandLineArgs()[1]); } // Initialize the script database and setup the data binding to the view db = new ExploScriptDatabase(); if (db.NewInstall) { string msg = "Hello! It seems like this is your first execution of ExploScripts. I will now install " + "ExploScripts in this folder. That means all your scripts and templates will be stored here. " + "It is recommended to install ExploScripts in an own folder inside your Documents folder.\nDo you want to continue?"; MessageBoxResult res = MessageBox.Show(msg, "Installation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.No) { Environment.Exit(0); } } db.Initialize(); dataGrid.ItemsSource = db.Scripts; cmh = new ContextMenuHandler(db.Scripts); }
private void Control_MouseClick(object sender, swf.MouseEventArgs e) { var menu = ContextMenuHandler.GetControl(Menu); if (menu != null && e.Button.HasFlag(swf.MouseButtons.Right)) { // TODO: Close tray menu when clicked outside // https://weblogs.asp.net/marianor/a-wpf-wrapper-around-windows-form-notifyicon menu.IsOpen = true; } }
private void InitializeControl() { var contextMenuHandler = new ContextMenuHandler(); var dialogHandler = new DialogHandler(); var displayHandler = new DisplayHandler(); var downloadLogger = logger.CloneFor($"{nameof(DownloadHandler)} #{Id}"); var downloadHandler = new DownloadHandler(appConfig, downloadLogger, settings, WindowSettings); var keyboardHandler = new KeyboardHandler(); var lifeSpanHandler = new LifeSpanHandler(); var requestFilter = new RequestFilter(); var requestLogger = logger.CloneFor($"{nameof(RequestHandler)} #{Id}"); var resourceHandler = new ResourceHandler(appConfig, requestFilter, logger, settings, WindowSettings, text); var requestHandler = new RequestHandler(appConfig, requestFilter, requestLogger, resourceHandler, settings, WindowSettings, text); Icon = new BrowserIconResource(); dialogHandler.DialogRequested += DialogHandler_DialogRequested; displayHandler.FaviconChanged += DisplayHandler_FaviconChanged; displayHandler.ProgressChanged += DisplayHandler_ProgressChanged; downloadHandler.ConfigurationDownloadRequested += DownloadHandler_ConfigurationDownloadRequested; downloadHandler.DownloadUpdated += DownloadHandler_DownloadUpdated; keyboardHandler.FindRequested += KeyboardHandler_FindRequested; keyboardHandler.HomeNavigationRequested += HomeNavigationRequested; keyboardHandler.ReloadRequested += ReloadRequested; keyboardHandler.ZoomInRequested += ZoomInRequested; keyboardHandler.ZoomOutRequested += ZoomOutRequested; keyboardHandler.ZoomResetRequested += ZoomResetRequested; lifeSpanHandler.PopupRequested += LifeSpanHandler_PopupRequested; resourceHandler.SessionIdentifierDetected += (id) => SessionIdentifierDetected?.Invoke(id); requestHandler.QuitUrlVisited += RequestHandler_QuitUrlVisited; requestHandler.RequestBlocked += RequestHandler_RequestBlocked; InitializeRequestFilter(requestFilter); control = new BrowserControl( contextMenuHandler, dialogHandler, displayHandler, downloadHandler, keyboardHandler, lifeSpanHandler, requestHandler, startUrl); control.AddressChanged += Control_AddressChanged; control.LoadFailed += Control_LoadFailed; control.LoadingStateChanged += Control_LoadingStateChanged; control.TitleChanged += Control_TitleChanged; control.Initialize(); logger.Debug("Initialized browser control."); }
public void ShowContextMenu() { if (contextMenu != null) { Vector3 position = GetContextMenuPostion(); contextMenuInstance = Instantiate(contextMenu, position, Quaternion.identity); contextMenuHandler = contextMenuInstance.GetComponent <ContextMenuHandler>(); return; } return; }
public override void ViewDidLoad() { base.ViewDidLoad(); _customTitleView = new ConnectionStatusView(CGRect.Empty); TableNode = new ASTableNode(UITableViewStyle.Grouped); Table = TableNode.View; Input = new ChatInputView() { TranslatesAutoresizingMaskIntoConstraints = false }; Input.Init(this); CustomNavigationItem.AddTitleView(_customTitleView); CustomNavigationItem.SetCommand( UIImage.FromBundle(StyleHelper.Style.BackButtonBundleName), ViewModel.BackCommand, true); if (ViewModel.HasInfo) { CustomNavigationItem.SetCommand( UIImage.FromBundle(StyleHelper.Style.ChatDetailsButtonBundleName), ViewModel.ShowInfoCommand, false); } MainView.InsertSubview(Table, 1); InitTableView(); _contextMenuHandler = new ContextMenuHandler <ChatMessageViewModel>(CreateContextMenuComponentForViewModel); Input.EditingCloseButton.SetCommand(ViewModel.MessageInput.CancelEditingCommand); Input.OpenCameraButton.SetCommand(ViewModel.MessageInput.OpenCameraCommand); Input.OpenGalleryButton.SetCommand(ViewModel.MessageInput.OpenGalleryCommand); Input.SendButton.SetCommand(ViewModel.MessageInput.SendMessageCommand); Input.DeleteButton.SetCommand(ViewModel.MessageInput.DeleteImageCommand); Input.SetLabels( ViewModel.MessageInput.EditMessageHeaderString, ViewModel.MessageInput.EnterMessagePlaceholderString); ScrollToBottomButton.SetCommand(new RelayCommand(() => ScrollToBottom(true))); ScrollToBottomButton.SetBackgroundImage(UIImage.FromBundle(StyleHelper.Style.ScrollDownBoundleName), UIControlState.Normal); }
private void InitializeControl() { var contextMenuHandler = new ContextMenuHandler(); var displayHandler = new DisplayHandler(); var downloadLogger = logger.CloneFor($"{nameof(DownloadHandler)} {Id}"); var downloadHandler = new DownloadHandler(appConfig, settings, downloadLogger); var keyboardHandler = new KeyboardHandler(); var lifeSpanHandler = new LifeSpanHandler(); var requestFilter = new RequestFilter(); var requestLogger = logger.CloneFor($"{nameof(RequestHandler)} {Id}"); var requestHandler = new RequestHandler(appConfig, settings.Filter, requestFilter, requestLogger, text); displayHandler.FaviconChanged += DisplayHandler_FaviconChanged; displayHandler.ProgressChanged += DisplayHandler_ProgressChanged; downloadHandler.ConfigurationDownloadRequested += DownloadHandler_ConfigurationDownloadRequested; keyboardHandler.ReloadRequested += ReloadRequested; keyboardHandler.ZoomInRequested += ZoomInRequested; keyboardHandler.ZoomOutRequested += ZoomOutRequested; keyboardHandler.ZoomResetRequested += ZoomResetRequested; lifeSpanHandler.PopupRequested += LifeSpanHandler_PopupRequested; requestHandler.RequestBlocked += RequestHandler_RequestBlocked; if (settings.Filter.ProcessContentRequests || settings.Filter.ProcessMainRequests) { var factory = new RuleFactory(); foreach (var settings in settings.Filter.Rules) { var rule = factory.CreateRule(settings.Type); rule.Initialize(settings); requestFilter.Load(rule); } logger.Debug($"Initialized request filter with {settings.Filter.Rules.Count} rule(s)."); } control = new BrowserControl(contextMenuHandler, displayHandler, downloadHandler, keyboardHandler, lifeSpanHandler, requestHandler, url); control.AddressChanged += Control_AddressChanged; control.LoadingStateChanged += Control_LoadingStateChanged; control.TitleChanged += Control_TitleChanged; control.Initialize(); logger.Debug("Initialized browser control."); }
void _RegisterContextMenu(string[] contextmenupath, ContextMenuHandler handler) { MenuItem commanditem = null; //LogFile.WriteLine("scan existing:"); Menu currentmenu = contextmenu; for (int i = 0; i < contextmenupath.Length - 1; i++) { bool foundpathsegment = false; string thissegment = contextmenupath[i].Replace("&", "_"); foreach (Widget widget in currentmenu.Children) { //LogFile.WriteLine(widget.GetType()); foreach (Widget subwidget in (widget as MenuItem).Children) { //LogFile.WriteLine(subwidget.GetType()); string thismenulabel = (subwidget as AccelLabel).Text; //LogFile.WriteLine(thismenulabel + " " + thissegment); if (thismenulabel == thissegment.Replace("_", "")) { foundpathsegment = true; currentmenu = (widget as MenuItem).Submenu as Menu; } } } if (!foundpathsegment) { MenuItem nextmenuitem = new MenuItem(thissegment); currentmenu.Add(nextmenuitem); Menu nextmenu = new Menu(); nextmenuitem.Submenu = nextmenu; currentmenu = nextmenu; } } commanditem = new MenuItem(contextmenupath[contextmenupath.Length - 1].Replace("&", "_")); currentmenu.Add(commanditem); commanditem.Activated += new EventHandler(_ContextMenuClick); contextmenucommanditems.Add(commanditem); contextmenucallbacks.Add(handler); }
internal void Initialize() { var contextMenuHandler = new ContextMenuHandler(); var displayHandler = new DisplayHandler(); var downloadLogger = logger.CloneFor($"{nameof(DownloadHandler)} {Id}"); var downloadHandler = new DownloadHandler(appConfig, settings, downloadLogger); var keyboardHandler = new KeyboardHandler(); var lifeSpanHandler = new LifeSpanHandler(); var requestHandler = new RequestHandler(appConfig); displayHandler.FaviconChanged += DisplayHandler_FaviconChanged; displayHandler.ProgressChanged += DisplayHandler_ProgressChanged; downloadHandler.ConfigurationDownloadRequested += DownloadHandler_ConfigurationDownloadRequested; keyboardHandler.ReloadRequested += ReloadRequested; keyboardHandler.ZoomInRequested += ZoomInRequested; keyboardHandler.ZoomOutRequested += ZoomOutRequested; keyboardHandler.ZoomResetRequested += ZoomResetRequested; lifeSpanHandler.PopupRequested += LifeSpanHandler_PopupRequested; control = new BrowserControl(contextMenuHandler, displayHandler, downloadHandler, keyboardHandler, lifeSpanHandler, requestHandler, url); control.AddressChanged += Control_AddressChanged; control.LoadingStateChanged += Control_LoadingStateChanged; control.TitleChanged += Control_TitleChanged; control.Initialize(); logger.Debug("Initialized browser control."); window = uiFactory.CreateBrowserWindow(control, settings, isMainInstance); window.Closing += () => Terminated?.Invoke(Id); window.AddressChanged += Window_AddressChanged; window.BackwardNavigationRequested += Window_BackwardNavigationRequested; window.DeveloperConsoleRequested += Window_DeveloperConsoleRequested; window.ForwardNavigationRequested += Window_ForwardNavigationRequested; window.ReloadRequested += ReloadRequested; window.ZoomInRequested += ZoomInRequested; window.ZoomOutRequested += ZoomOutRequested; window.ZoomResetRequested += ZoomResetRequested; window.UpdateZoomLevel(CalculateZoomPercentage()); logger.Debug("Initialized browser window."); }
protected override void OnCreate(Bundle savedInstanceState) { OverridePendingTransition(0, 0); SetTheme(StyleHelper.Style.CommonActivityStyle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_chat_conversations); _navigationBarView = FindViewById <NavigationBarView>(Resource.Id.activity_chat_conversations_navigation_bar); _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, ViewModel.BackCommand); if (ViewModel.HasInfo) { _navigationBarView.SetRightButton(StyleHelper.Style.NavigationBarDetailsButtonIcon, ViewModel.ShowInfoCommand); } _conversationsRecyclerView = FindViewById <RecyclerView>(Resource.Id.rv_conversations_list); _scrollDownImageButton = FindViewById <ImageButton>(Resource.Id.ib_conversations_scroll_down); _scrollDownImageButton.SetImageResource(StyleHelper.Style.ScrollDownButtonIcon); _chatInputView = FindViewById <ChatInputView>(Resource.Id.ll_chat_input_view); InitializeConversationsRecyclerView(); _contextMenuHandler = new ContextMenuHandler <ChatMessageViewModel>(itemViewModel => { var commandActions = ViewModel.GetCommandActionsForMessage(itemViewModel); return(new ContextMenuComponent(commandActions)); }); _scrollDownImageButton.SetCommand(nameof(_scrollDownImageButton.Click), new RelayCommand(ScrollToBottom)); ViewModel.MessageAddedCommand = new RelayCommand(ScrollToBottomIfNeeded); }
public static NSMenu ToNS(this ContextMenu menu) => ContextMenuHandler.GetControl(menu);
// This context menu function creates a persistent contextmenu. This is good for things like Quit public void RegisterPersistentContextMenu(string[] contextmenupath, ContextMenuHandler callback) { UIController.GetInstance().contextmenu.RegisterPersistentContextMenu(contextmenupath, callback); }
public static Gtk.Menu ToGtk(this ContextMenu menu) => ContextMenuHandler.GetControl(menu);
public void Initialize() { sut = new ContextMenuHandler(); }
public void RegisterContextMenu( string[] contextmenupath, ContextMenuHandler callback ) { _RegisterContextMenu( contextmenupath, callback ); }
public void RegisterPersistentContextMenu(string[] contextmenupath, ContextMenuHandler callback) { persistentcontextmenupaths.Add(contextmenupath); persistentcontextmenucallbacks.Add(callback); }
public void RegisterContextMenu(string[] contextmenupath, ContextMenuHandler callback) { _RegisterContextMenu(contextmenupath, callback); }
void _RegisterContextMenu(string[] contextmenupath, ContextMenuHandler handler) { MenuItem commanditem = null; //LogFile.WriteLine("scan existing:"); Menu currentmenu = contextmenu; for (int i = 0; i < contextmenupath.Length - 1; i++) { bool foundpathsegment = false; string thissegment = contextmenupath[i].Replace("&", "_"); foreach (Widget widget in currentmenu.Children) { //LogFile.WriteLine(widget.GetType()); foreach (Widget subwidget in (widget as MenuItem).Children) { //LogFile.WriteLine(subwidget.GetType()); string thismenulabel = (subwidget as AccelLabel).Text; //LogFile.WriteLine(thismenulabel + " " + thissegment); if (thismenulabel == thissegment.Replace("_","")) { foundpathsegment = true; currentmenu = (widget as MenuItem).Submenu as Menu; } } } if (!foundpathsegment) { MenuItem nextmenuitem = new MenuItem(thissegment); currentmenu.Add(nextmenuitem); Menu nextmenu = new Menu(); nextmenuitem.Submenu = nextmenu; currentmenu = nextmenu; } } commanditem = new MenuItem(contextmenupath[contextmenupath.Length - 1].Replace("&","_") ); currentmenu.Add(commanditem); commanditem.Activated += new EventHandler(_ContextMenuClick); contextmenucommanditems.Add(commanditem); contextmenucallbacks.Add(handler); }
/// <summary> /// this is done just once, to globally initialize CefSharp/CEF /// </summary> private void InitBrowser() { CefSettings settings = new CefSettings(); settings.Locale = "zh_CN"; settings.CachePath = System.IO.Directory.GetCurrentDirectory() + @"/BrowserCache"; settings.AcceptLanguageList = "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3"; settings.LocalesDirPath = System.IO.Directory.GetCurrentDirectory() + @"/localeDir"; settings.LogFile = System.IO.Directory.GetCurrentDirectory() + @"/LogData"; settings.PersistSessionCookies = true; settings.UserDataPath = System.IO.Directory.GetCurrentDirectory() + @"/UserData"; settings.UserAgent = UserAgent; settings.IgnoreCertificateErrors = true; Cef.Initialize(settings); dHandler = new DownloadHandler(this); lHandler = new LifeSpanHandler(this); mHandler = new ContextMenuHandler(this); kHandler = new KeyboardHandler(this); rHandler = new RequestHandler(this); host = new HostHandler(this); AddNewBrowser(CefFaTabStripItem, HomepageURL); }