public void UpdateState(ProjectViewMode mode) { //pCommerce.Visibility = ((mode & ProjectViewMode.Commercial) != 0) ? Visibility.Visible : Visibility.Collapsed; //pITO.Visibility = ((mode & ProjectViewMode.ITO) != 0) ? Visibility.Visible : Visibility.Collapsed; //pWH.Visibility = ((mode & ProjectViewMode.Warehouse) != 0) ? Visibility.Visible : Visibility.Collapsed; //pMF.Visibility = ((mode & ProjectViewMode.Manufacture) != 0) ? Visibility.Visible : Visibility.Collapsed; //pOTK.Visibility = ((mode & ProjectViewMode.OTK) != 0) ? Visibility.Visible : Visibility.Collapsed; }
void UpdateState(ProjectViewMode mode) { if (ViewMode == mode) { return; } vMode = mode; try { controlFilter.UpdateState(mode); Project pSelected = null; if (panelContent.Content is IProjectViewControl) { pSelected = ((IProjectViewControl)panelContent.Content).SelectedProject; } //// Очищаем //if (panelContent.Content is IProjectViewControl) // ((IProjectViewControl)panelContent.Content).Unload(); panelContent.Content = null; if (controls.ContainsKey(mode)) { var control = controls[mode]; panelContent.Content = control; if (control is IProjectViewControl) { Title = ((IProjectViewControl)control).Header; ((IProjectViewControl)control).Init(); if (pSelected != null) { ((IProjectViewControl)control).Select(pSelected.ProjectID); } } } } catch (Exception ex) { LogManager.LogError(unit, "Ошибка переключения закладок", ex); } DoPropertyChanged("ViewMode"); }