コード例 #1
0
 public ConfigureViewModel(IWallpaperRepository database, IMetroDialog metroDialog)
 {
     DisplayName = "Configure WallMixer";
     _db         = database;
     _dialog     = metroDialog;
     Sources     = new BindableCollection <WallpaperSource>();
 }
コード例 #2
0
 public MainViewModel(IWindowManager manager, IWallpaperRepository db, IMetroDialog dialog)
 {
     _windowManager = manager;
     _db            = db;
     _dialog        = dialog;
     _rand          = new Random();
     new Task(ChangeWallpaper).Start();
 }
コード例 #3
0
        static async Task <bool?> HandleMetroDialog(IMetroDialog model, BaseMetroDialog dialog)
        {
            var window = (MetroWindow)Application.Current.MainWindow;
            var tcs    = new TaskCompletionSource <bool?>();

            model.Close = CreateCommand(dialog, window, tcs);
            await window.ShowMetroDialogAsync(dialog);

            return(await tcs.Task);
        }
コード例 #4
0
 public static async Task <bool> DoneOrCancelVisitor(this IMetroDialog metroDialog, string operation)
 {
     return((await metroDialog.ShowMessage("Done or cancel",
                                           $"Are you done {operation} or do you want to cancel the visitor card",
                                           MessageDialogStyle.AffirmativeAndNegative,
                                           new MetroDialogSettings {
         AffirmativeButtonText = "Done", NegativeButtonText = "Cancel"
     })) ==
            MessageDialogResult.Affirmative);
 }
コード例 #5
0
        /// <summary>
        ///     DO NOT CALL .RESULT or .WAIT from UI thread!
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        protected async Task <bool?> ShowMetroDialog(IMetroDialog model)
        {
            // Da faq mahapps!!!
            var resolvedView = ViewLocator.Current.ResolveView(model);

            resolvedView.ViewModel = model;

            var view = resolvedView as BaseMetroDialog;

            if (view != null)
            {
                return(await HandleMetroDialog(model, view));
            }

            var dialog = new CustomDialog {
                Content = resolvedView
            };

            using (model.WhenAnyValue(x => x.DisplayName).BindTo(dialog, x => x.Title))
                return(await HandleMetroDialog(model, dialog));
        }
コード例 #6
0
 public Task<bool?> ShowMetroDialog(IMetroDialog vm) {
     Contract.Requires<ArgumentNullException>(vm != null);
     return default(Task<bool?>);
 }
コード例 #7
0
 public MainMenuViewModel(INavigationService navigationService, IMetroDialog metroDialog)
 {
     _navigationService = navigationService;
     _metroDialog       = metroDialog;
 }
コード例 #8
0
 public Task<bool?> ShowMetroDialog(IMetroDialog vm) {
     throw new NotImplementedException();
 }
コード例 #9
0
 public PlayerSelection(IMetroDialog metroDialog, IMefContainer mefContainer)
 {
     _metroDialog  = metroDialog;
     _mefContainer = mefContainer;
 }
コード例 #10
0
 static async Task<bool?> HandleMetroDialog(IMetroDialog model, BaseMetroDialog dialog) {
     var window = (MetroWindow) Application.Current.MainWindow;
     var tcs = new TaskCompletionSource<bool?>();
     model.Close = CreateCommand(dialog, window, tcs);
     await window.ShowMetroDialogAsync(dialog);
     return await tcs.Task;
 }
コード例 #11
0
 public BuildStructureAction(IEventAggregator eventAggregator, IMetroDialog metroDialog, IMefContainer mefContainer) : base(eventAggregator)
 {
     _metroDialog  = metroDialog;
     _mefContainer = mefContainer;
 }
コード例 #12
0
 protected PlayVisitorAction(IEventAggregator eventAggregator, IMetroDialog metroDialog,
                             IMefContainer mefContainer) : base(eventAggregator)
 {
     _metroDialog  = metroDialog;
     _mefContainer = mefContainer;
 }
コード例 #13
0
 public PlayWinterVisitorAction(IEventAggregator eventAggregator, IMetroDialog metroDialog,
                                IMefContainer mefContainer) : base(eventAggregator, metroDialog, mefContainer)
 {
 }
コード例 #14
0
 public PlantVineAction(IEventAggregator eventAggregator, IMetroDialog metroDialog, IMefContainer mefContainer) : base(eventAggregator)
 {
     _metroDialog  = metroDialog;
     _mefContainer = mefContainer;
 }
コード例 #15
0
 public SellGrapeOrFieldAction(IEventAggregator eventAggregator, IMetroDialog metroDialog,
                               IMefContainer mefContainer) : base(eventAggregator)
 {
     _metroDialog  = metroDialog;
     _mefContainer = mefContainer;
 }
コード例 #16
0
 public FillOrderAction(IEventAggregator eventAggregator, IMetroDialog metroDialog, IMefContainer mefContainer) : base(eventAggregator)
 {
     _metroDialog  = metroDialog;
     _mefContainer = mefContainer;
 }
コード例 #17
0
        /// <summary>
        ///     DO NOT CALL .RESULT or .WAIT from UI thread!
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task<bool?> ShowMetroDialog(IMetroDialog model) {
            ConfirmAccess();
            // Da faq mahapps!!!
            var resolvedView = ViewLocator.Current.ResolveView(model);
            resolvedView.ViewModel = model;

            var view = resolvedView as BaseMetroDialog;
            if (view != null)
                return await HandleMetroDialog(model, view);

            var dialog = new CustomDialog {Content = resolvedView};
            using (model.WhenAnyValue(x => x.DisplayName).BindTo(dialog, x => x.Title))
                return await HandleMetroDialog(model, dialog);
        }