public HelpAboutViewModel(IEventAggregator eventAggregator, IVersionCheck checker, IDaxStudioHost host) { _eventAggregator = eventAggregator; _host = host; DisplayName = "About DaxStudio"; CheckingUpdateStatus = true; UpdateStatus = "Checking for Updates..."; NotifyOfPropertyChange(() => UpdateStatus); // start version check async VersionChecker = checker; VersionChecker.PropertyChanged += VersionChecker_PropertyChanged; Task.Run(() => { this.VersionChecker.Update(); }) .ContinueWith((previous) => { // todo - should we be checking for exceptions in this continuation CheckingUpdateStatus = false; UpdateStatus = VersionChecker.VersionStatus; VersionIsLatest = VersionChecker.VersionIsLatest; DownloadUrl = VersionChecker.DownloadUrl; NotifyOfPropertyChange(() => VersionIsLatest); NotifyOfPropertyChange(() => DownloadUrl); NotifyOfPropertyChange(() => UpdateStatus); NotifyOfPropertyChange(() => CheckingUpdateStatus); }, TaskScheduler.Default); }
public ShellViewModel(IWindowManager windowManager, IEventAggregator eventAggregator, RibbonViewModel ribbonViewModel, StatusBarViewModel statusBar, IConductor conductor, IDaxStudioHost host, IVersionCheck versionCheck) { Ribbon = ribbonViewModel; Ribbon.Shell = this; StatusBar = statusBar; _windowManager = windowManager; _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); Tabs = (DocumentTabViewModel)conductor; Tabs.ConductWith(this); //Tabs.CloseStrategy = new ApplicationCloseStrategy(); Tabs.CloseStrategy = IoC.Get <ApplicationCloseAllStrategy>(); _host = host; if (_host.CommandLineFileName != string.Empty) { Tabs.NewQueryDocument(_host.CommandLineFileName); } else { Tabs.NewQueryDocument(); } VersionChecker = versionCheck; DisplayName = string.Format("DaxStudio - {0}", Version.ToString(3)); Application.Current.Activated += OnApplicationActivated; Log.Verbose("============ Shell Started - v{version} =============", Version.ToString()); //Execute.OnUIThread(() => { notifyIcon = new NotifyIcon(); }); }
public QueryResultsPaneViewModel(IEventAggregator eventAggregator, IDaxStudioHost host, IGlobalOptions options) : this(new DataTable("Empty")) { _eventAggregator = eventAggregator; //_eventAggregator.Subscribe(this); _host = host; _options = options; }
public QueryResultsPaneViewModel(IEventAggregator eventAggregator, IDaxStudioHost host, IGlobalOptions options) : this(new DataTable("Empty")) { _eventAggregator = eventAggregator; //_eventAggregator.Subscribe(this); _host = host; _options = options; var items = new ObservableCollection <ListItem>(ScreenUnitsHelper.GenerateScreenUnitList()); SizeUnits = new UnitViewModel(items, new ScreenConverter(_options.ResultFontSizePx), 0); //UpdateSettings(); }
public RibbonViewModel(IDaxStudioHost host, IEventAggregator eventAggregator, IWindowManager windowManager, OptionsViewModel options) { _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); _host = host; _windowManager = windowManager; Options = options; CanCut = true; CanCopy = true; CanPaste = true; RecentFiles = RegistryHelper.GetFileMRUListFromRegistry(); InitRunStyles(); }
public ConnectionDialogViewModel(string connectionString , IDaxStudioHost host , IEventAggregator eventAggregator , bool hasPowerPivotModel , DocumentViewModel document , ISettingProvider settingProvider , IGlobalOptions options) { try { _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); _connectionString = connectionString; _activeDocument = document; SettingProvider = settingProvider; _ppvtRegex = new Regex(@"http://localhost:\d{4}/xmla", RegexOptions.Compiled | RegexOptions.IgnoreCase); PowerPivotEnabled = true; Host = host; ServerModeSelected = true; Options = options; RefreshPowerBIInstances(); ParseConnectionString(); // load up dialog with values from ConnStr if (Host.IsExcel) { //using (new StatusBarMessage("Checking for PowerPivot model 2...")) //{ //bool hasPpvt = false; //HasPowerPivotModelAsync().ContinueWith(t => hasPpvt = t.Result).Wait(); if (hasPowerPivotModel) { ServerModeSelected = false; PowerPivotModeSelected = true; HasPowerPivotModel = true; } //} } WorkbookName = host.Proxy.WorkbookName; DisplayName = "Connect To"; //MdxCompatibility = "3 - (Default) Placeholder members are not exposed"; } catch (Exception ex) { Log.Error("{class} {method} {message} {stacktrace}", "ConnectionDialogViewModel", "ctor", ex.Message, ex.StackTrace); } }
public ConnectionDialogViewModel(string connectionString, IDaxStudioHost host, IEventAggregator eventAggregator, bool hasPowerPivotModel, DocumentViewModel document ) { try { _eventAggregator = eventAggregator; _connectionString = connectionString; _activeDocument = document; _ppvtRegex = new Regex(@"http://localhost:\d{4}/xmla", RegexOptions.Compiled | RegexOptions.IgnoreCase); PowerPivotEnabled = true; Host = host; ServerModeSelected = true; PowerBIHelper.Refresh(); if (PowerBIHelper.Instances.Count > 0) { PowerBIDesignerDetected = true; SelectedPowerBIInstance = PowerBIHelper.Instances[0]; NotifyOfPropertyChange(() => PowerBIDesignerDetected); NotifyOfPropertyChange(() => PowerBIDesignerInstances); NotifyOfPropertyChange(() => SelectedPowerBIInstance); } ParseConnectionString(); // load up dialog with values from ConnStr if (Host.IsExcel) { //using (new StatusBarMessage("Checking for PowerPivot model 2...")) //{ //bool hasPpvt = false; //HasPowerPivotModelAsync().ContinueWith(t => hasPpvt = t.Result).Wait(); if (hasPowerPivotModel) { ServerModeSelected = false; PowerPivotModeSelected = true; } //} } WorkbookName = host.Proxy.WorkbookName; DisplayName = "Connect To"; //MdxCompatibility = "3 - (Default) Placeholder members are not exposed"; } catch (Exception ex) { Log.Error("{class} {method} {message} {stacktrace}", "ConnectionDialogViewModel", "ctor", ex.Message, ex.StackTrace); } }
public RibbonViewModel(IDaxStudioHost host, IEventAggregator eventAggregator, IWindowManager windowManager, IGlobalOptions options, ISettingProvider settingProvider) { _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); _host = host; _windowManager = windowManager; SettingProvider = settingProvider; Options = options; _theme = Options.Theme; UpdateGlobalOptions(); CanCut = true; CanCopy = true; CanPaste = true; _sqlProfilerCommand = SqlProfilerHelper.GetSqlProfilerLaunchCommand(); RecentFiles = SettingProvider.GetFileMRUList(); InitRunStyles(); }
public HelpAboutViewModel(IEventAggregator eventAggregator, IVersionCheck checker, IDaxStudioHost host, IGlobalOptions options) { _eventAggregator = eventAggregator; _host = host; Options = options; DisplayName = "About DaxStudio"; CheckingUpdateStatus = true; NotifyOfPropertyChange(() => UpdateStatus); // start version check async VersionChecker = checker; VersionChecker.UpdateStartingCallback = this.VersionUpdateStarting; VersionChecker.UpdateCompleteCallback = this.VersionUpdateComplete; VersionChecker.PropertyChanged += VersionChecker_PropertyChanged; //Task.Run(() => // { // this.VersionChecker.Update(); // }) // .ContinueWith((previous)=> { // // checking for exceptions and log them // if (previous.IsFaulted) // { // Log.Error(previous.Exception, "{class} {method} {message}", nameof(HelpAboutViewModel), "ctor", $"Error updating version information: {previous.Exception.Message}"); // _eventAggregator.PublishOnUIThread(new OutputMessage(MessageType.Warning, "Unable to check for an updated release on github")); // CheckingUpdateStatus = false; // NotifyOfPropertyChange(() => CheckingUpdateStatus); // return; // } // CheckingUpdateStatus = false; // UpdateStatus = VersionChecker.VersionStatus; // VersionIsLatest = VersionChecker.VersionIsLatest; // DownloadUrl = VersionChecker.DownloadUrl; // NotifyOfPropertyChange(() => VersionIsLatest); // NotifyOfPropertyChange(() => DownloadUrl); // NotifyOfPropertyChange(() => UpdateStatus); // NotifyOfPropertyChange(() => CheckingUpdateStatus); // },TaskScheduler.Default); }
public HelpAboutViewModel(IEventAggregator eventAggregator, IVersionCheck checker, IDaxStudioHost host) { _eventAggregator = eventAggregator; _host = host; DisplayName = "About DaxStudio"; CheckingUpdateStatus = true; UpdateStatus = "Checking for Updates..."; NotifyOfPropertyChange(() => UpdateStatus); // start version check async VersionChecker = checker; VersionChecker.PropertyChanged += VersionChecker_PropertyChanged; Task.Run(() => { this.VersionChecker.Update(); }) .ContinueWith((previous) => { // checking for exceptions and log them if (previous.IsFaulted) { Log.Error(previous.Exception, "{class} {method} {message}", nameof(HelpAboutViewModel), "ctor", $"Error updating version information: {previous.Exception.Message}"); _eventAggregator.PublishOnUIThread(new OutputMessage(MessageType.Warning, "Unable to check for an updated release on github")); CheckingUpdateStatus = false; NotifyOfPropertyChange(() => CheckingUpdateStatus); return; } CheckingUpdateStatus = false; UpdateStatus = VersionChecker.VersionStatus; VersionIsLatest = VersionChecker.VersionIsLatest; DownloadUrl = VersionChecker.DownloadUrl; NotifyOfPropertyChange(() => VersionIsLatest); NotifyOfPropertyChange(() => DownloadUrl); NotifyOfPropertyChange(() => UpdateStatus); NotifyOfPropertyChange(() => CheckingUpdateStatus); }, TaskScheduler.Default); }
public ShellViewModel(IWindowManager windowManager , IEventAggregator eventAggregator , RibbonViewModel ribbonViewModel , StatusBarViewModel statusBar , IConductor conductor , IDaxStudioHost host , IVersionCheck versionCheck , IGlobalOptions options , IAutoSaver autoSaver ) { Ribbon = ribbonViewModel; Ribbon.Shell = this; StatusBar = statusBar; Options = options; AutoSaver = autoSaver; _windowManager = windowManager; _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); Tabs = (DocumentTabViewModel)conductor; Tabs.ConductWith(this); //Tabs.CloseStrategy = new ApplicationCloseStrategy(); Tabs.CloseStrategy = IoC.Get <ApplicationCloseAllStrategy>(); _host = host; _app = Application.Current; var recoveringFiles = false; // get master auto save indexes and only get crashed index files... var autoSaveInfo = AutoSaver.LoadAutoSaveMasterIndex(); var filesToRecover = autoSaveInfo.Values.Where(idx => idx.IsCurrentVersion && idx.ShouldRecover).SelectMany(entry => entry.Files); // check for auto-saved files and offer to recover them if (filesToRecover.Any()) { recoveringFiles = true; RecoverAutoSavedFiles(autoSaveInfo); } else { // if there are no auto-save files to recover, start the auto save timer eventAggregator.PublishOnUIThreadAsync(new StartAutoSaveTimerEvent()); } // if a filename was passed in on the command line open it if (!string.IsNullOrEmpty(_host.CommandLineFileName)) { Tabs.NewQueryDocument(_host.CommandLineFileName); } // if no tabs are open at this point and we are not recovering autosave file then, open a blank document if (Tabs.Items.Count == 0 && !recoveringFiles) { NewDocument(); } VersionChecker = versionCheck; #if PREVIEW DisplayName = string.Format("DaxStudio - {0} (PREVIEW)", Version.ToString(4)); #else DisplayName = string.Format("DaxStudio - {0}", Version.ToString(3)); #endif Application.Current.Activated += OnApplicationActivated; Log.Verbose("============ Shell Started - v{version} =============", Version.ToString()); AutoSaveTimer = new Timer(Constants.AutoSaveIntervalMs); AutoSaveTimer.Elapsed += new ElapsedEventHandler(AutoSaveTimerElapsed); }
public ResultsTargetExcelLinkedOdc(IDaxStudioHost host, IEventAggregator eventAggregator) { _host = host; _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); }
public ResultsTargetExcelStatic(IDaxStudioHost host) { _host = host; }
public ShellViewModel(IEventAggregator eventAggregator , RibbonViewModel ribbonViewModel , StatusBarViewModel statusBar , IConductor conductor , IDaxStudioHost host , IVersionCheck versionCheck , IGlobalOptions options , IAutoSaver autoSaver , IThemeManager themeManager) { Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", "Starting Constructor"); _utcSessionStart = DateTime.UtcNow; Ribbon = ribbonViewModel; Ribbon.Shell = this; StatusBar = statusBar; Options = options; AutoSaver = autoSaver; ThemeManager = themeManager; _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); Tabs = (DocumentTabViewModel)conductor; Tabs.ConductWith(this); //Tabs.CloseStrategy = new ApplicationCloseStrategy(); Tabs.CloseStrategy = IoC.Get <ApplicationCloseAllStrategy>(); _host = host; _username = UserHelper.GetUser(); var recoveringFiles = false; // get master auto save indexes and only get crashed index files... var autoSaveInfo = AutoSaver.LoadAutoSaveMasterIndex(); var filesToRecover = autoSaveInfo.Values.Where(idx => idx.IsCurrentVersion && idx.ShouldRecover).SelectMany(entry => entry.Files); // check for auto-saved files and offer to recover them if (filesToRecover.Any()) { Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", "Found auto-save files, beginning recovery"); recoveringFiles = true; RecoverAutoSavedFiles(autoSaveInfo); } else { // if there are no auto-save files to recover, start the auto save timer Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", "Starting auto-save timer"); eventAggregator.PublishOnUIThreadAsync(new StartAutoSaveTimerEvent()); } // if a filename was passed in on the command line open it if (!string.IsNullOrEmpty(_host.CommandLineFileName)) { Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", $"Opening file from command line: '{_host.CommandLineFileName}'"); Tabs.NewQueryDocument(_host.CommandLineFileName); } // if no tabs are open at this point and we are not recovering auto-save file then, open a blank document if (Tabs.Items.Count == 0 && !recoveringFiles) { Log.Debug(Constants.LogMessageTemplate, nameof(ShellViewModel), "ctor", "Opening a new blank query window"); NewDocument(); } VersionChecker = versionCheck; DisplayName = AppTitle; Application.Current.Activated += OnApplicationActivated; AutoSaveTimer = new Timer(Constants.AutoSaveIntervalMs); AutoSaveTimer.Elapsed += AutoSaveTimerElapsed; Log.Debug("============ Shell Started - v{version} =============", Version.ToString()); }
public ShellViewModel(IWindowManager windowManager , IEventAggregator eventAggregator , RibbonViewModel ribbonViewModel , StatusBarViewModel statusBar , IConductor conductor , IDaxStudioHost host , IVersionCheck versionCheck , ISettingProvider settingProvider) { Ribbon = ribbonViewModel; Ribbon.Shell = this; StatusBar = statusBar; SettingProvider = settingProvider; _windowManager = windowManager; _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); Tabs = (DocumentTabViewModel)conductor; Tabs.ConductWith(this); //Tabs.CloseStrategy = new ApplicationCloseStrategy(); Tabs.CloseStrategy = IoC.Get <ApplicationCloseAllStrategy>(); _host = host; _app = Application.Current; // TODO - get master auto save indexes and only get crashed index files... // check for auto-saved files and offer to recover them var autoSaveInfo = AutoSaver.LoadAutoSaveMasterIndex(); if (autoSaveInfo.Values.Where(idx => idx.ShouldRecover).Count() > 0) { RecoverAutoSavedFiles(autoSaveInfo); } else { // if a filename was passed in on the command line open it if (_host.CommandLineFileName != string.Empty) { Tabs.NewQueryDocument(_host.CommandLineFileName); } // if no tabs are open at this point open a blank one if (Tabs.Items.Count == 0) { NewDocument(); } // if there are no auto-save files to recover, start the auto save timer eventAggregator.PublishOnUIThreadAsync(new StartAutoSaveTimerEvent()); } VersionChecker = versionCheck; #if PREVIEW DisplayName = string.Format("DaxStudio - {0} (PREVIEW)", Version.ToString(4)); #else DisplayName = string.Format("DaxStudio - {0}", Version.ToString(3)); #endif Application.Current.Activated += OnApplicationActivated; Log.Verbose("============ Shell Started - v{version} =============", Version.ToString()); _autoSaveTimer = new Timer(Constants.AutoSaveIntervalMs); _autoSaveTimer.Elapsed += new ElapsedEventHandler(AutoSaveTimerElapsed); }
public ResultsTargetExcelLinked(IDaxStudioHost host) { _host = host; }