public void setCurentList(ObservableCollection <Obj> listObjCurent) { try { ListObjectCurent.Clear(); IComparer <Obj> comparer = new MyOrderingObjClass(); List <Obj> objs = listObjCurent.ToList(); if (objs != null && objs.Count > 1) { objs.Sort(comparer); } foreach (Obj obj in objs) { ListObjectCurent.Add(obj); } if (_listObjHasSynch == null) { _listObjHasSynch = new ObservableCollection <Obj>(); } OnPropertyChanged(nameof(ListObjectCurent)); OnPropertyChanged(nameof(ListObjBelowLocal)); OnPropertyChanged(nameof(ListObjHasSynch)); OnPropertyChanged(nameof(ListObjOnStack)); CurentView = _document.ActiveView; _curentSelectedObj = null; } catch { if (UserView != null) { UserView.Dispose(); } } }
private void SetColorButton(bool isSynchEnable, bool isNewEnable, bool isOnserverEnable) { try { BackgroundSynchronizedColor = _lightBrush; BackgroundNewColor = _lightBrush; BackgroundOnseverColor = _lightBrush; if (isSynchEnable) { BackgroundSynchronizedColor = _darkBrush; } if (isNewEnable) { BackgroundNewColor = _darkBrush; } if (isOnserverEnable) { BackgroundOnseverColor = _darkBrush; } OnPropertyChanged(nameof(BackgroundSynchronizedColor)); OnPropertyChanged(nameof(BackgroundNewColor)); OnPropertyChanged(nameof(BackgroundOnseverColor)); } catch { UserView.Dispose(); } }
private void DisconectAllCommandInvoke(object obj) { try { foreach (Obj item in ListObjectCurent) { if (item.IsSelected == true) { item._comparisonCoupleElement.Action = OpeningClient.Model.Action.DISCONNECT; item.CurrentAction = item.ObjActions.Where(x => x.Name.Equals("DISCONNECT")).First() as StatusItem; OnPropertyChanged(nameof(item.CurrentAction)); } } if (IsSynch) { setCurentList(ListObjHasSynch); } if (IsOnServer) { setCurentList(ListObjOnStack); } if (IsSynch == false && IsOnServer == false) { setCurentList(ListObjBelowLocal); } OnPropertyChanged(nameof(ListObjectCurent)); } catch { UserView.Dispose(); } }
private void OnServerCommandInvoke(object obj) { Transaction transaction = new Transaction(_document); try { if (IsSynch) { Ultil.VisibilityElement(_document, CurentView, RevitElementId, false); } IsPushAllow = false; OnPropertyChanged(nameof(IsPushAllow)); IsPullAllow = true; OnPropertyChanged(nameof(IsPullAllow)); SelectedObj = null; Ultil.HightLight(transaction, _document, CurentView.Id, _stateUniquId, false); PreviewVisibility = false; OnPropertyChanged(nameof(PreviewVisibility)); IsSynch = false; IsOther = true; IsOnServer = true; OnPropertyChanged(nameof(IsSynch)); OnPropertyChanged(nameof(IsOther)); OnPropertyChanged(nameof(IsOnServer)); Ultil.ClearUniqueIdState(transaction, _document, ref _stateUniquId); setCurentList(ListObjOnStack); SetColorButton(false, false, true); OnPropertyChanged(nameof(Visible)); } catch { UserView.Dispose(); transaction.RollBack(); } }
private void SendCommandInvoke(object obj) { try { Comment += "\n" + _username + " :" + CurentComment; Obj selectedObject = _selectedObj as Obj; selectedObject.Comment = Comment; CurentComment = ""; OnPropertyChanged(nameof(Comment)); OnPropertyChanged(nameof(CurentComment)); } catch { UserView.Dispose(); } }
private void CurentPreviewInvoke(object obj) { Transaction transaction = new Transaction(_document); try { Ultil.ClearUniqueIdState(transaction, _document, ref _stateUniquId); Ultil.VisibilityElement(_document, CurentView, RevitElementId, false); Ultil.HightLight(transaction, _document, CurentView.Id, RevitElementId, true); } catch { UserView.Dispose(); transaction.RollBack(); } }
private void InitCommand() { try { // MouseDownCommand = new RelayCommand<object>(ListObj_MouseDownCommandInvoke); SynchCommand = new RelayCommand <object>(SynchCommandInvoke); NewCommand = new RelayCommand <object>(NewCommandInvoke); OnServerCommand = new RelayCommand <object>(OnServerCommandInvoke); CurentPreview = new RelayCommand <object>(CurentPreviewInvoke); LastestPreview = new RelayCommand <object>(LastestPreviewInvoke); //SwitchSynchronizedCommand = new RelayCommand<object>(SwitchSynchronizedCommandInvoke); PullAllCommand = new RelayCommand <object>(PullAllCommandInvoke); PushAllCommand = new RelayCommand <object>(PushAllCommandInvoke); DisconectAllCommand = new RelayCommand <object>(DisconectAllCommandInvoke); NoneAllCommand = new RelayCommand <object>(NoneAllCommandInvoke); CloseComand = new RelayCommand <object>(CloseComandInvoke); SendCommand = new RelayCommand <object>(SendCommandInvoke); } catch { UserView.Dispose(); } }
private void LastestPreviewInvoke(object obj) { Transaction transaction = new Transaction(_document); try { Ultil.HightLight(transaction, _document, CurentView.Id, RevitElementId, false); Ultil.VisibilityElement(_document, CurentView, RevitElementId, true); Ultil.ClearUniqueIdState(transaction, _document, ref _stateUniquId); Obj selectedObject = SelectedObj as Obj; _stateUniquId = Ultil.CreateOpening(transaction, _document, _catergoryName, selectedObject); if (_stateUniquId == "") { MessageBox.Show("Can't create this opening. Maybe this opening is not intersect with Wall"); } Ultil.HightLight(transaction, _document, CurentView.Id, _stateUniquId, true); } catch { UserView.Dispose(); transaction.RollBack(); } //RevitElementId }
private void SynchCommandInvoke(object obj) { Transaction transaction = new Transaction(_document); try { transaction.Start("Synch"); if (IsSynch) { Ultil.VisibilityElement(_document, CurentView, RevitElementId, false); } IsPushAllow = true; IsPullAllow = true; SelectedIndex = -1; SelectedObj = null; Ultil.HightLight(transaction, _document, CurentView.Id, _stateUniquId, false); PreviewVisibility = true; OnPropertyChanged(nameof(PreviewVisibility)); IsSynch = true; IsOther = false; IsOnServer = false; Ultil.ClearUniqueIdState(transaction, _document, ref _stateUniquId); setCurentList(ListObjHasSynch); SetColorButton(true, false, false); OnPropertyChanged(nameof(ListObjHasSynch)); Visible = System.Windows.Visibility.Collapsed; OnPropertyChanged(nameof(Visible)); OnPropertyChanged(nameof(IsSynch)); OnPropertyChanged(nameof(IsOther)); OnPropertyChanged(nameof(IsOnServer)); OnPropertyChanged(nameof(IsPushAllow)); OnPropertyChanged(nameof(IsPullAllow)); transaction.Commit(); } catch { UserView.Dispose(); transaction.RollBack(); } }