示例#1
0
        public UpdateViewModel()
        {
            UpdateManager.OnUpdateInfoChanged += (sender, args) => Refresh();
            Refresh();

            CheckUpdateCommand = new RelayCommand(UpdateManager.CheckRemoteAsync);
            UpdateCommand = new RelayCommand(UpdateManager.RunUpdate, CanUpdate);
            CloseCommand = new RelayCommand(() => OnRequestClose(true));

            if (!UpdateManager.Working && !UpdateManager.HasData)
                UpdateManager.CheckRemoteAsync();
        }
示例#2
0
        // TODO: add refresh command

        public BubbleViewModel(Repository repo)
            : base(repo)
        {


            ClickCommand = new RelayCommand(ShowHideMenu);
            DblClkCommand = new OpenFolderCommand();
            DblClkCommandParam = repo.Info.WorkingDirectory;
            RefreshCommand = new RelayCommand(Refresh);

            // try compacting path
            string shortPath = repo.Info.WorkingDirectory;
            try
            {
                if (Settings.Default.MenuPathLength > 0)
                    shortPath = PathHelper.ShortDisplay(repo.Info.WorkingDirectory, Settings.Default.MenuPathLength);
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex, false);
                shortPath += " (*)";
            }

            FolderOpenMenuHeader = string.Format("Open {0}", shortPath);
            OpenFolderCommand = new OpenFolderCommand();
            OpenFolderCommandParameter = repo.Info.WorkingDirectory;

            HideAllCommand = new RelayCommand(() => BubblesManager.ShowAll(false), () => { return RepositoriesManager.Repos.Count() > 0; });
            ShowAllCommand = new RelayCommand(() => BubblesManager.ShowAll(true), () => { return RepositoriesManager.Repos.Count() > 0; });
            ExitCommand = new ExitCommand();

            ShowHideMenuCommand = new RelayCommand(ShowHideMenu);

            CurrentBranch = repo.Head.Name;
            var repoTracker = new RepoTracker(repo);
            repoTracker.OnLockFileCreated += (s, e) => { LockExists = true; };
            repoTracker.OnLockFileDeleted += (s, e) => { LockExists = false; };
            repoTracker.OnBranchChanged += (s, e) => { Refresh(); };
            //_repoTracker.OnStatusChanged += repoTracker_OnStatusChanged;

            CommandsListViewModel = new CommandsListViewModel(repo);

            _cmdModel = new CommandsListModel(repo);
            CommandsList = _cmdModel.GetCommandsList;

            ConfigurationHelper.Configuration.Settings.VisualSettings.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "BubbleOpacity")
                    OnPropertyChanged("BubbleOpacity");
            };

        }
示例#3
0
        public RepositoryViewModel(Repository repo)
            : base(repo)
        {
            if (repo != null)
            {
                RepositoryPath = repo.Info.WorkingDirectory;
                OkButtonText = "Set";
                WindowTitle = "Change Repository";
                _isAdding = false;
            }
            else
            {
                OkButtonText = "Add";
                WindowTitle = "Add Repository";
                _isAdding = true;
            }

            OkCommand = new RelayCommand(() => OnCloseCommand(true), IsValidRepository);
            CancelCommand = new RelayCommand(() => OnCloseCommand(false));
            BrowseCommand = new RelayCommand(OnOpenRepository);
            CheckCommand = new RelayCommand(CheckRepository);
        }
示例#4
0
 public void Start(Window view)
 {
     //BubblesManager.ShowView(view, true);
     HideCommand = new RelayCommand(() => BubblesManager.ShowView(view, false));
     view.LocationChanged += (s, e) =>
     {
         if (((BubbleView)s).IsLoaded)
             _flagMoved = true;
         //BubbleView view1 = s as BubbleView;
         //if (view1 != null) Status = string.Format("{0}, {1}", view1.Left.ToString(), view1.Top.ToString());
     };
     
     _flagMoved = false;
 }