Example #1
0
        public void ResetCounterCommand_SendsResetAction()
        {
            var sut = new MainPageModel(_store);

            sut.ResetCounterCommand.Execute(null);
            Assert.Equal(new Actions.ResetCounter(), _store.ReceivedActions[0]);
        }
Example #2
0
        public void IncrementCounterCommand_SendsIncrementAction()
        {
            var sut = new MainPageModel(_store);

            sut.IncrementCounterCommand.Execute("1");
            Assert.Equal(new Actions.IncrementCounter(1), _store.ReceivedActions[0]);
        }
 public MainPage()
 {
     this.InitializeComponent();
     DataContext = (Model = new MainPageModel());
     LoadCategories();
     LoadRecords();
 }
Example #4
0
 public MainPage()
 {
     InitializeComponent();
     ClickedCommand = new Command(Execute);
     Model          = new MainPageModel();
     BindingContext = this;
 }
 public ChangeUpdateMangaCommand(bool needUpdate, MainPageModel model) : base(model)
 {
     CanExecuteNeedSelection = true;
     this.NeedUpdate         = needUpdate;
     this.Name = needUpdate ? Strings.Manga_NotUpdate : Strings.Manga_Update;
     this.Icon = needUpdate ? "pack://application:,,,/Icons/Manga/not_update.png" : "pack://application:,,,/Icons/Manga/need_update.png";
 }
Example #6
0
        public FirstPage(MainPageModel model)
        {
            InitializeComponent();
            Model = new MainPageModel();
            Model.Event_GridHeaderComplete += new EventHandler <InvokeOperationEventArgs <string> >(GridHeaderComplete);
            Model.init();
            this.DataContext = Model;
            #region 给页面按钮添加图片
            Img_Top.Source      = new BitmapImage(new Uri(GetUrl.GetAbsoluteUrl("Images/Btn_Up.png"), UriKind.Absolute));
            RadBtn_Query.Image  = new BitmapImage(new Uri(GetUrl.GetAbsoluteUrl("Images/Buttons/Query32.png"), UriKind.Absolute));
            RadBtn_Insert.Image = new BitmapImage(new Uri(GetUrl.GetAbsoluteUrl("Images/Buttons/Add32.png"), UriKind.Absolute));
            RadBtn_Update.Image = new BitmapImage(new Uri(GetUrl.GetAbsoluteUrl("Images/Buttons/Edit32.png"), UriKind.Absolute));
            RadBtn_Delete.Image = new BitmapImage(new Uri(GetUrl.GetAbsoluteUrl("Images/Buttons/Delete32.png"), UriKind.Absolute));
            RadBtn_Excel.Image  = new BitmapImage(new Uri(GetUrl.GetAbsoluteUrl("Images/Buttons/Excel32.png"), UriKind.Absolute));
            #endregion


            #region 注册事件
            RadBtn_Query.MouseLeftButtonDown += new MouseButtonEventHandler(RadBtn_Query_MouseLeftButtonDown);
            RadBtn_Query.Click  += new System.Windows.RoutedEventHandler(RadBtn_Query_Click);
            RadBtn_Insert.Click += new System.Windows.RoutedEventHandler(RadBtn_Insert_Click);
            RadBtn_Update.Click += new System.Windows.RoutedEventHandler(RadBtn_Update_Click);
            RadBtn_Delete.Click += new System.Windows.RoutedEventHandler(RadBtn_Delete_Click);
            RadBtn_Excel.MouseLeftButtonDown += new MouseButtonEventHandler(RadBtn_Excel_Click);
            #endregion

            #region 注册model里的事件
            Model.Event_QueryDataSuccess += new EventHandler <ConstsEventArgs>(model_QueryDataSuccess);
            Model.Event_QueryDataFailure += new EventHandler <ConstsEventArgs>(model_QueryDataFailure);
            #endregion
        }
 public MainPageViewModel()
 {
     if (Constantes.Places == null)
     {
         Constantes.Places = MainPageModel.GetPlaces();
     }
 }
        //[ValidateAntiForgeryToken]
        public ActionResult Index(MainPageModel mpm)
        {
            System.Diagnostics.Debug.WriteLine("Before Modification");
            System.Diagnostics.Debug.WriteLine(mpm.idUser);
            System.Diagnostics.Debug.WriteLine(mpm.infoId);
            Info inf = mpm.makeInfo();
            User usr = mpm.makeUser();

            inf.idUser = mpm.idUser;
            if (ModelState.IsValid)
            {
                _db.Entry(inf).State = EntityState.Modified;
                _db.Entry(usr).State = EntityState.Modified;
                try
                {
                    _db.SaveChanges();
                }
                catch (DbEntityValidationException e) {
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        System.Diagnostics.Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                           eve.Entry.Entity.GetType().Name, eve.Entry.State);
                        foreach (var ve in eve.ValidationErrors)
                        {
                            System.Diagnostics.Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                               ve.PropertyName, ve.ErrorMessage);
                        }
                    }
                    throw;
                }
                return(RedirectToAction("Index"));
            }
            return(View(mpm));
        }
 public MainPage()
 {
     InitializeControls();
     SetBindings();
     Content        = CreateLayout();
     BindingContext = new MainPageModel(this);
 }
Example #10
0
        public ActionResult AddImage(MainPageModel mainModel, HttpPostedFileBase file)
        {
            //salvam imaginea in baza de date
            Stock stockmodel = new Stock();
            User  userModel  = new User();

            using (ProductDataBaseEntities db = new ProductDataBaseEntities())
            {
                stockmodel.ProductCollection = db.Products.ToList <Product>();
            }
            mainModel.stock = stockmodel;

            using (LoginDataBaseEntities db = new LoginDataBaseEntities())
            {
                mainModel.user = db.Users.Where(x => x.UserID == mainModel.user.UserID).FirstOrDefault();
            }

            mainModel.user.ConfirmPassword = mainModel.user.Password;
            string fileName  = Path.GetFileNameWithoutExtension(file.FileName);
            string extension = Path.GetExtension(file.FileName);

            fileName = fileName + DateTime.Now.ToString("yymmssfff") + mainModel.user.UserName.ToString() + extension;
            mainModel.user.ImagePath = "~/Image/" + fileName;
            fileName = Path.Combine(Server.MapPath("~/Image/"), fileName);
            file.SaveAs(fileName);
            // pana aici se salveaza in fisier, mai trebuie modificat in baza de date
            using (LoginDataBaseEntities db = new LoginDataBaseEntities())
            {
                db.Entry(mainModel.user).State = EntityState.Modified;
                db.SaveChanges();
            }
            ModelState.Clear();
            Session["ImagePath"] = mainModel.user.ImagePath;
            return(View("Index", mainModel));
        }
Example #11
0
        private void OnRatesUpdated(object sender, EventArgs e)
        {
            MainPageModel model = BindingContext as MainPageModel;

            model.Updated         = CurrencyRatesModel.Instance.Updated;
            model.IsNotRefreshing = true;
        }
Example #12
0
        public void Constructor_InitializesCounterValueToStoreValue()
        {
            _store.SetState(new AppState(99));
            var sut = new MainPageModel(_store);

            Assert.Equal(99, sut.CounterValue);
        }
Example #13
0
 public OpenFolderCommand(MainPageModel model) : base(model)
 {
     this.baseCommand = new OpenFolderCommandBase();
     this.Name        = baseCommand.Name;
     this.Icon        = baseCommand.Icon;
     this.NeedRefresh = false;
 }
Example #14
0
        public async Task <IActionResult> Index()
        {
            var model = new MainPageModel
            {
                Countries = Country.List.Values.Select(x => x.Name).ToList(),
                Assets    = new List <string> {
                    "BTC", "ETH"
                },
                IncomingTransactions = (await _transactionsManager.GetIncomingTransactionsAsync())
                                       .Select(x => new SimplifiedTransactionModel
                {
                    Id = x.Id,
                    CreationDateTime  = x.CreationDateTime,
                    Status            = x.Status,
                    StatusStringified = Stringify(x.Status)
                })
                                       .ToList(),
                OutgoingTransactions = (await _transactionsManager.GetOutgoingTransactionsAsync())
                                       .Select(x => new SimplifiedTransactionModel {
                    Id = x.Id,
                    CreationDateTime  = x.CreationDateTime,
                    Status            = x.Status,
                    StatusStringified = Stringify(x.Status)
                })
                                       .ToList()
            };

            return(View(model));
        }
 private Tuple <object, string> HandleResult(MainPageModel mainPageModel, Either <string, TestsMatchResult> result)
 {
     return(result.Match(
                Right: matchResult => Tuple.Create(new CheckResultPageModel(matchResult) as object, CheckView),
                Left: message => HandleError(mainPageModel, message)
                ));
 }
 public void CheckMainLabel()
 {
     pageModel  = new MainPageModel(driver);
     driver.Url = Urls.mainPage;
     pageModel.FindMainLabel();
     Assert.AreEqual("Международный IT-колледж", pageModel.GetTextFromMainLabel());
 }
Example #17
0
        public MainPage(IDatabaseService databaseService)
        {
            InitializeComponent();
            _databaseService = databaseService;

            BindingContext = new MainPageModel(_databaseService);
        }
Example #18
0
 public MainPage(IApiController apiController)
 {
     InitializeComponent();
     //_apiController = apiController;
     pageModel      = new MainPageModel(this);
     BindingContext = pageModel;
 }
Example #19
0
 public ActionResult Login(MainPageModel model)
 {
     using (DbEntities db = new DbEntities())
     {
         var personObject = db.People
                            .Include("Role")
                            .Where(x => x.EmailAddress == model.loginModel.Email && x.Password == model.loginModel.Password).FirstOrDefault();
         if (personObject != null)
         {
             Session.Add("userId", personObject.Id);
             Session.Add("username", personObject.FullName);
             if (personObject.FK_Role == Convert.ToInt64(ERole.ADMIN))
             {
                 Session.Add("Admin", true);
                 return(RedirectToAction("Index", "Admin"));
             }
             else
             {
                 Session.Add("Admin", false);
                 return(RedirectToAction("Index", "Home"));
             }
         }
         return(RedirectToAction("Register"));
     }
 }
Example #20
0
        private async void UploadCSVFile(object sender, RoutedEventArgs e)
        {
            Button uploadFileBtn = sender as Button;

            uploadFileBtn.IsEnabled = false;
            try
            {
                Process.SetInitialStatus("Открытие файла");
                CSVService.UpdateFilePath(filePathTextBox.Text);
                IFileService <TunnelExit> csvService = CSVService.CSVServiceObject;

                Process.UpdateStatus("Чтение данных");
                var tunnelsList = await csvService.ReadAsync();

                Process.UpdateStatus("Отображение данных");
                await Task.Run(() => MainPageModel.PageModel.CreateNewTunnelData(tunnelsList));

                await MainPageModel.UploadDelegate();

                int damagedRecNum = MainPageModel.PageModel.NumberOfDamagedRecords;
                Process.SetFinalStatus($"Файл загружен\n" + ((damagedRecNum == 0) ? string.Empty
                    : $"Кол-во повреждений: {damagedRecNum}"), true);
            }
            catch (Exception ex)
            {
                Process.SetFinalStatus("Файл не загружен", false);
                ExceptionHandler.Handler.HandleExceptionWithMessageBox(ex,
                                                                       "Ошибка при загрузке файла");
            }
            finally
            {
                uploadFileBtn.IsEnabled = true;
            }
        }
Example #21
0
        public void CounterValue_Updates_WhenStoreValueChanges()
        {
            var sut = new MainPageModel(_store);

            _store.Publish(Projections.CounterValue, 5);
            Assert.Equal(5, sut.CounterValue);
        }
Example #22
0
        public MainPage()
        {
            InitializeComponent();

            _syncContext = SynchronizationContext.Current;

            PageModel            = new MainPageModel(_syncContext);
            MainGrid.DataContext = PageModel;

            _loadPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "touhou_luna_nights");
            if (!Directory.Exists(_loadPath))
            {
                Directory.CreateDirectory(_loadPath);
            }
            _save0Path = Path.Combine(_loadPath, "game0.sav");
            _save1Path = Path.Combine(_loadPath, "game1.sav");
            _save2Path = Path.Combine(_loadPath, "game2.sav");

            _saveEditor  = new SaveEditor();
            _imagePacker = new ImagePacker(_syncContext);

            ErrorTracker.UpdateError += ErrorTrackerUpdateError;

            Task.Run(ProcessCurrentSaves);
        }
Example #23
0
        public void ResetItemsCommand_SendsResetItemsAction()
        {
            var sut = new MainPageModel(_store);

            sut.ResetItemsCommand.Execute(null);
            Assert.IsType <Actions.ResetItems>(_store.ReceivedActions[0]);
        }
Example #24
0
        public void AddItemCommand_SendsAddItemAction()
        {
            var sut = new MainPageModel(_store);

            sut.AddItemCommand.Execute(null);
            Assert.IsType <Actions.AddItem>(_store.ReceivedActions[0]);
        }
        public ActionResult Index(MainPageModel sm)
        {
            MainPageModel   data         = new MainPageModel();
            GetPropertyData propertydata = new GetPropertyData();

            try
            {
                if (ModelState.IsValid)
                {
                    data.AllProperty = propertydata.GetAllProperty(sm.SearchModel);

                    //ContactModel con = new ContactModel();
                    //status = con.InsertVisitor(ct);

                    ModelState.Clear();
                }
                else
                {
                    data.AllProperty = propertydata.GetAllProperty();
                }
            }
            catch
            {
            }
            CallList();

            return(View(data));
        }
 protected MultipleMangasBaseCommand(MainPageModel model) : base(model.Library)
 {
     PageModel                    = model;
     this.NeedRefresh             = true;
     this.CanExecuteNeedSelection = false;
     this.CanExecuteChanged      += OnCanExecuteChanged;
 }
 public void TheSiteIsOpenInTheGoogleChrome()
 {
     driver            = BaseDriver.GetDriver();
     mainPageModel     = BaseDriver.GetMainPageModel();
     feedbackPageModel = BaseDriver.GetFeedbackPageModel();
     driver.Url        = "https://text-compare.com";
 }
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            LogsModel     = new Logs();
            MainPageModel = new MainPageModel();

            _notifServerApi = App.NotifServerApi;

            SetNotificationEnabled(false);
            UiStateToStopped(true);

            // DataContexts
            this.ActivitySlider.DataContext       = CameraViewfinder.CameraData;
            this.ActivitySlider.Style             = Application.Current.Resources["CustomSliderStyle_Yellow"] as Style;
            this.CameraTresholdSlider.DataContext = CameraViewfinder.CameraData;

            // Custom screensaver
            _screensaverControl = new ScreenSaver(this.LayoutRoot, this.ApplicationBar);

            // Read Ovi accout id from isolated storage
            string usernameFromStore;

            if (ReadUsername(out usernameFromStore))
            {
                MainPageModel.OviAccountId = usernameFromStore;
            }

            // Load sounds
            StreamResourceInfo alarmStream = Application.GetResourceStream(
                new Uri("SoundFiles/26173__wim__sirene-06080401.wav", UriKind.RelativeOrAbsolute));

            _alarmSound = SoundEffect.FromStream(alarmStream.Stream);

            StreamResourceInfo waitAlarmSound = Application.GetResourceStream(
                new Uri("SoundFiles/31841__hardpcm__chip001.wav", UriKind.RelativeOrAbsolute));

            _waitAlarmSound = SoundEffect.FromStream(waitAlarmSound.Stream);

            StreamResourceInfo radioStream = Application.GetResourceStream(
                new Uri("SoundFiles/30335__erh__radio-noise-2.wav", UriKind.RelativeOrAbsolute));

            _radioSound = SoundEffect.FromStream(radioStream.Stream);

            StreamResourceInfo radioStream2 = Application.GetResourceStream(
                new Uri("SoundFiles/30623__erh__do-it-now-2.wav", UriKind.RelativeOrAbsolute));

            _radioSound2 = SoundEffect.FromStream(radioStream2.Stream);

            StreamResourceInfo radioStream3 = Application.GetResourceStream(
                new Uri("SoundFiles/27878__inequation__walkietalkie-eot.wav", UriKind.RelativeOrAbsolute));

            _radioSound3 = SoundEffect.FromStream(radioStream3.Stream);

            StreamResourceInfo radioStream4 = Application.GetResourceStream(
                new Uri("SoundFiles/34383__erh__walk-away.wav", UriKind.RelativeOrAbsolute));

            _radioSound4 = SoundEffect.FromStream(radioStream4.Stream);
        }
Example #29
0
        public async void LlenarMenu()
        {
            MainPageModel oMainPageModel = new MainPageModel();

            listViewPrincipal.ItemsSource   = null;
            listViewPrincipal.ItemsSource   = oMainPageModel.ObtenerMenu();
            listViewPrincipal.ItemSelected += OnClickOpcionSeleccionada;
        }
Example #30
0
        public MainPage()
        {
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, false);

            BindingContext = new MainPageModel();
        }
Example #31
0
        private void LoadPage(GeoCoordinate center, double zoomLevel)
        {
            if (Model != null)
            {
                map.SetView(center, zoomLevel);
                AddMyLocation();

                foreach (var rack in Model.Racks)
                {
                    AddRackToMap(rack);
                }
            }
            else
            {
                Model = new MainPageModel();
                map.SetView(new GeoCoordinate(59.91786, 10.739735), 13);
            }

            Model.Racks.CollectionChanged += Racks_CollectionChanged;

            var service = new ClearChannelService.ClearChannelSoapClient();
            service.getRacksCompleted += service_getRacksCompleted;
            service.getRacksAsync();
        }
Example #32
0
        // = new MvcApp.BookServiceReference.BookEntitiModel(new Uri("http://booksstore.apphb.com/BookWCFDataService.svc"));
        public ActionResult Index(MainPageModel mod)
        {
            if (mod.SearchModel!=null)
            {
                return this.RedirectToAction("SearchResult", "Home",mod.SearchModel);
            }

            var model = new BookEntitiModel(new Uri("http://booksstore.apphb.com/BookWCFDataService.svc"));
            var response = (from context in model.Books
                        select new Book { AvatarURL = context.AvatarURL, Title = context.Title, BookID = context.BookID }).ToList();

            ViewBag.Message = "Головна сторінка";

            var result = new MainPageModel() { BooksModel = response };

            return View(result);
        }
Example #33
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            GeoCoordinate center = null;
            double zoomLevel = 0;

            if (State.ContainsKey("Model"))
            {
                Model = State["Model"] as MainPageModel;
                center = State["Center"] as GeoCoordinate;
                zoomLevel = (double)State["ZoomLevel"];
            }

            LoadPage(center, zoomLevel);
        }
 // Constructor
 public MainWindow()
 {
     InitializeComponent();
     Model = new MainPageModel();
     Loaded += MainWindow_Loaded;
 }