private void OnDelete(IDialogResult result)
 {
     if (result.Result == ButtonResult.Yes)
     {
         BarcodeCollection.Remove(SelectedItem);
     }
 }
コード例 #2
0
        private async void OnEditorClosed(IDialogResult result)
        {
            if (result.Result != ButtonResult.OK)
            {
                return;
            }
            if (!result.Parameters.ContainsKey("id"))
            {
                return;
            }

            var id = result.Parameters.GetValue <int>("id");

            if (id == 0)
            {
                return;
            }

            var savedItem = await _domains.GetItem(id);

            var oldItem = Domains.FirstOrDefault(d => d.Model.Id == id);

            if (oldItem != null)
            {
                Domains.Remove(oldItem);
            }
            Domains.Add(new BindableEntity(savedItem));
        }
コード例 #3
0
        private void Delete()
        {
            Action a = async() =>
            {
                IDialogResult result = null;
                _dialogService.ShowDialog(nameof(ConfirmDialogView),
                                          new DialogParameters
                {
                    { "Content", "Xác nhận xoá bản ghi" }
                }, ret => result = ret);

                if (result.Result == ButtonResult.Yes)
                {
                    var content = new Dictionary <string, object> {
                        { "Barcode", Product.Barcode }
                    };
                    var isSuccess = await RestApiUtils.Instance.Post("api/product/delete", content);

                    if (isSuccess)
                    {
                        _regionManager.RequestNavigate(RegionNames.ContentRegion, nameof(ProductListView));
                    }
                }
            };

            ExecuteAction(a);
        }
コード例 #4
0
        private void OnDialogClosed(IDialogResult result)
        {
            // Check for exception
            if (result.Exception != null)
            {
                var e = result.Exception;
                Console.WriteLine($"Dialog failed. {(e.InnerException ?? e).Message}");
                return;
            }

            // Fetch parameters returned by the dialog view
            if (result.Parameters.ContainsKey("ServerName"))
            {
                string newServer = result.Parameters.GetValue <string>("ServerName");
                if (ServerList.Contains(newServer))
                {
                    Console.WriteLine($"Server exists");
                }
                else
                {
                    ServerList.Add(newServer);
                    Settings.ServerList = String.Join(",", ServerList);

                    Server = newServer;
                }
            }
        }
コード例 #5
0
        private async void OnDialogClosed(IDialogResult result)
        {
            if (result.Parameters.ContainsKey("deleted"))
            {
                var deletedHive = result.Parameters.GetValue <Hive>("deleted");


                RemoveHiveFromMap(deletedHive);
            }

            if (result.Parameters.ContainsKey("savedHive"))
            {
                var newHive = result.Parameters.GetValue <Hive>("savedHive");

                _eventAggregator.GetEvent <UpdateHiveListEvent>().Publish(true);

                AddHiveOnMap(newHive);
                Device.StartTimer(TimeSpan.FromMilliseconds(100), () =>
                {
                    MoveToRegionReq.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(newHive.HiveLocation.Latitude,
                                                                                          newHive.HiveLocation.Longitude), Distance.FromKilometers(8)));
                    return(false);
                });
            }
        }
コード例 #6
0
 protected virtual void OnDialogClosed(IDialogResult result)
 {
     if (result.Exception != null)
     {
         Log.Warning("Warning", $"Dialog '{Name}' closed with an error:\n{result.Exception}");
     }
 }
コード例 #7
0
        /// <summary>
        /// PopupView
        /// </summary>
        /// <param name="baseView"></param>
        /// <param name="popupView"></param>
        /// <param name="dialogMsg"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public IDialog PopupView(Xamarin.Forms.View baseView, Xamarin.Forms.View popupView, IDialogMsg dialogMsg, DialogConfig config)
        {
            if (baseView == null || popupView == null)
            {
                throw new ArgumentException($"dialog contentView is null");
            }

            if (config == null)
            {
                config = new DialogConfig()
                {
                    DialogPosition = DialogPosition.Buttom
                };
            }
            IDialogResult dialogResult            = null;
            TaskCompletionSource <string> mission = null;

            if (popupView is IDialogElement)
            {
                DialogResultManager manager = new DialogResultManager();
                manager.Build();
                dialogResult = manager.GetDialogResult();
                mission      = manager.GetResultMission();
            }
            var rect           = GetBaseViewRect(baseView);
            var dialogFragment = new PopupDialogFragment(_activity, popupView, config, dialogMsg, rect, dialogResult);
            var dialogDroid    = new DialogInstance(dialogFragment, _fragmentManager, popupView, mission);

            return(dialogDroid);
        }
コード例 #8
0
 // WindowC からパラメータを戻すときのアクション
 // 引数の型がインターフェイスなのはなぜ…?
 private void WindowCClose(IDialogResult dialogResult)
 {
     if (dialogResult.Result == ButtonResult.OK)
     {
         WindowCText = dialogResult.Parameters.GetValue <string>(nameof(WindowCViewModel.WindowCText));
     }
 }
コード例 #9
0
        public virtual async Task <IDialogResult> Show(Activity activity, bool ignoreLastResult = false)
        {
            if (LastResult.DontAskAgain && !ignoreLastResult)
            {
                return(LastResult);
            }

            View dialogView = null;

            try
            {
                if (Layout > 0)
                {
                    dialogView = activity.LayoutInflater.Inflate(Layout, null);
                }

                LastResult = await Show(context : activity, view : dialogView, onClosing : OnClosing);

                return(LastResult);
            }
            finally
            {
                dialogView?.Dispose();
            }
        }
コード例 #10
0
 private void ViewBClose(IDialogResult dialogResult)
 {
     if (dialogResult.Result == ButtonResult.OK)
     {
         SystemDate = dialogResult.Parameters.GetValue <string>(nameof(ViewBViewModel.ViewBTextBox));
     }
 }
コード例 #11
0
        private void Delete()
        {
            Action a = async() =>
            {
                IDialogResult result = null;
                _dialogService.ShowDialog(nameof(ConfirmDialogView),
                                          new DialogParameters
                {
                    { "Content", "Xác nhận xoá bản ghi" }
                }, ret => result = ret);

                if (result.Result == ButtonResult.Yes)
                {
                    var content = new Dictionary <string, object> {
                        { "id", Category.Id }
                    };
                    var isSuccess = await RestApiUtils.Instance.Post("api/category/delete", content);

                    if (isSuccess)
                    {
                        var parameters = new NavigationParameters();
                        parameters.Add("categoryDelete", Category);
                        _regionManager.RequestNavigate(RegionNames.ContentRegion, nameof(CategoryListView), parameters);
                    }
                }
            };

            ExecuteAction(a);
        }
コード例 #12
0
        private void msgret(IDialogResult ret)
        {
            var p = new DialogParameters();

            p.Add(nameof(ViewCTextBox), ViewCTextBox);
            RequestClose?.Invoke(new DialogResult(ret.Result, p));
        }
コード例 #13
0
 private void ViewCClose(IDialogResult result)
 {
     if (result.Result == ButtonResult.OK)
     {
         SystemDateLabel = result.Parameters.GetValue <string>(nameof(ViewCViewModel.ViewCTextBox));
     }
 }
コード例 #14
0
        public static string GetClosedBy(IDialogResult result)
        {
            string closedText =
                result.ClosedBy != null
                ? result.ClosedBy.GetType().Name
                : "unknown thing";

            if (result.ClosedBy != null)
            {
                if (result.ClosedBy is IContainerItem)
                {
                    var c = (IContainerItem)result.ClosedBy;

                    var contentText = c.Content != null?c.Content.GetType().Name : "(null)";

                    if (c.Content is Label)
                    {
                        var label = c as Label;
                        contentText = "Label " + label.Content;
                    }

                    closedText += " with a content of type " + contentText;
                }
            }

            return(closedText);
        }
コード例 #15
0
        public IDialog CreateDialog(Xamarin.Forms.View contentView, IDialogMsg dialogMsg, DialogConfig config)
        {
            if (contentView == null)
            {
                throw new ArgumentException($"dialog contentView is null");
            }
            if (config == null)
            {
                config = new DialogConfig();
            }
            IDialogResult dialogResult            = null;
            TaskCompletionSource <string> mission = null;

            if (contentView is IDialogElement)
            {
                DialogResultManager manager = new DialogResultManager();
                manager.Build();
                dialogResult = manager.GetDialogResult();
                mission      = manager.GetResultMission();
            }
            var dialogFragment = new BaseDialogFragment2(_activity, contentView, config, dialogMsg, dialogResult);
            var dialogDroid    = new DialogInstance(dialogFragment, _fragmentManager, contentView, mission);

            return(dialogDroid);
        }
コード例 #16
0
        private void DialogClosedCallback(IDialogResult result)
        {
            OnDialogClosed(result);

            IsExecuting = false;
            CanExecuteChanged(this, EventArgs.Empty);
        }
コード例 #17
0
 private void ListSaveClose(IDialogResult dialogResult)
 {
     if (dialogResult.Result == ButtonResult.OK)
     {
         var kayaku = dialogResult.Parameters.GetValue <PyrotechnicEntity>(nameof(ListSaveViewModel.ListSaveTextBox));
         MessageBox.Show(kayaku.PartsNumber);
     }
 }
コード例 #18
0
        public static IDialogResult ShowDialog(this IDialogService dlgService, string dialogViewName, IDialogParameters parameters)
        {
            IDialogResult ret = null;

            dlgService.ShowDialog(dialogViewName, parameters, r => ret = r);

            return(ret);
        }
コード例 #19
0
 private void LoginCompleted(IDialogResult result)
 {
     if (result.Result == ButtonResult.OK)
     {
         IsLogin = true;
         GetPhotos(true);
     }
 }
 // ViewUsrCtrlBビューを閉じた際に呼ばれるコールバックアクション。
 private void OnViewUsrCtrlBClosed(IDialogResult dialogResult)
 {
     // 遷移先ダイアログから返された結果パラメータを受け取る。
     if (dialogResult.Result == ButtonResult.OK)  // OKボタンが押されてダイアログが閉じた場合のみ
     {
         string aTextBoxTextKeyVal = dialogResult.Parameters.GetValue <string>(key: nameof(ViewUsrCtrlBViewModel.ATextBoxText));
         this.SystemDateString = aTextBoxTextKeyVal;
     }
 }
コード例 #21
0
ファイル: MainWindowViewModel.cs プロジェクト: Dovesee/Colocc
 private void OpenShowWork(IDialogResult obj)
 {
     if (obj.Result == ButtonResult.Yes)
     {
         _log.Info("开始工作,此次休息" + _stopwatch.ElapsedMilliseconds / 60000 + "分钟");
         _stopwatch.Restart();
         _freeFlag = false;
     }
 }
コード例 #22
0
ファイル: MainWindowViewModel.cs プロジェクト: Dovesee/Colocc
 private void ShowWorkShutDown(IDialogResult obj)
 {
     if (obj.Result == ButtonResult.Yes)
     {
         _freeFlag = true;
         _log.Info("开始休息,此次工作" + _stopwatch.ElapsedMilliseconds / 60000 + "分钟");
         _stopwatch.Restart();
     }
 }
コード例 #23
0
 /// <summary>
 /// 通过已注册的ViewModel关闭关联的ui所在对话框,并设置ViewModel中的DialogResult
 /// </summary>
 /// <param name="viewModel"></param>
 /// <param name="dialogResult"></param>
 public static void CloseByViewModel(IDialogResult viewModel, MessageBoxResult dialogResult)
 {
     if (viewModel == null)
     {
         throw new ArgumentNullException();
     }
     viewModel.DialogResult = dialogResult;
     CloseByViewModel(viewModel);
 }
コード例 #24
0
 private void ShowDialogSampleClosed(IDialogResult dialogResult)
 {
     // ×ボタンなどが押された時もこの関数は実行されるため、
     // ちゃんと ButtonResult が何だったかのチェックを入れる必要がある
     if (dialogResult.Result == ButtonResult.OK)
     {
         ReturnText = dialogResult.Parameters.GetValue <string>(nameof(ShowDialogSampleViewModel.Text));
     }
 }
コード例 #25
0
 private void FilterProducts(IDialogResult res)
 {
     if (res.Result == ButtonResult.OK)
     {
         ProductsFilterModel = res.Parameters.GetValue <ProductsFilterModel>("ProductsFilterModel");
         var products = _productService.GetAll(e => e.Price >= ProductsFilterModel.CurrentMinValue && e.Price <= ProductsFilterModel.CurrentMaxValue);
         Products = new ObservableCollection <ProductModel>(products.Select(e => MapProduct(e)));
     }
 }
コード例 #26
0
        public virtual IDialogResult ConfirmDialog(object parentViewModel, string message, string title = "Confirmation")
        {
            IDialogResult result = null;
            var           option = CreateMessageBoxOption(message, title, MessageIconType.Confirm);

            option.DialogType = DialogType.Dialog;
            DialogService.ShowDialog(parentViewModel, option, rs => result = rs);
            return(result);
        }
コード例 #27
0
        public override void RaiseRequestClose(IDialogResult dialogResult)
        {
            Chromium.Load(COOKIE_CLEAR);
            if (dialogResult?.Result == ButtonResult.Cancel)
            {
                _facebookService.ClearAuthorize();
            }

            base.RaiseRequestClose(dialogResult);
        }
コード例 #28
0
        private void EventCreated(IDialogResult result)
        {
            IJob   J = result.Parameters.GetValue <IJob>("Job");
            IEvent E = result.Parameters.GetValue <IEvent>("Event");

            AddEventToJob(J, E);

            EA.GetEvent <UIUpdateRequestEvent>().Publish(ChangeType.JobEventListChanged);
            //EA.GetEvent<JobEventOccuredEvent>().Publish(new JobEventOccuredContainer(J, E));
        }
コード例 #29
0
        private void CallbackEntityBaseCategory(IDialogResult dialogResult)
        {
            TEntity temp = dialogResult.Parameters.GetValue <TEntity>("entity");

            if (temp == null)
            {
                return;
            }
            AfterAddEntityBaseCategory(temp);
        }
コード例 #30
0
        private void OnAddressWindowClosed(IDialogResult result)
        {
            if (result.Result == ButtonResult.OK)
            {
                var addressViewModel = result.Parameters.GetValue <AddressViewModel>("Entity");

                Entity.Address   = addressViewModel;
                Entity.AddressId = addressViewModel.Id;
            }
        }