/// <summary> /// Executes the Analyse Command. /// </summary> private void ExecuteOpenTrendCommand() { var dialog = ServiceLocator.Instance.ResolveType <IFileDialogService>().CreateOpenFileDialog(); dialog.InitialDirectory = TrendDeltaV.Folder; dialog.Filter = "Trends|*.xml|All files (*.*)|*.*"; dialog.Title = "Trend Browser"; if (dialog.ShowDialog() != true) { return; } TrendDeltaV trend; if (TrendDeltaV.TryLoad(dialog.FileName, out trend)) { // Ensure current thread saved if (!this.EnsureCurrentTrendSaved()) { return; } this.Trend = trend; } }
public ProcessHistoryChart() { this.InitializeComponent(); this._currentSpan = TimeSpan.Zero; if (Designer.IsInDesignModeStatic) { return; } this.Loaded += (sender, e) => this.DataContext = this; // Reload last opened Trend this._settings = ServiceContext.ConfigurationService["TrendsDeltaV"]; var lastOpenedPathfilename = this._settings.GetProperty("LastOpened", string.Empty); TrendDeltaV trend; if (!string.IsNullOrWhiteSpace(lastOpenedPathfilename) && TrendDeltaV.TryLoad(lastOpenedPathfilename, out trend)) { this.Trend = trend; } }