void doUpdateModel(AlertConfirmBoxModel input)
        {
            if (input != null)
            {
                _localCache.Add(input);
            }

            if (AlertConfirmBoxModel.IsVisible == Visibility.Visible)
            {
                return;
            }

            if (!_localCache.Any())
            {
                return;
            }

            //show 1st cached item.
            AlertConfirmBoxModel.CurrentState = "FlashAnim"; //animation
            AlertConfirmBoxModel.Errors       = _localCache[0].Errors;
            AlertConfirmBoxModel.ErrorTitle   = _localCache[0].ErrorTitle;
            AlertConfirmBoxModel.IsVisible    = _localCache[0].IsVisible;
            AlertConfirmBoxModel.ShowCancel   = _localCache[0].ShowCancel;
            AlertConfirmBoxModel.ShowConfirm  = _localCache[0].ShowConfirm;

            _localCache.RemoveAt(0);
        }
 /// <summary>
 /// سازنده کلاس آلرت باکس سفارشی برنامه
 /// </summary>
 public AlertConfirmBoxViewModel()
 {
     _localCache = new List<AlertConfirmBoxModel>();
     setupMessengers();
     AlertConfirmBoxModel = new AlertConfirmBoxModel
     {
         IsVisible = Visibility.Collapsed,
         ShowConfirm = Visibility.Collapsed,
         ShowCancel = Visibility.Collapsed,
         CurrentState = "Normal"
     };
     setupCommands();
 }
 /// <summary>
 /// سازنده کلاس آلرت باکس سفارشی برنامه
 /// </summary>
 public AlertConfirmBoxViewModel()
 {
     _localCache = new List <AlertConfirmBoxModel>();
     setupMessengers();
     AlertConfirmBoxModel = new AlertConfirmBoxModel
     {
         IsVisible    = Visibility.Collapsed,
         ShowConfirm  = Visibility.Collapsed,
         ShowCancel   = Visibility.Collapsed,
         CurrentState = "Normal"
     };
     setupCommands();
 }
Exemplo n.º 4
0
        // Public Methods (1) 

        /// <summary>
        /// نمایش یک پیغام به کاربر
        /// </summary>
        /// <param name="input">اطلاعاتی جهت نمایش به کاربر</param>
        /// <param name="ex">شیء استثناء در صورت وجود</param>
        /// <param name="confirmed">اگر تائید شد پس از آن چه رخ دهد؟</param>
        /// <param name="cancelled">اگر رد شد پس از آن چه رخ دهد؟</param>
        public void ShowMsg(AlertConfirmBoxModel input,
                            Exception ex = null,
                            Action<AlertConfirmBoxModel> confirmed = null,
                            Action<AlertConfirmBoxModel> cancelled = null)
        {
            _cancelled = cancelled;
            _confirmed = confirmed;
            _input = input;
            Messenger.Default.Register<string>(this, "AlertSysResult", alertSysResult);
            Messenger.Default.Send(input, "MyMessengerService");

            if (ex != null)
            {
                //don't block UI...
                new Thread(ExceptionLogger.LogExceptionToFile).Start(ex);
            }
        }
Exemplo n.º 5
0
        // Public Methods (1) 

        /// <summary>
        /// نمایش یک پیغام به کاربر
        /// </summary>
        /// <param name="input">اطلاعاتی جهت نمایش به کاربر</param>
        /// <param name="ex">شیء استثناء در صورت وجود</param>
        /// <param name="confirmed">اگر تائید شد پس از آن چه رخ دهد؟</param>
        /// <param name="cancelled">اگر رد شد پس از آن چه رخ دهد؟</param>
        public void ShowMsg(AlertConfirmBoxModel input,
                            Exception ex = null,
                            Action <AlertConfirmBoxModel> confirmed = null,
                            Action <AlertConfirmBoxModel> cancelled = null)
        {
            _cancelled = cancelled;
            _confirmed = confirmed;
            _input     = input;
            Messenger.Default.Register <string>(this, "AlertSysResult", alertSysResult);
            Messenger.Default.Send(input, "MyMessengerService");

            if (ex != null)
            {
                //don't block UI...
                new Thread(ExceptionLogger.LogExceptionToFile).Start(ex);
            }
        }
        void doUpdateModel(AlertConfirmBoxModel input)
        {
            if (input != null)
            {
                _localCache.Add(input);
            }

            if (AlertConfirmBoxModel.IsVisible == Visibility.Visible) return;

            if (!_localCache.Any())
                return;

            //show 1st cached item.
            AlertConfirmBoxModel.CurrentState = "FlashAnim"; //animation
            AlertConfirmBoxModel.Errors = _localCache[0].Errors;
            AlertConfirmBoxModel.ErrorTitle = _localCache[0].ErrorTitle;
            AlertConfirmBoxModel.IsVisible = _localCache[0].IsVisible;
            AlertConfirmBoxModel.ShowCancel = _localCache[0].ShowCancel;
            AlertConfirmBoxModel.ShowConfirm = _localCache[0].ShowConfirm;

            _localCache.RemoveAt(0);
        }