/// <summary> /// Met à jour la visibilité des colonnes en fonction de la vue. /// </summary> /// <param name="view">La vue.</param> private void UdpateColumnsVisibility(GanttGridView view) { switch (view) { case GanttGridView.WBS: GridBehavior.TryShow(ColumnVideo, view); GridBehavior.TryShow(ColumnTask, view); GridBehavior.TryShow(ColumnDuration, view); GridBehavior.TryShow(ColumnCategory, view); GridBehavior.TryShow(ColumnWBS, view); GridBehavior.TryShow(ColumnResource, view); GridBehavior.TryShow(ColumnPredecessors, view); break; default: GridBehavior.TryShow(ColumnVideo, view); GridBehavior.TryShow(ColumnTask, view); GridBehavior.TryShow(ColumnDuration, view); GridBehavior.TryShow(ColumnCategory, view); GridBehavior.TryHide(ColumnWBS, view); GridBehavior.TryHide(ColumnResource, view); GridBehavior.TryHide(ColumnPredecessors, view); break; } SetupUnlinkMarkersMode(); }
/// <summary> /// Change la vue. /// </summary> /// <param name="view">La vue.</param> protected virtual void ChangeView(GanttGridView view) { if (DesignMode.IsInDesignMode) { ActionsManager.ChangeView(view, this.CurrentActionItem); return; } GridWaitVisibility = Visibility.Visible; Dispatcher.CurrentDispatcher.Invoke((Action)(() => { ActionsManager.ChangeView(view, this.CurrentActionItem); OnPropertyChanged("View"); if (base.EventBus != null) { base.EventBus.Publish(new GridViewChangedEvent(this, view)); } })); GridWaitVisibility = Visibility.Collapsed; ViewContainer = this.Views.First(v => v.View == (int)view); NavigationService.Preferences.GanttGridView = view; }
/// <summary> /// Obtient la visibilité de la colonne spécifiée dans la vue spécifiée. /// </summary> /// <param name="view">La vue.</param> /// <param name="columnName">Le nom de la colonne.</param> /// <returns> /// <c>null</c> si non défini. /// </returns> private bool?GetVisibility(GanttGridView view, string columnName) { if (_columns.ContainsKey(view) && _columns[view].ColumnsVisibilities.ContainsKey(columnName)) { return(_columns[view].ColumnsVisibilities[columnName]); } else { return(null); } }
private DataGridLayout GetViewLayout(GanttGridView view) { if (!_columns.ContainsKey(view)) { _columns[view] = new DataGridLayout { ColumnsVisibilities = new Dictionary <string, bool>(), } } ; return(_columns[view]); }
/// <summary> /// Tente de cacher la colonne spécifiée. /// L'affiche si l'utilisateur ne l'a pas affichée explicitement. /// </summary> /// <param name="column">La colonne.</param> /// <param name="view">La vue.</param> public void TryHide(DataGridColumn column, GanttGridView view) { bool canHide = true; if (!GetCanChangeVisibility(column)) { return; } var columnName = GetId(column); var vis = GetVisibility(view, columnName); if (vis.HasValue && vis.Value) { canHide = false; } _isUpdatingVisibility = true; column.Visibility = canHide ? Visibility.Collapsed : Visibility.Visible; _isUpdatingVisibility = false; }
/// <summary> /// Constructeur /// </summary> /// <param name="sender">objet à l'origine de l'événement</param> /// <param name="action">L'action à exécuter.</param> public GridViewChangedEvent(object sender, GanttGridView view) : base(sender) { this.View = view; }
/// <summary> /// Définit la visibilité de la colonne spécifiée dans la vue spécifiée. /// </summary> /// <param name="view">La vue.</param> /// <param name="columnName">Le nom de la colonne.</param> /// <param name="value">La visibilité.</param> private void SetVisibility(GanttGridView view, string columnName, bool value) { GetViewLayout(view).ColumnsVisibilities[columnName] = value; }