Beispiel #1
0
 public ProgressDialog(ProgressDialogConfig config)
 {
     this.config = config;
     this.dialog = new ProgressContentDialog {
         DataContext = this
     };
     this.Cancel = new Command(() => config.OnCancel?.Invoke());
 }
Beispiel #2
0
        public virtual IProgressDialog Progress(ProgressDialogConfig config)
        {
            var dlg = this.CreateDialogInstance(config);

            dlg.Title = config.Title;

            if (config.AutoShow)
            {
                dlg.Show();
            }

            return(dlg);
        }
        public ProgressDialog(ProgressDialogConfig config, Func <Action, Task> dispatcher = null)
        {
            this.config = config;
            this.Cancel = new Command(() => config.OnCancel?.Invoke());

            this.dispatcher = dispatcher ?? new Func <Action, Task>(x => CoreApplication
                                                                    .MainView
                                                                    .CoreWindow
                                                                    .Dispatcher
                                                                    .RunAsync(CoreDispatcherPriority.Normal, () => x())
                                                                    .AsTask()
                                                                    );
        }
Beispiel #4
0
        protected override IProgressDialog CreateDialogInstance(ProgressDialogConfig config)
        {
            var activity = this.TopActivityFunc();
            var dialog   = new ProgressDialog(config, activity);


            //if (activity != null)
            //{
            //    var frag = new LoadingFragment();
            //    activity.RunOnUiThread(() =>
            //    {
            //        frag.Config = dialog;
            //        frag.Show(activity.SupportFragmentManager, FragmentTag);
            //    });
            //}

            return(dialog);
        }
Beispiel #5
0
        public virtual IProgressDialog Progress(ProgressDialogConfig config)
        {
            var dlg = this.CreateDialogInstance();

            dlg.Title           = config.Title;
            dlg.IsDeterministic = config.IsDeterministic;

            if (config.OnCancel != null)
            {
                dlg.SetCancel(config.OnCancel, config.CancelText);
            }

            if (config.AutoShow)
            {
                dlg.Show();
            }

            return(dlg);
        }
Beispiel #6
0
 protected override IProgressDialog CreateDialogInstance(ProgressDialogConfig config)
 {
     return(new ProgressDialog(config));
 }
Beispiel #7
0
 public ProgressDialog(ProgressDialogConfig config, Activity activity)
 {
     this.config = config;
     this.activity = activity;
 }
Beispiel #8
0
 protected abstract IProgressDialog CreateDialogInstance(ProgressDialogConfig config);
 public ProgressDialog(ProgressDialogConfig config)
 {
     this.config = config;
     this.Cancel = new Command(() => config.OnCancel?.Invoke());
 }
Beispiel #10
0
 public ProgressDialog(ProgressDialogConfig config)
 {
     this.config = config;
     this.dialog = new ProgressContentDialog { DataContext = this };
     this.Cancel = new Command(() => config.OnCancel?.Invoke());
 }
        public virtual IProgressDialog Progress(ProgressDialogConfig config)
        {
            var dlg = this.CreateDialogInstance();
            dlg.Title = config.Title;
            dlg.IsDeterministic = config.IsDeterministic;
            dlg.MaskType = config.MaskType;

            if (config.OnCancel != null)
                dlg.SetCancel(config.OnCancel, config.CancelText);

            if (config.AutoShow)
                dlg.Show();

            return dlg;
        }
 public ProgressDialog(ProgressDialogConfig config, Activity activity)
 {
     this.config   = config;
     this.activity = activity;
 }
 public ProgressDialog(ProgressDialogConfig config)
 {
     this.config = config;
     this.title  = config.Title;
 }
Beispiel #14
0
 protected override IProgressDialog CreateDialogInstance(ProgressDialogConfig config)
 {
     return new ProgressDialog(config);
 }
Beispiel #15
0
 public ProgressDialog(ProgressDialogConfig config)
 {
     this.config = config;
     this.title = config.Title;
 }
Beispiel #16
0
 protected override IProgressDialog CreateDialogInstance(ProgressDialogConfig config)
 {
     throw new NotImplementedException();
 }
Beispiel #17
0
 protected override IProgressDialog CreateDialogInstance(ProgressDialogConfig config) => new ProgressDialog(config, dispatcher);
Beispiel #18
0
        public ProgressDialog(ProgressDialogConfig config)
        {
            this.config     = config;
            this.title      = config.Title;
            this.mainWindow = NSApplication.SharedApplication.KeyWindow;

            progressPanel = new NSPanel(new CGRect(0, 0, 100, 140), NSWindowStyle.DocModal, NSBackingStore.Buffered, true)
            {
                BackgroundColor = NSColor.White
            };

            var view = new NSView();

            txtTitle = new NSTextField
            {
                Editable  = false,
                Hidden    = string.IsNullOrEmpty(this.title),
                Alignment = NSTextAlignment.Center
            };

            progressIndicator = new NSProgressIndicator
            {
                Style         = NSProgressIndicatorStyle.Spinning,
                Indeterminate = !config.IsDeterministic,
                MinValue      = 0,
                DoubleValue   = 0,
                MaxValue      = 100
            };

            view.AggregateSubviews(txtTitle, progressIndicator);

            NSButton cancelButton = null;

            if (config.OnCancel != null)
            {
                cancelButton = new NSButton
                {
                    Title = config.CancelText
                };
                cancelButton.Activated += (sender, e) =>
                {
                    Hide(true);
                };

                view.AggregateSubviews(cancelButton);
            }

            txtTitle.TopAnchor.ConstraintEqualToAnchor(view.TopAnchor).Active           = true;
            txtTitle.LeadingAnchor.ConstraintEqualToAnchor(view.LeadingAnchor).Active   = true;
            txtTitle.TrailingAnchor.ConstraintEqualToAnchor(view.TrailingAnchor).Active = true;

            progressIndicator.TopAnchor.ConstraintEqualToAnchor(txtTitle.BottomAnchor, 2).Active = true;
            progressIndicator.LeadingAnchor.ConstraintEqualToAnchor(view.LeadingAnchor).Active   = true;
            progressIndicator.TrailingAnchor.ConstraintEqualToAnchor(view.TrailingAnchor).Active = true;
            progressIndicator.HeightAnchor.ConstraintEqualToConstant(100).Active = true;
            progressIndicator.WidthAnchor.ConstraintEqualToConstant(100).Active  = true;

            if (cancelButton == null)
            {
                progressIndicator.BottomAnchor.ConstraintLessThanOrEqualToAnchor(view.BottomAnchor).Active = true;
            }
            else
            {
                cancelButton.TopAnchor.ConstraintEqualToAnchor(progressIndicator.BottomAnchor, 2).Active = true;
                cancelButton.CenterXAnchor.ConstraintEqualToAnchor(view.CenterXAnchor).Active            = true;
                cancelButton.BottomAnchor.ConstraintLessThanOrEqualToAnchor(view.BottomAnchor).Active    = true;
            }

            progressPanel.ContentView = view;
        }