Пример #1
0
        public ViewModel()
        {
            _applicationStateModel = new ApplicationStateModel();
            _configurationManager  = new ConfigurationManager();
            _configurationModel    = _configurationManager.Load();
            if (_configurationModel.PresetCollection.Count == 0)
            {
                _configurationModel.PresetCollection.Add(new Preset()
                {
                    Name = "New Preset"
                });
            }
            _openFileManager = new OpenFileManager();
            _soundManager    = new SoundManager(_configurationModel);
            _shortcutManager = new ShortcutManager(_applicationStateModel, _configurationModel, _soundManager);
            _updateManager   = new UpdateManager();

            _presetConfigurationViewModel = new PresetConfigurationViewModel(_applicationStateModel, _configurationModel);

            _configurationModel.PropertyChanged += (sender, e) => _configurationManager.Save((ConfigurationModel)sender);

            _configurationModel.CounterShortcuts.Next.Command      = NextCounterCommand;
            _configurationModel.CounterShortcuts.Previous.Command  = PreviousCounterCommand;
            _configurationModel.CounterShortcuts.Increment.Command = IncrementCommand;
            _configurationModel.CounterShortcuts.Decrement.Command = DecrementCommand;
            _configurationModel.CounterShortcuts.Reset.Command     = ResetCommand;
            _configurationModel.SoundShortcuts.Pause.Command       = PauseCommand;
            _configurationModel.SoundShortcuts.Continue.Command    = ContinueCommand;
            _configurationModel.SoundShortcuts.Stop.Command        = StopCommand;

            Task.Run(() => _updateManager.AutoUpdateCheck(Version));
        }
Пример #2
0
        public ViewModel()
        {
            ApplicationStateModel = new ApplicationStateModel();
            _configurationManager = new ConfigurationManager();
            ConfigurationModel    = _configurationManager.Load();

            if (ConfigurationModel.PresetCollection.Count == 0)
            {
                ConfigurationModel.PresetCollection.Add(new Preset()
                {
                    Name = "New Preset"
                });
            }

            _openFileManager = new OpenFileManager();
            _soundManager    = new SoundManager(ConfigurationModel);
            _shortcutManager = new ShortcutManager(ApplicationStateModel, ConfigurationModel, _soundManager);
            _updateManager   = new UpdateManager();

            PresetConfigurationViewModel = new PresetConfigurationViewModel(ApplicationStateModel, ConfigurationModel);

            ConfigurationModel.PropertyChanged += (sender, e) => _configurationManager.Save((ConfigurationModel)sender);

            ConfigurationModel.SoundShortcuts.Pause.Command    = PauseCommand;
            ConfigurationModel.SoundShortcuts.Continue.Command = ContinueCommand;
            ConfigurationModel.SoundShortcuts.Stop.Command     = StopCommand;

            Task.Run(() => _updateManager.AutoUpdateCheck(Version));
        }
Пример #3
0
        public MultiSoundViewModel(ApplicationStateModel applicationStateModel, ConfigurationModel configurationModel)
        {
            ApplicationStateModel = applicationStateModel;
            ConfigurationModel    = configurationModel;

            _openFileManager   = new OpenFileManager();
            _newSelectedSounds = new ObservableCollection <Sound>();
        }
Пример #4
0
        public ScreensWindow(MainWindowManager manager, string deathScreen, string endScreen)
        {
            InitializeComponent();

            this.manager     = manager;
            openFileManager  = new OpenFileManager();
            this.deathScreen = deathScreen;
            this.endScreen   = endScreen;

            InitializeValues();
        }
Пример #5
0
        public PreviewImageWindowEnemy(Enemy enemy, bool edit)
        {
            InitializeComponent();

            openFileManager = new OpenFileManager();
            this.enemy      = enemy;
            this.edit       = edit;

            if (edit)
            {
                image = SetImageLabel(enemy.PreviewImage, PreviewImageLabel);
            }
        }
Пример #6
0
        public PreviewImageWindowCharacter(Character character, bool edit)
        {
            InitializeComponent();

            openFileManager = new OpenFileManager();
            this.character  = character;
            this.edit       = edit;

            if (edit)
            {
                image = SetImageLabel(character.PreviewImage, PreviewImageLabel);
            }
        }
Пример #7
0
        public WallWindow(MainWindowManager manager, bool edit, BackgroundItem bgItem)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;
            this.bgItem     = bgItem;

            if (edit)
            {
                SetValues();
            }
        }
Пример #8
0
        public StageWindow(MainWindowManager manager, bool edit, Stage stage)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;
            this.stage      = stage;

            if (edit)
            {
                SetValues();
            }
        }
Пример #9
0
        public NPCWindow(MainWindowManager manager, bool edit, NPC npc)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;
            this.npc        = npc;

            if (edit)
            {
                SetValues();
            }
        }
Пример #10
0
        public ConsumableWindow(MainWindowManager manager, bool edit, Consumable consumable)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;
            this.consumable = consumable;

            if (edit)
            {
                SetValues();
            }
        }
Пример #11
0
        public DoorKeyWindow(MainWindowManager manager, bool edit, Door door, KeyItem key)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;
            this.door       = door;
            this.key        = key;

            if (edit)
            {
                SetValues();
            }
        }
Пример #12
0
        public AbilityWindow(MainWindowManager manager, bool edit, Ability ability)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;
            this.ability    = ability;

            if (edit)
            {
                SetValues();
            }

            InitializeValues();
        }
Пример #13
0
 private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (e.ClickCount == 2)
     {
         string fullPath        = ((Grid)((TextBlock)sender).Parent).ToolTip.ToString();
         var    openFileManager = OpenFileManager.GetInstance();
         if (Directory.Exists(fullPath))
         {
             openFileManager.OpenFileInExplorer(fullPath);
         }
         else
         {
             openFileManager.OpenFileInVisualStudio(fullPath);
         }
     }
 }
Пример #14
0
        public WeaponWindow(MainWindowManager manager, bool edit, Weapon weapon)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;
            this.weapon     = weapon;

            if (edit)
            {
                SetValues();
            }

            InitializeValues();
        }
Пример #15
0
        public CharacterWindow(MainWindowManager manager, bool edit)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;

            InitializeLists();

            if (edit)
            {
                SetValues();
            }

            InitializeValues();
        }
Пример #16
0
        public EnemyWindow(MainWindowManager manager, bool edit, Enemy enemy)
        {
            InitializeComponent();

            this.manager    = manager;
            openFileManager = new OpenFileManager();
            this.edit       = edit;
            this.enemy      = enemy;

            InitializeList();

            if (edit)
            {
                SetValues();
            }

            InitializeValues();
        }
Пример #17
0
        private void OpenInDefaultProgram_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menuItem = sender as MenuItem;

            if (menuItem == null)
            {
                return;
            }
            ContextMenu parentContextMenu = menuItem.CommandParameter as ContextMenu;
            var         grid = parentContextMenu?.PlacementTarget as Grid;

            if (grid == null)
            {
                return;
            }
            string fullPath = grid.ToolTip.ToString();

            OpenFileManager.GetInstance().OpenInDefaultProgram(fullPath);
        }
Пример #18
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Command.Initialize(this);
            base.Initialize();

            OpenFileManager.CreateInstance(this);

            var    extensionUtility         = new ExtensionUtility(typeof(CommandPackage));
            string extensionPath            = extensionUtility.GetExtensionPath();
            var    everythingProcessManager = new EverythingProcessManager(extensionPath);

            bool serviceIsStartedNow = false;

            if (!everythingProcessManager.IsServiceInstalled())
            {
                everythingProcessManager.InstallService();
                serviceIsStartedNow = true;
            }
            else if (!everythingProcessManager.IsServiceRunning())
            {
                everythingProcessManager.StartService();
                serviceIsStartedNow = true;
            }
            // if only service is running
            if (everythingProcessManager.GetNumberOfEverythingProcess() <= 1)
            {
                if (serviceIsStartedNow)
                {
                    // wait untill service will be fine
                    System.Threading.Thread.Sleep(3000);
                }
                everythingProcessManager.StartClientInBackgroundMode();
            }

            var everythingManager = new EverythingManager();

            everythingManager.Init(extensionPath);
            EverythingSearchTask.CommandPackage = this;
        }
Пример #19
0
 void Awake()
 {
     _instance = this;
 }