internal OrderStatusViewModel(OrderStatusView view, string ordererPersonalNo)
 {
     this.view = view;
     this.ordererPersonalNo = ordererPersonalNo;
     Orders = LoadOrders(ordererPersonalNo);
     Order  = new tblOrder();
 }
示例#2
0
        void Submit(object obj)
        {
            string password  = (obj as PasswordBox).Password;
            var    validate  = new Validations.Validations();
            var    constants = new Constants();

            if (UserName == "Zaposleni" && SecurePasswordHasher.Verify(password, constants.passwordEmployeeHashed))
            {
                EmployeeView employeeView = new EmployeeView(UserName);
                loginView.Close();
                employeeView.Show();
                return;
            }

            else if (validate.IsValidPersonalNoFormat(UserName) && SecurePasswordHasher.Verify(password, constants.passwordGuestHashed))
            {
                DataAccess dataAccess = new DataAccess();
                if (validate.IsPersonalNoInDb(UserName, dataAccess.LoadPersonalNumbers()))
                {
                    OrderStatusView oldQuestView = new OrderStatusView(UserName);

                    //loginView.Close();
                    oldQuestView.Show();
                    var timer = new DispatcherTimer {
                        Interval = TimeSpan.FromSeconds(2)
                    };
                    timer.Start();
                    timer.Tick += (sender, args) =>
                    {
                        timer.Stop();
                        NewGuestView guestView = new NewGuestView(UserName);
                        loginView.Close();
                        oldQuestView.Close();
                        guestView.Show();
                    };

                    return;
                }
                NewGuestView newGuestView = new NewGuestView(UserName);
                loginView.Close();
                newGuestView.Show();
                return;
            }
            else
            {
                WarningView warning = new WarningView(loginView);
                warning.Show("User name or password are not correct!");
                return;
            }
        }
示例#3
0
        protected override void OnViewModelSet()
        {
            base.OnViewModelSet();
            if (ViewModel != null)
            {
                ViewModel.OnViewLoaded();
                ViewModel.SubscribeLifetimeChangedIfNecessary();
            }

            var screenSize = new Point();

            WindowManager.DefaultDisplay.GetSize(screenSize);

            SetContentView(Resource.Layout.View_Home);

            _bigButton = (Button)FindViewById(Resource.Id.BigButtonTransparent);

            _orderOptions           = (OrderOptions)FindViewById(Resource.Id.orderOptions);
            _dropOffSelection       = (DropOffSelection)FindViewById(Resource.Id.dropOffSelection);
            _orderReview            = (OrderReview)FindViewById(Resource.Id.orderReview);
            _orderEdit              = (OrderEdit)FindViewById(Resource.Id.orderEdit);
            _orderAirport           = (OrderAirport)FindViewById(Resource.Id.orderAirport);
            _searchAddress          = (AddressPicker)FindViewById(Resource.Id.searchAddressControl);
            _appBar                 = (AppBar)FindViewById(Resource.Id.appBar);
            _frameLayout            = (FrameLayout)FindViewById(Resource.Id.RelInnerLayout);
            _btnSettings            = FindViewById <LinearLayout>(Resource.Id.btnSettings);
            _btnLocation            = FindViewById <LinearLayout>(Resource.Id.btnLocation);
            _appBarBookingStatus    = FindViewById <AppBarBookingStatus>(Resource.Id.appBarBookingStatus);
            _appBarDropOffSelection = FindViewById <AppBarDropOffSelection>(Resource.Id.appBarDropOffSelection);
            _orderStatus            = FindViewById <OrderStatusView>(Resource.Id.orderStatus);

            // attach big invisible button to the OrderOptions to be able to pass it to the address text box and clear focus when clicking outside
            _orderOptions.BigInvisibleButton     = _bigButton;
            _dropOffSelection.BigInvisibleButton = _bigButton;

            ((ViewGroup.MarginLayoutParams)_orderOptions.LayoutParameters).TopMargin = 0;
            ((ViewGroup.MarginLayoutParams)_orderReview.LayoutParameters).TopMargin  = screenSize.Y;
            ((ViewGroup.MarginLayoutParams)_orderAirport.LayoutParameters).TopMargin = screenSize.Y;

            var orderEditLayout = _orderEdit.GetLayoutParameters();

            var isRightToLeftLanguage = this.Services().Localize.IsRightToLeft;

            _orderEdit.SetLayoutParameters(screenSize.X, orderEditLayout.Height,
                                           isRightToLeftLanguage ? orderEditLayout.LeftMargin : screenSize.X,
                                           isRightToLeftLanguage ? screenSize.X : orderEditLayout.RightMargin,
                                           orderEditLayout.TopMargin, orderEditLayout.BottomMargin, orderEditLayout.Gravity);

            ((ViewGroup.MarginLayoutParams)_orderStatus.LayoutParameters).TopMargin = -screenSize.Y;

            // Creating a view controller for MapFragment
            var mapViewSavedInstanceState = _mainBundle != null?_mainBundle.GetBundle("mapViewSaveState") : null;

            _touchMap = (TouchableMap)FragmentManager.FindFragmentById(Resource.Id.mapPickup);
            _touchMap.OnCreate(mapViewSavedInstanceState);
            MapFragment = new OrderMapFragment(_touchMap, Resources, this.Services().Settings);

            var inputManager = (InputMethodManager)ApplicationContext.GetSystemService(InputMethodService);

            MapFragment.TouchableMap.Surface.Touched += (sender, e) =>
            {
                inputManager.HideSoftInputFromWindow(Window.DecorView.RootView.WindowToken, HideSoftInputFlags.None);
            };

            _orderReview.ScreenSize = screenSize;
            _orderReview.OrderReviewHiddenHeightProvider = () => _frameLayout.Height - _orderOptions.Height;
            _orderReview.OrderReviewShownHeightProvider  = () => _orderOptions.Height;
            _orderEdit.ScreenSize        = screenSize;
            _orderEdit.ParentFrameLayout = _frameLayout;

            _orderAirport.ScreenSize = screenSize;
            _orderAirport.OrderAirportHiddenHeightProvider = () => _frameLayout.Height - _orderOptions.Height;
            _orderAirport.OrderAirportShownHeightProvider  = () => _orderOptions.Height;

            ResumeFromBackgroundIfNecessary();

            SetupHomeViewBinding();

            PanelMenuInit();
        }