Ejemplo n.º 1
0
        /// <summary>
        /// Déclenche l'événement <see cref="Refreshed"/>
        /// </summary>
        /// <param name="operationEventArgs">Argument de l'événement d'éxecution d'un opération</param>
        protected virtual void OnRefreshed(OperationEventArgs operationEventArgs)
        {
            if (operationEventArgs != null && !operationEventArgs.Succeed)
            {
                IsBusy       = false;
                IsRefreshing = false;
                // TODO : ManageException
                //ManageException(operationEventArgs.Error, Resources.Error_Refreshing);

                // TODO: CloseCommand
                //CloseCommand.Execute();
                return;
            }

            SynchronizeChilds();
            SetFocus();
            ViewCreated  = DateTime.Now;
            IsBusy       = false;
            IsRefreshing = false;

            if (Refreshed != null)
            {
                Refreshed(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Déclenche l'événement <see cref="Loaded"/>
        /// </summary>
        /// <param name="operationEventArgs">Argument de l'événement d'éxecution d'un opération</param>
        protected virtual void OnLoaded(OperationEventArgs operationEventArgs)
        {
            if (operationEventArgs != null && !operationEventArgs.Succeed)
            {
                IsBusy    = false;
                IsLoading = false;

                // TODO : ManageException
                //ManageException(operationEventArgs.Error, Resources.Error_Loading);

                //TODO : Close on error
                //CloseCommand.Execute();
                //ShellServices.EventAggregator.GetEvent<RemoveFromJournalPubSubEvent>().Publish(this);

                return;
            }

            SynchronizeChilds();
            SetTitle();
            IsBusy    = false;
            IsLoading = false;

            if (Loaded != null)
            {
                Loaded(this, operationEventArgs);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Déclenche l'événement <see cref="Deleted"/>
        /// </summary>
        protected virtual void OnDeleted(OperationEventArgs operationEventArgs)
        {
            if (operationEventArgs != null)
            {
                if (operationEventArgs.Succeed)
                {
                    // TODO : Close view
                    //ShellServices.NotificationService.NotifyInformation(true, GetHashCode(), Resources.Message_SaveSucceded);

                    //Closed += (s, e) => ShellServices.EventAggregator.GetEvent<RemoveFromJournalPubSubEvent>().Publish(this);

                    //// Close the view
                    //CloseCommand.Execute();
                }
                else
                {
                    IsDeleting = false;
                    IsBusy     = false;

                    // TODO : Manage exception
                    //ManageException(operationEventArgs.Error, Resources.Error_Deleting);
                }
            }

            IsDeleting = false;
            IsBusy     = false;

            Deleted?.Invoke(this, operationEventArgs);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Déclenche l'événement <see cref="Saved"/>
        /// </summary>
        protected virtual void OnSaved(OperationEventArgs operationEventArgs)
        {
            if (operationEventArgs != null)
            {
                if (operationEventArgs.Succeed)
                {
                    Mode = Mode.Edit;
                    SynchronizeChilds();
                    AcceptChanges();
                    // TODO : NotificationService
                    //ShellServices.NotificationService.NotifyInformation(true, GetHashCode(), Resources.Message_SaveSucceded);
                }
                else
                {
                    IsSaving = false;
                    IsBusy   = false;
                    // TODO : ManageException
                    //ManageException(operationEventArgs.Error, Resources.Error_Saving);
                }
            }

            IsSaving = false;
            IsBusy   = false;

            if (Saved != null)
            {
                Saved(this, operationEventArgs);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Déclenche l'événement <see cref="Searched"/>
        /// </summary>
        protected virtual void OnSearched(OperationEventArgs operationEventArgs)
        {
            if (operationEventArgs != null && !operationEventArgs.Succeed)
            {
                IsSearching = false;
                IsBusy      = false;
                // TODO : ManageException
                //ManageException(operationEventArgs.Error, Resources.Error_Searching);
            }

            IsSearching = false;
            IsBusy      = false;
            SetFocus();

            if (NavigateAutoIfOnlyOneItem && operationEventArgs.Succeed && Items.Count == 1)
            {
                CurrentItem = Items.First();
                DetailCommand.Execute();
            }

            Searched?.Invoke(this, operationEventArgs);
        }