Beispiel #1
0
        private void OpenFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = @"c:\temp\";
            openFileDialog.Filter           = "Strategy file (*.str)|*.str|All files (*.*)|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                _fileName = openFileDialog.FileName;
                Log.Trace(_fileName);
                StrategyViewModel.Read(_fileName);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(ILeanEngineService leanEngineService, LogViewModel logViewModel, StrategyViewModel strategyViewModel)
        {
            _leanEngineService = leanEngineService;
            LogViewModel       = logViewModel;
            StrategyViewModel  = strategyViewModel;

            OpenCommand   = new RelayCommand(() => OpenFile(), () => !IsBusy);
            SaveCommand   = new RelayCommand(() => SaveFile(), () => !IsBusy && !string.IsNullOrEmpty(_fileName));
            SaveAsCommand = new RelayCommand(() => SaveAsFile(), () => !IsBusy);
            ExitCommand   = new RelayCommand <Window>(window => Close(window), window => !IsBusy);
            AboutCommand  = new RelayCommand(() => About(), () => !IsBusy);
            RunCommand    = new RelayCommand(async() => await RunBacktest(), () => !IsBusy);
        }
Beispiel #3
0
        private void SaveAsFile()
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.InitialDirectory = @"c:\temp\";
            saveFileDialog.Filter           = "Strategy file (*.str)|*.str|All files (*.*)|*.*";
            if (saveFileDialog.ShowDialog() == true)
            {
                _fileName = saveFileDialog.FileName;
                Log.Trace(_fileName);
                StrategyViewModel.Save(_fileName);
            }
        }
        public TrackViewModel(StrategyViewModel parent, TrackModel model, AccountsModel accounts, SettingModel settings)
        {
            _parent   = parent;
            Model     = model;
            _accounts = accounts;
            _settings = settings;

            StartCommand          = new RelayCommand(() => DoStartTaskCommand(), () => !IsBusy && !Active);
            StopCommand           = new RelayCommand(() => DoStopTaskCommand(), () => !IsBusy && Active);
            DeleteCommand         = new RelayCommand(() => DoDeleteTrack(), () => !IsBusy && !Active);
            UseParametersCommand  = new RelayCommand(() => DoUseParameters(), () => !IsBusy && !Active);
            ExportSymbolsCommand  = new RelayCommand <IList>(m => DoExportSymbols(m), m => !IsBusy);
            CloneStrategyCommand  = new RelayCommand <IList>(m => DoCloneStrategy(m), m => !IsBusy);
            ExportCommand         = new RelayCommand(() => { }, () => false);
            CloneCommand          = new RelayCommand(() => DoCloneStrategy(null), () => !IsBusy);
            CloneAlgorithmCommand = new RelayCommand(() => { }, () => false);

            DataFromModel();
        }
Beispiel #5
0
 private void SaveFile()
 {
     Debug.Assert(!string.IsNullOrEmpty(_fileName));
     Log.Trace(_fileName);
     StrategyViewModel.Save(_fileName);
 }
Beispiel #6
0
 public ParameterViewModel(StrategyViewModel parent, ParameterModel model)
 {
     _parent = parent;
     Model   = model;
 }