Пример #1
0
        /// <summary> Saves this object. </summary>
        private void Save()
        {
            string defaultPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), App.Company, App.ApplicationName);

            if (!Directory.Exists(defaultPath))
            {
                Directory.CreateDirectory(defaultPath);
            }

            SaveFileDialog saveFileDialog = new SaveFileDialog
            {
                CheckPathExists  = true,
                CheckFileExists  = false,
                FileName         = "ELLSequence.ell",
                DefaultExt       = ".ell",
                Filter           = "Elliptec Sequence (.ell)|*.ell",
                InitialDirectory = defaultPath
            };

            bool?result = saveFileDialog.ShowDialog();

            if (!result.GetValueOrDefault(false))
            {
                return;
            }
            string path = saveFileDialog.FileName;

            ELLSequenceXML.Save(_sequence, path);
        }
Пример #2
0
        private void Load()
        {
            _sequence = new ELLSequenceXML();
            string defaultPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), App.Company, App.ApplicationName);

            if (!Directory.Exists(defaultPath))
            {
                Directory.CreateDirectory(defaultPath);
            }
            OpenFileDialog openFileDialog = new OpenFileDialog
            {
                CheckFileExists  = true,
                FileName         = String.IsNullOrEmpty(defaultPath) ? "EllSequence.ell" : defaultPath,
                DefaultExt       = ".ell",
                Filter           = "Elliptec Sequence (.ell)|*.ell",
                InitialDirectory = defaultPath
            };

            bool?result = openFileDialog.ShowDialog();

            if (!result.GetValueOrDefault(false))
            {
                return;
            }

            _sequence = ELLSequenceXML.Load(openFileDialog.FileName);
            BuildList(null);
            RaisePropertyChanged(() => RepeatRun);
            RaisePropertyChanged(() => RepeatContinuously);
            RaisePropertyChanged(() => RepeatCount);
        }
Пример #3
0
 /// <summary> Constructor. </summary>
 /// <param name="owner">	 The owner. </param>
 /// <param name="ellDevices"> The Elliptec device. </param>
 public ELLSequenceViewModel(ELLDevicesViewModel owner, ELLDevices ellDevices)
 {
     _owner      = owner;
     _ellDevices = ellDevices;
     _sequence   = new ELLSequenceXML();
     Items       = new ObservableCollection <ELLSequenceItemViewModel>();
 }