Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            _dishViewModel = new DishViewModel();
            _dishWindow = new DishWindow
            {
                DataContext = _dishViewModel
            };

            _ingredientsViewModel = new IngredientsViewModel();
            _ingredientsWindow = new IngredientsWindow
            {
                DataContext = _ingredientsViewModel
            };

            _preparationViewModel = new PreparationViewModel();
            _preparationWindow = new PreparationWindow
            {
                DataContext = _preparationViewModel
            };

            _mainViewModel = new MainViewModel(_dishWindow, _ingredientsWindow, _preparationWindow);
            _mainWindow = new MainWindow
            {
                DataContext = _mainViewModel
            };

            _mainWindow.Show();
        }
Пример #2
0
        public void Setup()
        {
            // mockDialogService = MockRepository.GenerateStub<IDialogService>();
            mockDialogService = new DialogService();

            _mainViewModel = new MainViewModel(mockDialogService);
        }
Пример #3
0
 public MainWindow(MainViewModel viewModel, IEventAggregator eventAggregator)
 {
     InitializeComponent();
     this.viewModel = viewModel;
     DataContext = this.viewModel;
     this.eventAggregator = eventAggregator;
     this.eventAggregator.GetEvent<CloseApplicationEvent>().Subscribe(OnCloseApp);
 }
Пример #4
0
        public MainView()
        {
            ViewModel = new MainViewModel();
            Load();
            InitializeComponent();
            DataContext = ViewModel;

            VersionNumber.Content = Globals.VersionNumber;
        }
Пример #5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            MainViewModel ViewModel = new MainViewModel();
            var window = new Views.MainWindow
            {
                DataContext = ViewModel
            };

            window.ShowDialog();
        }
Пример #6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            CompositionRoot.Wire(new Bindings());
            viewModel = CompositionRoot.Resolve<MainViewModel>();
            base.OnStartup(e);

            viewModel.RequestClose += ViewModelRequestClose;

            window.DataContext = viewModel;
            window.Closing += Window_Closing;
            window.Show();
        }
        public void Run()
        {
            var dir = Directory.GetCurrentDirectory();

            string filepath = dir + "\\..\\..\\..\\..\\data\\coords.csv";

            var dataAccess = new DataAccess.DataAccess(filepath);

            var vm = new MainViewModel(dataAccess);
            var mainWindow = new MainWindow { DataContext = vm };
            mainWindow.Show();
        }
        /// <summary>
        /// Uses the values in UI.
        /// </summary>
        /// <param name="vm">The MainViewModel.</param>
        internal static void UseValuesInUI(MainViewModel vm)
        {
            vm.Output = "Starting: Getting Around the UI Sample...";

            vm.Output = string.Format("Attack Weak Base Settings: Attack their King is {0}", vm.IsAttackTheirKing);

            if (vm.IsAttackTheirKing)
                vm.Output = "I'm sorry but we don't want you to attack their King";

            vm.IsAttackTheirKing = false; // I don't think we should change an User's value in the UI, but we can

            vm.Output = string.Format("Attack Weak Base Settings: Attack their King is {0}", vm.IsAttackTheirKing);

            vm.Output = "Ending: Getting Around the UI Sample...";
        }
Пример #9
0
		protected override async void OnStartup(StartupEventArgs e)
		{
			string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			path        = Path.Combine(path, @"My Games\Skyrim\Settings.json");
			
			settings         = await Settings.Load(path);
			viewModel = new MainViewModel(settings);

			if (MainWindow == null)
			{
				MainWindow = new MainWindow();
			}

			MainWindow.DataContext = viewModel;
			MainWindow.Show();
		}
Пример #10
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            if (MainWindow == null)
            {
                MainWindow = new MainWindow();
            }

            viewModel = new MainViewModel();

            MainWindow.DataContext = viewModel;
            MainWindow.Show();

            Task.Factory.StartNew(() =>
                                  {
                                      Task.Delay(1000).Wait();

                                      viewModel.ServerList.UpdateServerList();
                                  });
        }
Пример #11
0
        private void Load()
        {
            MessagingService.Register(this, MessagingService_messages);
            App.SplashScreen.AddMessage("Applying Theme...");
            Thread.Sleep(500);
            ApplyTheme();
            App.SplashScreen.AddMessage("Loading Settings...");
            Thread.Sleep(500);
            ApplySettings();
            App.SplashScreen.AddMessage("Loading Books...");

            ViewModel = new MainViewModel();

            var savedTileWidth = Settings.Default.TileWidth;
            ViewModel.TileWidth = savedTileWidth == 0 ? 130 : savedTileWidth;

            ViewModel.TileWidth = 130;

            App.SplashScreen.LoadComplete();
        }
Пример #12
0
 public MainView(MainViewModel viewModel)
 {
     Ensure.ArgumentNotNull(viewModel, nameof(viewModel));
     this.Router = viewModel.Router;
 }
 public MainView()
 {
     InitializeComponent(); 
     
     BindingContext = new MainViewModel();
 }
Пример #14
0
        public MainController(
            IObservable<EventType> environmentEvents1,
            IFactory<OptionsController> optionsController,
            MainViewModel viewModel,
            ContinuousConfigurator continuousConfigurator,
            IOptionsManager optionsManager,
            IHostEnviromentConnection host,
            CommonServices svc)
        {
            _optionsController = optionsController;
            _viewModel = viewModel;
            _continuousConfigurator = continuousConfigurator;
            _optionsManager = optionsManager;
            _host = host;
            _sessionFinished = new Subject<string>();
            _controlSource = new Subject<ControlEvent>();
            _svc = svc;

            _viewModel.CommandCreateNewMutants = new SmartCommand(() => RunMutationSession(),
                () => _viewModel.OperationsState.IsIn(OperationsState.None, OperationsState.Finished, OperationsState.Error))
                .UpdateOnChanged(_viewModel, () => _viewModel.OperationsState);

            _viewModel.CommandPause = new SmartCommand(PauseOperations, 
                () => _viewModel.OperationsState.IsIn(OperationsState.Testing))
                .UpdateOnChanged(_viewModel, () => _viewModel.OperationsState);

            _viewModel.CommandStop = new SmartCommand(StopOperations,
                () => _viewModel.OperationsState.IsIn(OperationsState.Mutating, OperationsState.PreCheck,
                    OperationsState.Testing, OperationsState.TestingPaused, OperationsState.Pausing))
                .UpdateOnChanged(_viewModel, () => _viewModel.OperationsState);

            _viewModel.CommandContinue = new SmartCommand(ResumeOperations,
                () => _viewModel.OperationsState == OperationsState.TestingPaused)
                .UpdateOnChanged(_viewModel, () => _viewModel.OperationsState);

            _viewModel.CommandSaveResults = new SmartCommand(SaveResults, () =>
                _viewModel.OperationsState == OperationsState.Finished)
                .UpdateOnChanged(_viewModel, () => _viewModel.OperationsState);

            _viewModel.CommandOptions = new SmartCommand(() => ShowOptions(),
                () => _viewModel.OperationsState.IsIn(OperationsState.None, OperationsState.Finished, OperationsState.Error))
                .UpdateOnChanged(_viewModel, () => _viewModel.OperationsState);
            _viewModel.CommandTest = new SmartCommand(Test);


            _disp = new List<IDisposable>
                    {
                        environmentEvents1
                            .Where(e => e == EventType.HostOpened)
                            .Subscribe(type =>
                            {
                                Initialize();
                                continuousConfigurator.CreateConfiguration();
                            }),
                        environmentEvents1
                            .Where(e => e == EventType.HostClosed)
                            .Subscribe(type =>
                            {
                                continuousConfigurator.DisposeConfiguration();
                                Deactivate();
                            }),
                        environmentEvents1
                            .Where(e => e == EventType.BuildBegin)
                            .Subscribe(type => continuousConfigurator.DisposeConfiguration()),

                        environmentEvents1
                            .Where(e => e == EventType.BuildDone)
                            .Subscribe(type => continuousConfigurator.CreateConfiguration()),

                        _optionsManager.Events
                            .Where(e => e == OptionsManager.EventType.Updated)
                            .Subscribe(t =>
                            {
                                continuousConfigurator.DisposeConfiguration();
                                continuousConfigurator.CreateConfiguration();
                            }),
                    };

        }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainWindow"/> class.
 /// </summary>
 /// <param name="viewModel">The view model to inject.</param>
 /// <remarks>
 /// This constructor can be used to use view-model injection.
 /// </remarks>
 public MainWindow(MainViewModel viewModel)
     : base(viewModel, DataWindowMode.Custom)
 {
     InitializeComponent();
 }
Пример #16
0
        public MainWindow()
        {
            InitializeComponent();

            Loaded += (sender, args) => _mainViewModel = (MainViewModel) DataContext;
        }
Пример #17
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Navigation.Navigation.Service = MainFrame.NavigationService;

            DataContext = new MainViewModel(new ViewModelsResolver());
        }
Пример #18
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new MainViewModel();
 }
Пример #19
0
 public MainView(MainViewModel viewModel)
 {
     viewModel.AssertNotNull(nameof(viewModel));
     this.Router = viewModel.Router;
 }
Пример #20
0
        /// <summary>
        /// Initializes the Bot.
        /// </summary>
        public static void Initialize(MainViewModel vm)
        {
            // Store in properties so we can access in the SubFunctions
            Bot = vm;

            Bot.Output = string.Format(Properties.Resources.OutputWelcomeMessage, Properties.Resources.AppName);
            Bot.Output = Properties.Resources.OutputBotIsStarting;

            // Check if BlueStack is running
            FastFindWrapper.SetHWnd(BlueStackHelper.GetBlueStackWindowHandle(), true);
            if (!BlueStackHelper.IsBlueStackRunning)
            {
                Bot.Output = Properties.Resources.OutputBSNotFound;

                Bot.IsExecuting = false;
                return;
            }

            if (!BlueStackHelper.IsRunningWithRequiredDimensions)
            {
                Bot.Output = Properties.Resources.OutputBSNotRunningWithDimensions;
                Bot.Output = Properties.Resources.OutputBSApplyDimensionsIntoRegistry;

                if (!BlueStackHelper.SetDimensionsIntoRegistry())
                {
                    // Woops! Something went wrong, log the error!
                    Bot.Output = Properties.Resources.OutputBSApplyDimensionsError;

                    Bot.IsExecuting = false;
                    return;
                }
                else
                    Bot.Output = Properties.Resources.OutputBSAppliedDimensionsIntoRegistry;

                // Restart BlueStack
                // Wait until restart and continue...

                BlueStackHelper.ActivateBlueStack();
            }

            CreateDirectory(GlobalVariables.LogPath);
            CreateDirectory(GlobalVariables.ScreenshotZombieAttacked);
            CreateDirectory(GlobalVariables.ScreenshotZombieSkipped);

            WriteLicense();

            // Run Everything related to the bot in the background
            var thread = new Thread(() =>
            {
                while (Bot.IsExecuting)
                {
                    Thread.Sleep(1000);
                    //Bot.Output = "Loop test...";
                    //Bot.Output = "Minimum Gold is: " + Bot.MinimumGold; // Changing values on the fly works as expected
                    //Bot.Output = "Try changing values on the fly.";

                    MainScreen.CheckMainScreen();
                    Thread.Sleep(1000);

                    MainScreen.ZoomOut();
                    Thread.Sleep(1000);

                    Village.TrainTroops();
                    Thread.Sleep(1000);

                    Village.RequestTroops();
                    Thread.Sleep(1000);

                    //SubFunctions.Village.Collect();

                    //Idle();

                    //SubFunctions.Attack.AttackMain();
                };
            })
            {
                IsBackground = true
            };
            thread.Start();
        }