コード例 #1
0
        /// <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;
            }
        }
コード例 #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TrendConfigViewModel" /> class.
        /// </summary>
        /// <param name="trend">The trend delta v.</param>
        public TrendConfigViewModel(TrendDeltaV trend)
        {
            this.Trend  = trend;
            this._title = "Configure Chart";
            var collectionView = CollectionViewSource.GetDefaultView(trend.Pens);
            var editableView   = collectionView as IEditableCollectionView;

            this.CollectionView = collectionView;
        }
コード例 #3
0
        /// <summary>
        ///     Executes the Analyse Command.
        /// </summary>
        private void ExecuteNewTrendCommand()
        {
            // Newly created trend will replace current one. Hence, ensure current trend properties are saved
            if (!this.EnsureCurrentTrendSaved())
            {
                return;
            }

            var trend = new TrendDeltaV();

            trend.SetNew();
            var vm = new TrendConfigViewModel(trend);

            ServiceContext.ObjectWindowManager.OpenModalWindow(vm, true);
            if (vm.IsCommitRequired)
            {
                this.Trend = trend;
            }
        }
コード例 #4
0
        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;
            }
        }