Esempio n. 1
0
        public MainWindow()
        {
            InitializeComponent();

            var viewModel = new MainWindowViewModel(new ApplicationManager(), new DialogPresenter());
            DataContext = viewModel;
        }
Esempio n. 2
0
        public void UploadExceptionsTest()
        {
            String OrdersPath  = "Orders.txt";
            String TaxistsPath = "Taxists.txt";

            String WrongOrderPath = "WrongOrders.txt";

            //Order mock data
            String Destination = "Shevchenka, 12";
            String CarNumber   = "BC0173AC";
            String Where       = "University, 1";

            Models.status Status           = APPOINTED;
            int           PassengersAmount = 1;

            Order order = new Order(Where, Destination, PassengersAmount, Status, CarNumber);

            //Taxist mock data
            bool   isBusy = true;
            String Model  = "Tesla";
            String Number = "BC0173AC";

            Taxist taxist = new Taxist(Model, Number, isBusy);

            view            = new ViewModels.MainWindowViewModel(OrdersPath, TaxistsPath);
            view.OrdersPath = WrongOrderPath;
            view.Upload();
        }
Esempio n. 3
0
        public void SelectedOrderTest()
        {
            String OrdersPath  = "Orders.txt";
            String TaxistsPath = "Taxists.txt";

            //Order mock data
            String Destination = "Shevchenka, 12";
            String CarNumber   = "BC0173AC";
            String Where       = "University, 1";

            Models.status Status           = APPOINTED;
            int           PassengersAmount = 1;

            Order order = new Order(Where, Destination, PassengersAmount, Status, CarNumber);

            //Taxist mock data
            bool   isBusy = true;
            String Model  = "Tesla";
            String Number = "BC0173AC";

            Taxist taxist = new Taxist(Model, Number, isBusy);

            view = new ViewModels.MainWindowViewModel(OrdersPath, TaxistsPath);

            view.SelectedOrder = order;
            view.SelectedTaxi  = taxist;

            Assert.AreEqual(order, view.SelectedOrder);
            Assert.AreEqual(taxist, view.SelectedTaxi);
        }
Esempio n. 4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            //this.InitializeTracer();

            var window = new MainWindow();
            var view = new MainWindowViewModel();
            window.DataContext = view;
            window.Show();
        }
Esempio n. 5
0
        public void InitializationMainWindowTest()
        {
            String OrderPath  = "Orders.txt";
            String TaxistPath = "Taxists.txt";

            String ExpectedOrderPath  = "Orders.txt";
            String ExpectedTaxistPath = "Taxists.txt";

            view = new ViewModels.MainWindowViewModel(OrderPath, TaxistPath);
            Assert.AreEqual(ExpectedOrderPath, view.OrdersPath);
            Assert.AreEqual(ExpectedTaxistPath, view.TaxistsPath);
        }
Esempio n. 6
0
        public void WrongInitializePathesTest()
        {
            String WrongOrdersPath  = "WrongOrders.txt";
            String WrongTaxistsPath = "WrongTaxists.txt";

            String ExpectedOrdersPath  = "Orders.txt";
            String ExpectedTaxistsPath = "Taxists.txt";

            view = new ViewModels.MainWindowViewModel(WrongOrdersPath, WrongTaxistsPath);

            Assert.AreEqual(ExpectedOrdersPath, view.OrdersPath);
            Assert.AreEqual(ExpectedTaxistsPath, view.TaxistsPath);
        }
Esempio n. 7
0
        public MainWindow()
        {
            var statusReader = new StatusReader(new AntRegexGenerator());
            var mainWindowViewModel = new MainWindowViewModel(new DirectoryCrawler(statusReader))
            {
                Recursive = true,
                ProjectUri = Directory.GetCurrentDirectory(),
                Filter = @"**\bin\**"
            };
            mainWindowViewModel.SetupCommands();

            DataContext = mainWindowViewModel;
            InitializeComponent();
        }
Esempio n. 8
0
        public MainWindow()
        {
            InitializeComponent();

            ViewModel = new MainWindowViewModel();

            this.Closing += OnClosing;

            this.Activated += (sender, args) =>
            {
                var helper = new WindowInteropHelper(Application.Current.MainWindow);
                Win32Api.BringToFront(helper.Handle);
            };
        }
Esempio n. 9
0
        public void PathGetterAndSetterTest()
        {
            String OldOrdersPath  = "Orders.txt";
            String OldTaxistsPath = "Taxists.txt";

            String UpdatedOrdersPath  = "Orders1.txt";
            String UpdatedTaxistsPath = "Taxists1.txt";

            String ExpectedOrdersPath  = "Orders1.txt";
            String ExpectedTaxistsPath = "Taxists1.txt";

            view = new ViewModels.MainWindowViewModel(OldOrdersPath, OldTaxistsPath);

            view.OrdersPath  = UpdatedOrdersPath;
            view.TaxistsPath = UpdatedTaxistsPath;

            Assert.AreEqual(ExpectedOrdersPath, view.OrdersPath);
            Assert.AreEqual(ExpectedTaxistsPath, view.TaxistsPath);
        }
Esempio n. 10
0
        /// <summary>
        /// Notification for the changing of the DataContext for the Main Window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void MainWindow_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var viewModel = DataContext as MainWindowViewModel;

            if (null != viewModel)
            {
                this.vm = viewModel;
                viewModel.PropertyChanged += (sender1, eventArgs) =>
                {
                    switch (eventArgs.PropertyName)
                    {
                        case "VersionFault": // TODO figure out why binding is not working on the version control
                            VersionDisplay.VersionFault = viewModel.VersionFault;
                            break;

                        case "ErrorMessage":
                            if (!string.IsNullOrEmpty(viewModel.ErrorMessage))
                                MessageBoxService.Show(viewModel.ErrorMessage,
                                                       viewModel.ErrorMessageType,
                                                       MessageBoxButton.OK,
                                                       MessageBoxImage.Error);
                            break;
                    }
                };

                viewModel.WorkflowItems.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(WorkflowItems_CollectionChanged);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MainWindow"/> class.
 /// Mod. to example. Workaround of "lack" of call of the proper constructor of the view model
 /// Modified for explict injection of the view model, its a part of the workaround
 /// </summary>
 public MainWindow(MainWindowViewModel _mainwindowviewmodel)
     : base(_mainwindowviewmodel)
 {
     InitializeComponent();
 }
Esempio n. 12
0
        public MainWindow()
        {
            InitializeComponent();

            DataContext = new MainWindowViewModel();
        }
Esempio n. 13
0
        public MainWindow()
        {
            InitializeComponent();

            ViewModel = new MainWindowViewModel();
        }