public void OnOk(Window win) { if (this.CurrentViewModel is GoogleHistoryViewModel) { GoogleHistoryViewModel gh = this.CurrentViewModel as GoogleHistoryViewModel; this.m_history = gh.Adapt <GoogleHistory>(); this.m_history.OnRetrievedDataHandler = History_OnRetrievedData; this.m_history.ExecuteAsync(); this.CurrentViewModel = new LoadingViewModel(); this.IsOkButtonVisible = false; this.RaisePropertyChanged(null); } else if (this.CurrentViewModel is LoadingViewModel) { } else if (this.CurrentViewModel is DataResultViewModel) { this.OnCancel(win); DataResultViewModel dvm = this.CurrentViewModel as DataResultViewModel; if (ExcelHandler.WriteToRangeHandler != null) { ExcelHandler.WriteToRangeHandler(dvm.Result, dvm.GH); } } }
private void History_OnRetrievedData(GoogleHistory gh, object[,] result) { DataResultViewModel dvm = new DataResultViewModel(); dvm.GH = gh; dvm.Result = result; this.CurrentViewModel = dvm; this.IsOkButtonVisible = true; this.IsCancelButonVisible = false; this.RaisePropertyChanged(null); }