Beispiel #1
0
        /// <summary>
        /// Show target dialog</summary>
        /// <returns>Nullable Boolean signifying how window was closed by user</returns>
        public bool? ShowTargetDialog()
        {
            var tvm = new TargetDialogViewModel(m_targets, m_protocols.GetValues<IProtocol>());
            bool? result = DialogUtils.ShowDialogWithViewModel<TargetDialog>(tvm);

            if (result.HasValue && result.Value)
            {
                m_targets.Clear();
                m_targets.AddRange(tvm.Targets);
            }

            return result;
        }
Beispiel #2
0
        /// <summary>
        /// Display a dialog allowing user to edit a target</summary>
        /// <param name="target">Target to edit</param>
        /// <returns>true if target modified</returns>
        public bool EditUserTarget(ITarget target)
        {
            var t = target as TcpIpTarget;

            if (t == null)
            {
                throw new ArgumentException("Can only edit TCP/IP targets");
            }

            bool?res = DialogUtils.ShowDialogWithViewModel <TcpIpTargetEditDialog>(new TcpIpTargetEditDialogViewModel(t));

            return(res.HasValue && res.Value);
        }
Beispiel #3
0
        /// <summary>
        /// Begins progress display where client manually updates progress</summary>
        /// <param name="message">Message to display with progress meter</param>
        /// <param name="canCancel">Should the cancel button appear and be enabled?</param>
        /// <param name="argument">Worker argument</param>
        /// <param name="workHandler">Background thread delegate</param>
        /// <param name="autoIncrement">Whether to auto increment the progress meter</param>
        /// <returns>True if the thread was cancelled</returns>
        public bool RunProgressDialog(string message, bool canCancel, object argument, DoWorkEventHandler workHandler, bool autoIncrement)
        {
            var vm = new ProgressViewModel()
            {
                Cancellable     = canCancel,
                Description     = message,
                IsIndeterminate = autoIncrement
            };

            vm.RunWorkerThread(argument, workHandler);

            DialogUtils.ShowDialogWithViewModel <ProgressDialog>(vm);

            ProgressResult = vm.Result;
            ProgressError  = vm.Error;

            return(vm.Cancelled);
        }
Beispiel #4
0
        /// <summary>
        /// Perform the Reconcile command</summary>
        /// <param name="doing">True to perform the Reconcile; false to test whether Reconcile can be done</param>
        /// <returns>True iff Reconcile can be done or was done</returns>
        protected override bool DoReconcile(bool doing)
        {
            if (SourceControlService == null || SourceControlContext == null)
            {
                return(false);
            }

            if (!doing)
            {
                return(SourceControlContext.Resources.Any());
            }

            var uris            = SourceControlContext.Resources.Select(resource => resource.Uri).ToList();
            var modified        = new List <Uri>();
            var localNotInDepot = new List <Uri>();

            //using (new WaitCursor())
            {
                foreach (Uri uri in SourceControlService.GetModifiedFiles(uris))
                {
                    if (SourceControlService.GetStatus(uri) != SourceControlStatus.CheckedOut)
                    {
                        modified.Add(uri);
                    }
                }

                foreach (Uri uri in uris)
                {
                    if (!modified.Contains(uri))
                    {
                        if (SourceControlService.GetStatus(uri) == SourceControlStatus.NotControlled)
                        {
                            localNotInDepot.Add(uri);
                        }
                    }
                }
            }

            var vm = new ReconcileViewModel(SourceControlService, modified, localNotInDepot);

            DialogUtils.ShowDialogWithViewModel <ReconcileDialog>(vm);

            return(true);
        }
Beispiel #5
0
 /// <summary>
 /// Shows the application's About... dialog</summary>
 public virtual void ShowHelpAbout()
 {
     DialogUtils.ShowDialogWithViewModel <AboutDialog, AboutDialogViewModel>();
 }
Beispiel #6
0
        /// <summary>
        /// Display Checkin dialog</summary>
        /// <param name="toCheckIns">List of resources to check in</param>
        protected override void ShowCheckInDialog(IList <IResource> toCheckIns)
        {
            var vm = new CheckInViewModel(SourceControlService, toCheckIns);

            DialogUtils.ShowDialogWithViewModel <CheckInDialog>(vm);
        }