Пример #1
0
        public MainViewModel()
        {
            #region ralay command initialization
            RefreshMidiDevicesCommand = new RelayCommand(() =>
            {
                MidiSettingsVM.RefreshOutDeviceNames();
            });

            SaveCommand = new RelayCommand(() =>
            {
                string fileName;
                if (ViewModelLocator.UIService.ShowSaveFileDialog("BlockSet", ".xml", "xml files (.xml)|*.xml", out fileName) == true)
                {
                    SerializationTools.WriteObject(fileName, BlocksSetVM.BlocksSet);
                }
            });

            LoadCommand = new RelayCommand(() =>
            {
                LoadProject();
            });

            ShowVideoWindow = new RelayCommand(() => ViewModelLocator.UIService.ShowVideoWindow());

            ShowJointsMap = new RelayCommand(() => ViewModelLocator.UIService.ShowJointsMap());
            #endregion ralay command initialization

            BlocksSetVM     = new ConditionsMappingSetViewModel(new BlocksSet());
            m_sensorChooser = new KinectSensorChooser();
            if (!GalaSoft.MvvmLight.ViewModelBase.IsInDesignModeStatic)
            {
                Init();
            }
        }
Пример #2
0
        private void LoadProject()
        {
            string fileName;

            if (ViewModelLocator.UIService.ShowOpenFileDialog(".xml", "xml files (.xml)|*.xml", out fileName) == true)
            {
                var blocksSet = SerializationTools.ReadObject(fileName);
                if (blocksSet == null)
                {
                    WarningHelper.ShowWarning(Resources.WarningMessage_CannotLoadProject);
                }
                else
                {
                    WarningHelper.HideWarning();
                    var blocksSetVM = new ConditionsMappingSetViewModel(blocksSet);
                    BlocksSetVM = blocksSetVM;
                }
            }
        }