public override void OnEnable() { base.OnEnable(); minSize = maxSize = ActiveView.Size; ActiveView.OnEnable(); }
public override void OnFocusChanged() { if (ActiveView != null) { ActiveView.OnFocusChanged(); } }
public override void OnDisable() { base.OnDisable(); if (ActiveView != null) { ActiveView.OnDisable(); } }
public override void OnSelectionChange() { base.OnSelectionChange(); if (ActiveView != null) { ActiveView.OnSelectionChange(); } }
public override void OnDataUpdate() { base.OnDataUpdate(); MaybeUpdateData(); if (ActiveView != null) ActiveView.OnDataUpdate(); }
/// <summary> /// Perform double click processing. /// </summary> /// <param name="pt">Control coordinates point.</param> public virtual void DoubleClick(Point pt) { // If there is an active element ActiveView?.DoubleClick(pt); // Generate event to indicate the view manager has processed a mouse up DoubleClickProcessed?.Invoke(this, pt); }
private void ExecuteKeyboard(EventTranscriptionParameter <KeyEventArgs> parameter) { var args = parameter.EventArgs; parameter.EventArgs.Handled = true; if (parameter.EventArgs.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && parameter.EventArgs.KeyboardDevice.IsKeyDown(Key.T)) { AddNewDirectoryView(); } else if (parameter.EventArgs.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && parameter.EventArgs.KeyboardDevice.IsKeyDown(Key.W)) { ExecuteCloseTab(ActiveView); } else if (args.KeyboardDevice.IsKeyDown(Key.LeftCtrl)) { args.Handled = false; } else if (parameter.EventArgs.Key == Key.Enter && ActiveView.SelectedItem != null && ActiveView.SelectedItem.IsDirectory) { ActiveView.LoadSelectedDirectory(); } else if (parameter.EventArgs.Key == Key.Enter && ActiveView.SelectedItem != null && ActiveView.SelectedItem.IsMoveUp && !PathExt.IsDriveRoot(ActiveView.FullPath)) { ActiveView.MoveUp(); } else if (parameter.EventArgs.Key == Key.Back && ActiveView.SearchText.IsNotNullAndNotEmpty()) { ActiveView.SearchText = ActiveView.SearchText.Remove(ActiveView.SearchText.Length - 1); } else if (parameter.EventArgs.Key == Key.Back && !PathExt.IsDriveRoot(ActiveView.FullPath)) { ActiveView.MoveUp(); } else if (parameter.EventArgs.Key == Key.Enter && ActiveView.IsOneFileSelected) { ActiveView.ExecuteFile(ActiveView.SelectedItem); } else { char keyID = Utility.ConvertKeyToChar(parameter.EventArgs.Key); if (keyID != char.MinValue) { if (char.IsLetterOrDigit(keyID)) { ActiveView.SearchText = ActiveView.SearchText + keyID.ToString(); } else if (parameter.EventArgs.Key == Key.Space)//TODO: Handle space { ActiveView.SearchText = ActiveView.SearchText + " "; } } else { parameter.EventArgs.Handled = false; } } }
public override void OnDataUpdate() { base.OnDataUpdate(); if (titleContent.image == null) { titleContent = new GUIContent(ActiveView.Title, Styles.SmallLogo); } ActiveView.OnDataUpdate(); }
public override void Refresh() { base.Refresh(); if (ActiveView != null) { ActiveView.Refresh(); } Repaint(); }
public override void Refresh() { SetProgressMessage(Localization.MessageRefreshing, 0); base.Refresh(); if (ActiveView != null) ActiveView.Refresh(); Refresh(CacheType.GitLocks); Redraw(); }
public override void Refresh() { SetProgressMessage(Localization.MessageRefreshing, 0); base.Refresh(); if (ActiveView != null) { ActiveView.Refresh(); } Redraw(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Shows the Format Apply Style dialog. Apply the results to the selection of the active /// view if the user clicks OK. /// </summary> /// <param name="paraStyleName">Name of the para style.</param> /// <param name="charStyleName">Name of the char style.</param> /// <param name="maxStyleLevel">The maximum style level that will be shown in this /// dialog. (apps that do not use style levels in their stylesheets can pass 0)</param> /// ------------------------------------------------------------------------------------ public void ShowApplyStyleDialog(string paraStyleName, string charStyleName, int maxStyleLevel) { SimpleRootSite rootsite = (ActiveView as SimpleRootSite); try { if (rootsite != null) { rootsite.ShowRangeSelAfterLostFocus = true; } int hvoRoot, frag; IVwViewConstructor vc; IVwStylesheet ss; ActiveView.CastAsIVwRootSite().RootBox.GetRootObject(out hvoRoot, out vc, out frag, out ss); using (FwApplyStyleDlg applyStyleDlg = new FwApplyStyleDlg(ActiveView.CastAsIVwRootSite(), Cache, StyleSheet.RootObjectHvo, StyleSheetOwningFlid, StyleSheet.GetDefaultBasedOnStyleName(), maxStyleLevel, paraStyleName, charStyleName, hvoRoot, FwApp.App, FwApp.App)) { if (FwEditingHelper != null) { if (FwEditingHelper.ApplicableStyleContexts != null) { applyStyleDlg.ApplicableStyleContexts = FwEditingHelper.ApplicableStyleContexts; } } else if (FwApp.App != null) { // Window doesn't have an editing helper, go with whole-app default if (FwApp.App.DefaultStyleContexts != null) { applyStyleDlg.ApplicableStyleContexts = FwApp.App.DefaultStyleContexts; } } applyStyleDlg.AllowSelectStyleTypes = m_callbacks.ShowSelectStylesComboInStylesDialog; IVwSelection sel = EditingHelper.CurrentSelection.Selection; applyStyleDlg.CanApplyCharacterStyle = sel.CanFormatChar; applyStyleDlg.CanApplyParagraphStyle = sel.CanFormatPara; if (applyStyleDlg.ShowDialog(m_callbacks) == DialogResult.OK) { EditingHelper.ApplyStyle(applyStyleDlg.StyleChosen); } } } finally { if (rootsite != null) { rootsite.ShowRangeSelAfterLostFocus = false; } } }
public override void OnRepositoryChanged(IRepository oldRepository) { base.OnRepositoryChanged(oldRepository); DetachHandlers(oldRepository); AttachHandlers(Repository); if (ActiveView != null) { ActiveView.OnRepositoryChanged(oldRepository); } }
/// <summary> /// Perform lost focus handling. /// </summary> public virtual void LostFocus() { // Tell current view of source event if (ActiveView != null) { ActiveView.LostFocus(_control); } else if (_root != null) { _root.LostFocus(_control); } }
/// <summary> /// Perform key down handling. /// </summary> /// <param name="e">A KeyEventArgs that contains the event data.</param> public virtual void KeyDown(KeyEventArgs e) { // Tell current view of key event if (ActiveView != null) { ActiveView.KeyDown(e); } else { _root?.KeyDown(e); } }
/// <summary> /// Perform key press handling. /// </summary> /// <param name="e">A KeyPressEventArgs that contains the event data.</param> public virtual void KeyPress(KeyPressEventArgs e) { // Tell current view of key event if (ActiveView != null) { ActiveView.KeyPress(e); } else if (_root != null) { _root.KeyPress(e); } }
/// <summary> /// Perform key up handling. /// </summary> /// <param name="e">A KeyEventArgs that contains the event data.</param> public virtual void KeyUp(KeyEventArgs e) { // Tell current view of key event if (ActiveView != null) { MouseCaptured = ActiveView.KeyUp(e); } else if (_root != null) { MouseCaptured = _root.KeyUp(e); } }
/// <summary> /// Perform got focus handling. /// </summary> public virtual void GotFocus() { // Tell current view of source event if (ActiveView != null) { ActiveView.GotFocus(_control); } else { _root?.GotFocus(_control); } }
/// <summary> /// Executes when Close button of Production/Test view is pressed /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void _onViewClosing(object sender, System.ComponentModel.CancelEventArgs args) { try { // Set active view _activeView = ActiveView.Desktop; } catch (System.Exception ex) { Debug.Assert(false, "_onViewClosing failed with message: ", ex.ToString()); } }
public PresenterLayoutDocument(ActiveView view) { View = view; this.Content = view.View; var viewActivityInfo = view.Activity.ActivityInfo as ViewActivityInfo; this.Title = viewActivityInfo?.Title; this.CanClose = viewActivityInfo?.IsCloseable ?? true; var viewContainerAware = view.Presenter as IViewContainerAware; if (viewContainerAware != null) { viewContainerAware.ViewContainerService = this; } }
/// <summary> /// Perform double click processing. /// </summary> /// <param name="pt">Control coordinates point.</param> public virtual void DoubleClick(Point pt) { // If there is an active element if (ActiveView != null) { ActiveView.DoubleClick(pt); } // Generate event to indicate the view manager has processed a mouse up if (DoubleClickProcessed != null) { DoubleClickProcessed(this, pt); } }
public override void OnEnable() { base.OnEnable(); if (Repository != null) ValidateCachedData(Repository); if (ActiveView != null) ActiveView.OnEnable(); if (spinner == null) spinner = new Spinner(); ClearProgressMessage(); }
public override void OnUI() { base.OnUI(); if (HasRepository) { DoHeaderGUI(); } DoToolbarGUI(); var rect = GUILayoutUtility.GetLastRect(); // GUI for the active tab if (ActiveView != null) { ActiveView.OnGUI(); } if (IsBusy && activeTab != SubTab.Settings && Event.current.type == EventType.Repaint) { if (timeSinceLastRotation < 0) { timeSinceLastRotation = EditorApplication.timeSinceStartup; } else { var elapsedTime = (float)(EditorApplication.timeSinceStartup - timeSinceLastRotation); if (spinner == null) { spinner = new Spinner(); } spinner.Start(elapsedTime); spinner.Rotate(elapsedTime); spinner.Render(); rect = new Rect(0f, rect.y + rect.height, Position.width, Position.height - (rect.height + rect.y)); rect = spinner.Layout(rect); rect.y += rect.height + 30; rect.height = 20; if (!String.IsNullOrEmpty(progressMessage)) { EditorGUI.ProgressBar(rect, progressValue / 100, progressMessage); } } } }
public override void OnEnable() { base.OnEnable(); #if DEVELOPER_BUILD Selection.activeObject = this; #endif // Set window title titleContent = new GUIContent(Title, Styles.SmallLogo); if (ActiveView != null) { ActiveView.OnEnable(); } }
private void LoadPath(IDirectoryViewItem toLoad) { if (toLoad == null) { return; } if (!ActiveView.FileSystem.IsWindowsFileSystem) { ActiveView.ChangeFileSystem(new WindowsFileSystem(toLoad.FullName)); } else { ActiveView.LoadDirectory(toLoad.FullName); } }
public override void OnUI() { base.OnUI(); if (HasRepository) { DoHeaderGUI(); } DoToolbarGUI(); // GUI for the active tab if (ActiveView != null) { ActiveView.OnGUI(); } }
public override void OnEnable() { base.OnEnable(); #if DEVELOPER_BUILD Selection.activeObject = this; #endif if (Repository != null) { Repository.CheckCurrentBranchAndRemoteChangedEvent(lastCurrentBranchAndRemoteChangedEvent); } if (ActiveView != null) { ActiveView.OnEnable(); } }
/// <summary> /// Perform mouse movement handling. /// </summary> /// <param name="e">A MouseEventArgs that contains the event data.</param> /// <param name="rawPt">The actual point provided from the windows message.</param> public virtual void MouseMove(MouseEventArgs e, Point rawPt) { Debug.Assert(e != null); // Validate incoming reference if (e == null) { throw new ArgumentNullException(nameof(e)); } Point pt = new Point(e.X, e.Y); // Set the correct active view from the point UpdateViewFromPoint(_control, pt); // Tell current view of mouse movement ActiveView?.MouseMove(rawPt); }
public void SetView(string to) { if (!_views.ContainsKey(to)) { Debug.LogWarning("<color=yellow>[ViewManagement] SetView() -> No view with key '" + to + "' was found.</color>"); return; } if (ActiveView) { ActiveView.Deactivate(); ActiveView.gameObject.SetActive(false); } ActiveView = _views[to]; ActiveView.gameObject.SetActive(true); ActiveView.Activate(); }
public virtual void OpenFile(String filePath) { Analytics.TrackEvent(nameof(OpenFile), new Dictionary <string, string> { { "filePath", Path.GetFileName(filePath) } }); var extension = System.IO.Path.GetExtension(filePath).ToLowerInvariant(); if (extension == Strings.CRUISE_FILE_EXTENTION || extension == Strings.CRUISE_TEMPLATE_FILE_EXTENTION) { InitializeDAL(filePath); } else { ActiveView.ShowMessage("Invalid file name", null); } }
public void SwitchToView(ActiveView active, int x = 5, int y = 5) { this.dynContentsView.Children.Clear(); UserControl activeView = null; switch (active) { case ActiveView.HomeView: if (viewHome == null) { viewHome = new Views.HomeView(); } activeView = viewHome; break; case ActiveView.DataAdminView: if (viewDataAdmin == null) { viewDataAdmin = new Views.DataAdminView(); } activeView = viewDataAdmin; break; case ActiveView.ReportView: if (viewReport == null) { viewReport = new Views.ReportsViewHost(); } activeView = viewReport; break; case ActiveView.SysAdminView: if (viewSysAdmin == null) { viewSysAdmin = new Views.SysAdminView(); } activeView = viewSysAdmin; break; } Canvas.SetTop(activeView, x); Canvas.SetLeft(activeView, y); //这两句很关键。按钮在Canvas中的定位与它自己的Left以及Top不是一个概念 this.dynContentsView.Children.Add(activeView); }