Inheritance: NotifyPropertyChangedBase
コード例 #1
0
ファイル: StatusEntryVM.cs プロジェクト: eatplayhate/versionr
        public StatusEntryVM(Status.StatusEntry statusEntry, StatusVM statusVM, Area area)
        {
            StatusEntry = statusEntry;
            m_StatusVM  = statusVM;
            m_Area      = area;

            DiffCommand              = new DelegateCommand(Diff);
            LogCommand               = new DelegateCommand(Log);
            RevertCommand            = new DelegateCommand(() => Load(RevertSelected));
            OpenInExplorerCommand    = new DelegateCommand(OpenInExplorer);
            GeneratePatchFileCommand = new DelegateCommand(GeneratePatchFile);
        }
コード例 #2
0
ファイル: AreaVM.cs プロジェクト: eatplayhate/versionr
        public void Refresh()
        {
            lock (refreshLock)
            {
                // Refresh status
                if (_status == null)
                {
                    // Assume the active directory is the root of the Area
                    _status = new StatusVM(this);
                }
                else
                {
                    _status.Refresh();
                }


                // Refresh branches
                IEnumerable<Branch> branches = _area.Branches.OrderBy(x => x.Terminus.HasValue).ThenBy(x => x.Name);

                MainWindow.Instance.Dispatcher.Invoke(() =>
                {
                    if (_branches == null)
                        _branches = new ObservableCollection<BranchVM>();
                    else
                        _branches.Clear();
                    foreach (Branch branch in branches)
                        _branches.Add(new BranchVM(this, branch));

                    NotifyPropertyChanged("Children");
                });


                // Refresh remotes
                List<RemoteConfig> remotes = _area.GetRemotes();
                MainWindow.Instance.Dispatcher.Invoke(() =>
                {
                    if (_remotes == null)
                        _remotes = new ObservableCollection<RemoteConfig>();
                    else
                        _remotes.Clear();

                    foreach (RemoteConfig remote in remotes)
                        _remotes.Add(remote);

                    if (SelectedRemote == null || !_remotes.Contains(SelectedRemote))
                        SelectedRemote = _remotes.FirstOrDefault();

                    NotifyPropertyChanged("Remotes");
                    NotifyPropertyChanged("SelectedRemote");
                });
            }
        }