コード例 #1
0
        public async Task Init()
        {
            PleaseClickCompare = false;
            Comparer           = null;
            a7DbDataComparer structComparer = null;

            using (var busyVm = new BusyViewModel(AppViewModel.Instance, "Comparing database structures..."))
            {
                await Task.Factory.StartNew(() =>
                {
                    structComparer = new a7DbDataComparer(_connData.Name, DbA, DbB, AddLog);
                });
            }
            if (structComparer != null)
            {
                Comparer           = structComparer;
                PleaseClickCompare = false;
                //a7DbStructCompResultWnd wnd = new a7DbStructCompResultWnd(structComparer);
                //wnd.ShowDialog();
            }
            else
            {
                MessageBox.Show("Something is wrong...");
                PleaseClickCompare = true;
            }
        }
コード例 #2
0
        private void GenerateReport()
        {
            BusyViewModel.ActiveAsync("... Generating ...")
            .Then(() => Items.ClearAsync(), Scheduler.Dispatcher.TPL)
            .Then(() => Service.GenerateAsync(Service.CreateRequest(ParameterViewModel)), Scheduler.Task.TPL)
            .Do(response => _response = response, Scheduler.Task.TPL)
            .Then(response => Service.GenerateDataViewModelsAsync(response), Scheduler.Task.TPL)
            .Do(dataViewModels =>
            {
                foreach (var dataViewModel in dataViewModels)
                {
                    Items.Add(dataViewModel);

                    var supportActivationState = dataViewModel as ISupportActivationState;
                    if (supportActivationState != null)
                    {
                        this.SyncViewModelActivationStates(supportActivationState).AddDisposable(Disposables);
                    }
                }
            }, Scheduler.Dispatcher.TPL)
            .LogException(Log)
            .CatchAndHandle(x => StandardDialog.Error("Error", "Problem Generating Report"), Scheduler.Task.TPL)
            .Finally(() =>
            {
                BusyViewModel.InActive();

                IsExpanded = false;

                _exportToExcel.RaiseCanExecuteChanged();
            }, Scheduler.Task.TPL);
        }
コード例 #3
0
 protected override Task OnInitialise()
 {
     return(BusyViewModel.ActiveAsync("... Loading quotes ...")
            .Then(() => RefreshQuotesAsync(), Scheduler.Task.TPL)
            .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem loading quotes"), Scheduler.Task.TPL)
            .Finally(BusyViewModel.InActive, Scheduler.Task.TPL));
 }
コード例 #4
0
 protected override Task OnInitialise()
 {
     return(BusyViewModel.ActiveAsync("Loading")
            .Then(() => _service.GetGendersAsync(), Scheduler.Task.TPL)
            .Do(genders => Genders.AddRangeAsync(genders), Scheduler.Dispatcher.TPL)
            .Finally(() => BusyViewModel.InActive(), Scheduler.Dispatcher.TPL));
 }
コード例 #5
0
 protected override Task OnInitialise()
 {
     return(BusyViewModel.ActiveAsync("... Loading ...")
            .Then(() => Service.ConfigureParameterViewModelAsync(ParameterViewModel), Scheduler.Task.TPL)
            .LogException(Log)
            .CatchAndHandle(x => StandardDialog.Error("Error", "Problem initialising parameters"), Scheduler.Task.TPL)
            .Finally(BusyViewModel.InActive, Scheduler.Task.TPL));
 }
コード例 #6
0
 private object NewQuote()
 {
     return(_service.NewQuoteAsync()
            .Then(() => BusyViewModel.ActiveAsync("... Refreshing quotes ..."), Scheduler.Dispatcher.TPL)
            .Then(() => RefreshQuotesAsync(), Scheduler.Task.TPL)
            .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem refreshing quotes"), Scheduler.Task.TPL)
            .Finally(BusyViewModel.InActive, Scheduler.Task.TPL));
 }
コード例 #7
0
 protected override Task OnInitialise()
 {
     return(BusyViewModel.ActiveAsync("... Loading available dates ...")
            .Then(() => _service.GetAvailableDatesAsync(), Scheduler.Task.TPL)
            .Do(x => SelectedDate = x.First(), Scheduler.Dispatcher.TPL)
            .Then(x => Dates.AddRangeAsync(x), Scheduler.Dispatcher.TPL)
            .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem available dates"), Scheduler.Task.TPL)
            .Finally(BusyViewModel.InActive, Scheduler.Task.TPL));
 }
コード例 #8
0
 protected override Task OnInitialise()
 {
     return(BusyViewModel.ActiveAsync("... Loading Attributes ...")
            .Then(() => _service.GetAttributesAsync(), Scheduler.Task.TPL)
            .Do(response => Available.AddRangeAsync(response.Dimensions.Select(CreateDimension)), Scheduler.Dispatcher.TPL)
            .Do(response => Available.AddRangeAsync(response.Measures.Select(CreateMeasure)), Scheduler.Dispatcher.TPL)
            .LogException(Log)
            .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem initialising attributes"), Scheduler.Task.TPL)
            .Finally(BusyViewModel.InActive, Scheduler.Task.TPL));
 }
コード例 #9
0
ファイル: ChartViewModel.cs プロジェクト: ganesum/Blitz
 private void GetData()
 {
     BusyViewModel.ActiveAsync(string.Format("... Loading {0} ...", _ticker))
     .Then(() => Items.ClearAsync(), Scheduler.Dispatcher.TPL)
     .Then(() => _service.GetDataAsync(_ticker, DateTime.Now.AddMonths(-1), DateTime.Now), Scheduler.Task.TPL)
     .Then(data => Items.AddRangeAsync(data), Scheduler.Dispatcher.TPL)
     .LogException(Log)
     .CatchAndHandle(x => StandardDialog.Error("Error", "Problem getting chart data"), Scheduler.Task.TPL)
     .Finally(BusyViewModel.InActive, Scheduler.Task.TPL);
 }
コード例 #10
0
ファイル: QuoteEditViewModel.cs プロジェクト: ganesum/Blitz
 private void NewQuote()
 {
     BusyViewModel.ActiveAsync("... Loading Quote ...")
     .Then(() => _service.GetInitialisationDataAsync(), Scheduler.Task.TPL)
     .Then(response => Instruments.AddRangeAsync(response.Instruments), Scheduler.Dispatcher.TPL)
     .Then(() => _service.NewQuoteAsync(), Scheduler.Task.TPL)
     .Do(model => Model = model, Scheduler.Task.TPL)
     .LogException(Log)
     .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem loading quote"), Scheduler.Task.TPL)
     .Finally(BusyViewModel.InActive, Scheduler.Task.TPL);
 }
コード例 #11
0
 private void Open(object sender, DataEventArgs <long> e)
 {
     BusyViewModel.ActiveAsync("... Opening Historic Report ...")
     .Then(() => Items.ClearAsync(), Scheduler.Dispatcher.TPL)
     .Then(() => Service.GenerateReportAsync(Service.CreateReportRequest(e.Value)), Scheduler.Task.TPL)
     .Then(response => Service.GenerateReportViewModelsAsync(response), Scheduler.Task.TPL)
     .Then(dataViewModels => Items.AddRangeAsync(dataViewModels), Scheduler.Dispatcher.TPL)
     .LogException(Log)
     .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem loading historic report"), Scheduler.Task.TPL)
     .Finally(BusyViewModel.InActive, Scheduler.Task.TPL);
 }
コード例 #12
0
ファイル: QuoteEditViewModel.cs プロジェクト: ganesum/Blitz
 private void Save()
 {
     BusyViewModel.ActiveAsync("... Saving Quote ...")
     .Then(() => _service.SaveQuoteAsync(Model), Scheduler.Task.TPL)
     .LogException(Log)
     .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem saving quote"), Scheduler.Task.TPL)
     .Finally(() =>
     {
         BusyViewModel.InActive();
         ClosingStrategy.Close();
     }, Scheduler.Task.TPL);
 }
コード例 #13
0
        private void ExportToExcel()
        {
            BusyViewModel.ActiveAsync("... Exporting to Excel ...")
            .Do(() => Service.ExportToExcel(_response), Scheduler.Task.TPL)
            .LogException(Log)
            .CatchAndHandle(x => StandardDialog.Error("Error", "Problem Exporting to Excel"), Scheduler.Task.TPL)
            .Finally(() =>
            {
                BusyViewModel.InActive();

                IsExpanded = false;
            }, Scheduler.Task.TPL);
        }
コード例 #14
0
        protected override Task OnInitialise()
        {
            return(BusyViewModel.ActiveAsync("... Loading ...")
                   .Then(() => Items.ClearAsync(), Scheduler.Dispatcher.TPL)
                   .Then(() => _historyViewModel.Items.ClearAsync(), Scheduler.Dispatcher.TPL)
                   .Then(() => Service.GetHistoryAsync(Service.CreateHistoryRequest()), Scheduler.Task.TPL)
                   .Then(response => Service.GenerateHistoryItemViewModelsAsync(response), Scheduler.Task.TPL)
                   .Do(dataViewModels =>
            {
                _historyViewModel.Items.AddRange(dataViewModels);

                Items.Add(_historyViewModel);
                _historyViewModel.ActivationStateViewModel.Activate();
            }, Scheduler.Dispatcher.TPL)
                   .LogException(Log)
                   .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem loading History"), Scheduler.Task.TPL)
                   .Finally(BusyViewModel.InActive, Scheduler.Task.TPL));
        }