Example #1
0
        private async void ShowPluginWindow(GitUIEventArgs args)
        {
            try
            {
                var module = args.GitModule;

                GitModule gitModule = (GitModule)module;

                var remoteUrl = (await gitModule.GetRemotesAsync()).First().FetchUrl;

                GitModel gitModel = new GitModel(gitModule, args.OwnerForm, (GitUICommands)args.GitUICommands);

                var gitLabAddress = _gitLabAddress.ValueOrDefault(Settings);

                var gitLabKey = _gitLabPrivateKey.ValueOrDefault(Settings);

                var gitFavoriteGroup = _gitLabFavoriteGroup.ValueOrDefault(Settings);

                var gitLabModel = await GitLabModel.CreateAsync(gitLabAddress, gitLabKey, remoteUrl, gitFavoriteGroup);

                var pluginWindow = new PluginWindow
                {
                    DataContext = new MergeRequestsManagerViewModel(gitLabModel, gitModel)
                };

                pluginWindow.Show();
            }
            catch (Exception)
            {
            }
        }
        public MergeRequestsManagerViewModel(GitLabModel gitLabModel, GitModel gitModel)
        {
            _gitLabModel = gitLabModel;
            _gitModel    = gitModel;

            UpdateCommand = new RelayCommand <object>(OnUpdateCommand);

            UpdateMergeRequests();

            UpdatePipeLines();
        }
        public MergeRequestViewModel(MergeRequest mergeRequest, GitModel gitModel, GitLabModel gitLabModel)
        {
            _mergeRequest = mergeRequest;
            _gitModel     = gitModel;
            _gitLabModel  = gitLabModel;

            SwitchToBranchCommand = new RelayCommand <object>(OnSwitchToBranchCommand);

            OpenInBrowserCommand = new RelayCommand <object>(OnOpenInBrowserCommand);

            AcceptMergeRequestCommand = new RelayCommand <object>(OnAcceptMergeRequestCommand, _ => UpVotes >= 1 && DownVotes < 1);
        }