コード例 #1
0
        public CountryController(WorkingWindow win, string uri = "https://restcountries.eu/rest/v2/name/USA",
                                 string fileName = @"..\..\country.json")
        {
            _webClient = new WebClient();
            _uri       = uri;
            _fileName  = fileName;
            _mainWin   = win;

            gotCountries = new List <Country>();
        }
コード例 #2
0
        public PagePatients(Nurse sessionDoctor, WorkingWindow window)
        {
            InitializeComponent();

            this.currentDoc = sessionDoctor;

            this.window = window;

            this.DataContext = new PatientViewModel(sessionDoctor);
        }
コード例 #3
0
        public PageDoctors(Nurse sessionDoctor, WorkingWindow window)
        {
            InitializeComponent();

            this.currentDoc = sessionDoctor;

            this.window = window;

            this.DataContext = new DoctorsViewModel(sessionDoctor);

            if (sessionDoctor is HeadPhysician)
            {
                newDoctorPanel.Visibility = Visibility.Visible;
            }
        }
コード例 #4
0
 private static void ShowWorkingDialog(string description, Func <Action <string>, Task> executeTask)
 {
     // change application shutdown mode for preventing
     // auto-exit when optimization is completed.
     Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
     try
     {
         // run database optimization
         var optDlg = new WorkingWindow(
             description, executeTask);
         optDlg.ShowDialog();
     }
     finally
     {
         // restore shutdown mode
         Application.Current.ShutdownMode = ShutdownMode.OnLastWindowClose;
     }
 }
コード例 #5
0
 private static void MigrateWorkCore(Func <Action <string>, Task> migration)
 {
     // change application shutdown mode for preventing
     // auto-exit when optimization is completed.
     Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
     try
     {
         // run database optimization
         var optDlg = new WorkingWindow(
             "migrating database...",
             migration);
         optDlg.ShowDialog();
     }
     finally
     {
         // restore shutdown mode
         Application.Current.ShutdownMode = ShutdownMode.OnLastWindowClose;
     }
 }
コード例 #6
0
        public static void OptimizeDatabaseIfRequired()
        {
            if (!_isDatabaseOptimizationRequired)
            {
                return;
            }

            // change application shutdown mode for preventing
            // auto-exit when optimization is completed.
            Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            try
            {
                // run database optimization
                var optDlg = new WorkingWindow(
                    "optimizing database...",
                    OptimizeDatabase);
                optDlg.ShowDialog();
            }
            finally
            {
                // restore shutdown mode
                Application.Current.ShutdownMode = ShutdownMode.OnLastWindowClose;
            }
        }
コード例 #7
0
        private async void ChangeDisplayOfTimeline(TweetDisplayMode newValue)
        {
            if (Setting.TweetDisplayMode.Value == newValue)
            {
                RaisePropertyChanged();
                return;
            }
            var showDonationInfo = false;

            if (Setting.TweetDisplayMode.Value == Settings.TweetDisplayMode.Expanded &&
                (newValue == Settings.TweetDisplayMode.SingleLine || newValue == Settings.TweetDisplayMode.Mixed))
            {
                var resp = this.Messenger.GetResponse(new TaskDialogMessage(new TaskDialogOptions
                {
                    Title           = "一行表示モードの警告",
                    MainIcon        = VistaTaskDialogIcon.Warning,
                    MainInstruction = "一行表示モードを有効にしようとしています。",
                    Content         = "一行表示モードは複数行表示モードに比べ、リソースを大量に消費します。" + Environment.NewLine +
                                      "また、Krile StarryEyesは一行表示モードをベースとして設計されてはいないため、意図しない動作をする可能性があります。" +
                                      Environment.NewLine +
                                      "一行表示モードを本当に有効にしますか?",
                    CommonButtons = TaskDialogCommonButtons.YesNo
                }));
                if (resp.Response.Result == TaskDialogSimpleResult.No)
                {
                    this.TweetDisplayMode = (int)Settings.TweetDisplayMode.Expanded;
                    return;
                }
                showDonationInfo = true;
            }
            await DispatcherHolder.BeginInvoke(() =>
            {
                var ww = new WorkingWindow(
                    "changing timeline mode...", async() =>
                {
                    await Task.Run(() => Setting.TweetDisplayMode.Value = newValue);
                    RaisePropertyChanged(() => IsDonationVisible);
                    await DispatcherHolder.BeginInvoke(async() =>
                    {
                        await Dispatcher.Yield(DispatcherPriority.Background);
                    });
                });
                if (showDonationInfo && !ContributionService.IsContributor())
                {
                    ww.Closed += async(o, e) =>
                    {
                        await this.Messenger.RaiseAsync(new TaskDialogMessage(new TaskDialogOptions
                        {
                            Title           = "Krileの開発にご協力ください。",
                            MainIcon        = VistaTaskDialogIcon.Information,
                            MainInstruction = "Krileの開発にご協力ください。",
                            Content         = "多くのユーザーの補助によってKrileが開発されています。" + Environment.NewLine +
                                              "Krileの開発を継続するため、寄付にご協力ください。",
                            CustomButtons = new[] { "開発者に寄付" }
                        }));
                        BrowserHelper.Open(App.DonationUrl);
                    };
                }
                ww.ShowDialog();
            });
        }