Esempio n. 1
0
        public DataProvider(AppMode appMode)
        {
            XmlRepository  = new XmlRepository(this);
            CommonSettings = XmlRepository.LoadCommonSettings();
            if (CommonSettings == null)
            {
                CommonSettings = new CommonSettings {
                    IsSet = false
                }
            }
            ;
            else
            {
                CommonSettings.IsSet = true;
            }
            VariablesRepository = new VariablesRepository(this);
            ObjectsRepository   = new ObjectsRepository(this);

            CommonSettings.AppMode         = appMode;
            CommonSettings.AppModeChanged += delegate { ObjectsRepository.SwitchAppMode(); };

            ProjectRepository = new ProjectRepository(this);
            DialogsManager    = new DialogsManager(this);
            TabsRepository    = new TabsRepository(this);
            WindowsManager    = new WindowsManager(this);
        }
Esempio n. 2
0
 public StringVariableWrapper(string name, VariablesRepository variablesRepository, bool isAssigned = false)
 {
     _variablesRepository = variablesRepository;
     Name       = name;
     IsAssigned = isAssigned;
     SetDefault();
 }
 public ObjectActionProperties(IVariableWrapper variable, VariablesRepository variablesRepository, ObjectsRepository objectsRepository)
 {
     _variablesRepository = variablesRepository;
     _objectsRepository   = objectsRepository;
     Variable             = variable;
     Actions = new List <ObjectAction>();
 }
Esempio n. 4
0
 public VariableEditorViewModel(DataProvider dataProvider, IVariableWrapper variable = null)
 {
     _variablesRepository = dataProvider.VariablesRepository;
     _dialogsHelper       = dataProvider.DialogsManager;
     _isCreateMode        = variable == null;
     Title    = $"{(variable == null ? "Создание" : "Редактирование")} переменной";
     Switcher = new ValuesSwitcherViewModel(dataProvider, variable, _isCreateMode);
 }
Esempio n. 5
0
 public ProjectSettings(VariablesRepository variablesRepository)
 {
     _variablesRepository = variablesRepository;
     Width            = 450;
     Height           = 600;
     Title            = "Новый проект";
     ShowTargetFile   = false;
     OpenTargetFolder = true;
 }
Esempio n. 6
0
        /// <summary>
        /// Открывает Редактор переменных
        /// </summary>
        public async Task OpenVariableEditor(
            VariablesRepository repository,
            IVariableWrapper variable = null,
            WindowType hostIdentifier = WindowType.Root)
        {
            var viewModel = new VariableEditorViewModel(_dataProvider, variable);
            var view      = new VariableEditor {
                ViewModel = viewModel
            };

            await DialogHost.Show(view, Common.GetEnumDescription(hostIdentifier));
        }
Esempio n. 7
0
        /// <summary>
        /// Открывает Редактор действий для редактирования действия
        /// </summary>
        public async Task <ObjectAction> OpenActionEditor(
            ObjectAction selectedAction,
            IEnumerable <ObjectAction> actions,
            ObjectsRepository objectsRepository, VariablesRepository variablesRepository,
            WindowType hostIdentifier = WindowType.Root)
        {
            var viewModel = new ActionEditorViewModel(selectedAction.Clone(), actions, _dataProvider);
            var view      = new ActionEditor {
                ViewModel = viewModel
            };

            await DialogHost.Show(view, Common.GetEnumDescription(hostIdentifier));

            return(viewModel.IsSaved ? viewModel.Action : null);
        }
 public VariablesViewerViewModel(DataProvider dataProvider)
 {
     Settings                 = dataProvider.CommonSettings.VariablesViewerSettings;
     _variablesRepository     = dataProvider.VariablesRepository;
     _objectsRepository       = dataProvider.ObjectsRepository;
     _dialogsHelper           = dataProvider.DialogsManager;
     FilteredVariables.Source = _variablesRepository.Variables;
     FilteredVariables.View.CollectionChanged         += OnFilteredChanged;
     _variablesRepository.Variables.CollectionChanged += delegate { UpdateTitle(); };
     Title = "Переменные";
     dataProvider.CommonSettings.AppModeChanged += delegate
     {
         IsInEditMode = dataProvider.CommonSettings.AppMode == AppMode.Editor;
     };
 }
        public ObjectBrowserViewModel(DataProvider dataProvider)
        {
            _objectsRepository   = dataProvider.ObjectsRepository;
            _variablesRepository = dataProvider.VariablesRepository;
            _dialogsHelper       = dataProvider.DialogsManager;
            _rootPath            = dataProvider.CommonSettings.RootPath;
            Settings             = dataProvider.CommonSettings.ObjectBrowserSettings;
            InvariantVariable    = new ValuesSwitcherViewModel(dataProvider, isCreateMode: false);
            HasVariable          = false;

            _unsavedChanges = new List <IObjectViewModel>();
            _objectsRepository.SelectionChanged += SetSelected;
            _objectsRepository.Unselected       += OnUnselected;

            InvariantVariable.VariableChanged += delegate { VariableIsChanged = true; };
            Actions.CollectionChanged         += ActionsChanged;
            Actions.Clear();
        }
Esempio n. 10
0
        public ValuesSwitcherViewModel(DataProvider dataProvider, IVariableWrapper variable = null,
                                       bool isCreateMode = true, bool isSubscribedToUpdates = false)
        {
            _variablesRepository = dataProvider.VariablesRepository;
            _dialogsManager      = dataProvider.DialogsManager;

            if (variable == null)
            {
                IsEnabled    = false;
                IsCreateMode = isCreateMode;
                Variable     = CreateVariable(VariableType.String);
            }
            else
            {
                IsEnabled    = true;
                IsCreateMode = isCreateMode;
                Variable     = variable.Clone();
                OldName      = Variable.Name;
            }

            HasChanges = false;
        }
Esempio n. 11
0
 public TagReplacer(VariablesRepository variablesRepository)
 {
     _variablesRepository = variablesRepository;
 }
Esempio n. 12
0
 public ObjectTextProperties(VariablesRepository variablesRepository)
 {
     _variablesRepository = variablesRepository;
     SetDefault();
 }