Example #1
0
        public PushDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            _repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                _pushToInput = new RadioButtonGroupInputSource <PushTo>(
                    new[]
                {
                    Tuple.Create(_radRemote, gitter.Git.Gui.Interfaces.PushTo.Remote),
                    Tuple.Create(_radUrl, gitter.Git.Gui.Interfaces.PushTo.Url),
                }),
                _remoteInput         = PickerInputSource.Create(_remotePicker),
                _urlInput            = new TextBoxInputSource(_txtUrl),
                _referencesInput     = new BranchesInputSource(_lstReferences),
                _forceOverwriteInput = new CheckBoxInputSource(_chkForceOverwriteBranches),
                _thinPackInput       = new CheckBoxInputSource(_chkUseThinPack),
                _sendTagsInput       = new CheckBoxInputSource(_chkSendTags),
            };

            _errorNotifier = new UserInputErrorNotifier(NotificationService, inputs);


            _picWarning.Image = CachedResources.Bitmaps["ImgWarning"];

            _lstReferences.LoadData(_repository, ReferenceType.LocalBranch, false, false, null);
            _lstReferences.EnableCheckboxes();

            if (!_repository.Head.IsDetached)
            {
                foreach (BranchListItem item in _lstReferences.Items)
                {
                    if (item.DataContext == _repository.Head.Pointer)
                    {
                        item.CheckedState = CheckedState.Checked;
                        break;
                    }
                }
            }

            _remotePicker.LoadData(repository);
            Remote remote = null;

            lock (repository.Remotes.SyncRoot)
            {
                foreach (var r in repository.Remotes)
                {
                    remote = r;
                    break;
                }
            }
            _remotePicker.SelectedValue = remote;

            _controller = new PushController(repository)
            {
                View = this
            };
        }