Esempio n. 1
0
 public virtual void Open()
 {
     if (CurrentWindow != null)
     {
         CurrentWindow.Close();
     }
     gameObject.SetActive(true);
 }
Esempio n. 2
0
        public static void FinalizarApp(this object obj)
        {
            if (CurrentWindow == null)
            {
                return;
            }

            CurrentWindow.Close();
        }
Esempio n. 3
0
        public override void Act(KeyboardState kb, MouseState ms)
        {
            if (kb[Key.Escape] && GetCurrentTimeInMilliseconds() > 500)
            {
                CurrentWindow.Close();
            }


            for (int i = 0; i < _buttons.Length; i++)
            {
                if (_buttons[i].IsMouseCursorOnMe(ms) || _numbers[i].IsMouseCursorOnMe(ms))
                {
                    _numbers[i].SetGlow(_colors[i].X, _colors[i].Y, _colors[i].Z, _colors[i].W);
                    _buttons[i].SetGlow(_colors[i].X, _colors[i].Y, _colors[i].Z, _colors[i].W);

                    if (ms.LeftButton == ButtonState.Pressed)
                    {
                        switch (i)
                        {
                        case 0:
                            CurrentWindow.SetWorld(new GameWorld01());
                            return;

                        case 1:
                            CurrentWindow.SetWorld(new GameWorld02());
                            return;

                        case 2:
                            CurrentWindow.SetWorld(new GameWorld03());
                            return;

                        case 3:
                            CurrentWindow.SetWorld(new GameWorld04());
                            return;

                        case 4:
                            CurrentWindow.SetWorld(new GameWorld05());
                            return;

                        default:
                            return;
                        }
                    }
                }
                else
                {
                    _numbers[i].SetGlow(_colors[i].X, _colors[i].Y, _colors[i].Z, 0);
                    _buttons[i].SetGlow(_colors[i].X, _colors[i].Y, _colors[i].Z, 0);
                }
            }
        }
        private void CreateNewAccountExecute(object parameter)
        {
            Object[]    parameters  = parameter as Object[];
            String      username    = parameters[0] as String;
            String      password    = parameters[1] as String;
            String      firstName   = parameters[2] as String;
            String      lastName    = parameters[3] as String;
            object      roleRegular = parameters[4];
            object      roleAdmin   = parameters[5];
            UserControl CreateNewAccountUserControl = parameters[6] as UserControl;

            AccountToAdd = new Account(username)
            {
                FirstName = firstName,
                LastName  = lastName,
                Password  = password,
                Role      = (bool)roleRegular ? ERole.REGULAR : ERole.ADMIN,
            };


            Account createdAccount = null;

            try
            {
                createdAccount = AccountProxy.CreateNewAccount(AccountToAdd);
            }
            catch (Exception e)
            {
                logger.Error($"Error while deleting - server side. Message: {e.Message}");
                LoggerHelper.Instance.LogMessage($"Error while deleting - server side. Message: {e.Message}", EEventPriority.ERROR, EStringBuilder.CLIENT);
            }
            if (createdAccount != null)
            {
                AccountsList.Add(createdAccount);

                logger.Error($"Account successfuly added.");
                LoggerHelper.Instance.LogMessage($"Account successfuly added.", EEventPriority.ERROR, EStringBuilder.CLIENT);

                CurrentWindow = Window.GetWindow(CreateNewAccountUserControl);
                CurrentWindow.Close();
            }
            else
            {
                logger.Error($"Error on server or username already exists.");
                LoggerHelper.Instance.LogMessage($"Error on server or username already exists.", EEventPriority.ERROR, EStringBuilder.CLIENT);

                CurrentWindow = Window.GetWindow(CreateNewAccountUserControl);
                CurrentWindow.Close();
            }
        }
Esempio n. 5
0
 /// <summary>
 /// timer Tick Method
 /// </summary>
 /// <param name="sender">Object Parameter</param>
 /// <param name="e">Argument parameter</param>
 private void Timer_Tick(object sender, EventArgs e)
 {
     if (this.IsTimerStart)
     {
         if (GetIdleTime() > this.TickTimeCount)
         {
             ////LockWorkStation();
             if (this.CurrentWindow != null)
             {
                 Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                 {
                     CurrentWindow.Close();
                 }));
             }
         }
     }
 }
Esempio n. 6
0
        private void Cancel()
        {
            if (IsSaveEnabled || IsFindEnabled)
            {
                CurrentWindow.Close();
            }

            if (IsUpdateEnabled)
            {
                ModifyMode();
            }
            else if (IsModifyEnabled)
            {
                FindMode();

                Clear();
            }
        }
        private void AddPersonExecute(object parameter)
        {
            Object[] parameters = parameter as Object[];
            PersonToAdd = new Person()
            {
                FirstName = parameters[0] as String,
                LastName  = parameters[1] as String,
                JMBG      = parameters[2] as String,
            };

            Person addedPerson = null;

            try
            {
                addedPerson = PersonProxy.AddPerson(PersonToAdd);
            }
            catch (Exception e)
            {
                logger.Error("AddPerson error on server.");
                LoggerHelper.Instance.LogMessage($"AddPerson error on server. Message: {e.Message}", EEventPriority.ERROR, EStringBuilder.CLIENT);
            }

            if (addedPerson != null)
            {
                CommandInvoker.RegisterCommand(new AddPersonCommand(new PersonCommandReciever(), PersonToAdd, PersonProxy));

                logger.Error("Person successfully added.");
                LoggerHelper.Instance.LogMessage($"Person successfully added.", EEventPriority.INFO, EStringBuilder.CLIENT);

                UserControl uc = parameters[3] as UserControl;
                CurrentWindow = Window.GetWindow(uc);
                CurrentWindow.Close();
            }
            else
            {
                logger.Error("Error on server or username already exists.");
                LoggerHelper.Instance.LogMessage($"Error on server or username already exists.", EEventPriority.ERROR, EStringBuilder.CLIENT);

                UserControl uc = parameters[3] as UserControl;
                CurrentWindow = Window.GetWindow(uc);
                CurrentWindow.Close();
            }
        }
        private void ModifyEventExecute(object parameter)
        {
            Object[] parameters = parameter as Object[];

            foreach (Person p in Participants)
            {
                if (!EventToModify.Participants.Contains(p, new PersonComparer()))
                {
                    EventToModify.AddParticipant(p);
                }
            }

            List <Person> peopleToBeRemoved = new List <Person>();

            foreach (Person p in EventToModify.Participants)
            {
                if (!Participants.Contains(p, new PersonComparer()))
                {
                    peopleToBeRemoved.Add(p);
                }
            }
            peopleToBeRemoved.ForEach(p => EventToModify.Participants.Remove(p));

            Event editedEvent = EventProxy.EditEvent(EventToModify);

            if (editedEvent != null)
            {
                logger.Info($"Event successfully modified.");
                LoggerHelper.Instance.LogMessage($"Event successfully modified.", EEventPriority.INFO, EStringBuilder.CLIENT);
                UserControl uc = parameters[0] as UserControl;
                CurrentWindow = Window.GetWindow(uc);
                CurrentWindow.Close();
            }
            else
            {
                logger.Error($"Error on server.");
                LoggerHelper.Instance.LogMessage($"Error on server.", EEventPriority.ERROR, EStringBuilder.CLIENT);

                UserControl uc = parameters[0] as UserControl;
                CurrentWindow = Window.GetWindow(uc);
                CurrentWindow.Close();
            }
        }
        private void AddEventExecute(object parameter)
        {
            Object[] parameters = parameter as Object[];

            Event scheduledEvent = EventProxy.ScheduleEvent(EventToAdd, Participants.ToList());

            if (scheduledEvent != null)
            {
                logger.Info($"Event successfully added.");
                LoggerHelper.Instance.LogMessage($"Account successfully modified.", EEventPriority.INFO, EStringBuilder.CLIENT);
                UserControl uc = parameters[0] as UserControl;
                CurrentWindow = Window.GetWindow(uc);
                CurrentWindow.Close();
            }
            else
            {
                logger.Error($"Error on server.");
                LoggerHelper.Instance.LogMessage($"Error on server.", EEventPriority.ERROR, EStringBuilder.CLIENT);
                UserControl uc = parameters[0] as UserControl;
                CurrentWindow = Window.GetWindow(uc);
                CurrentWindow.Close();
            }
        }
Esempio n. 10
0
 void PayComplete_ViewModelBinded(BaseViewModel model)
 {
     Task.Factory.StartNew(() =>
     {
         while (isRunning)
         {
             CurrentWindow.Dispatcher.Invoke(new Action(() =>
             {
                 if (Second == 0)
                 {
                     Dispose();
                     CurrentWindow.Close();
                     //PosViewModel.Current.ClearOrder.Execute(null);
                     return;
                 }
                 else
                 {
                     Second--;
                 }
             }));
             Thread.Sleep(1000);
         }
     });
 }
Esempio n. 11
0
        async void AsyncSignUpFunc()
        {
            LoadingVisiblity = Visibility.Visible;
            try
            {
                if (string.IsNullOrEmpty(Host) && string.IsNullOrEmpty(Port))
                {
                    MyMessage.Show("IP和端口不能为空");
                    return;
                }

                ThriftServiceNameSpace.ThriftService its = new ThriftServiceNameSpace.ThriftService();
                string ip   = Host;
                string port = Port;

                int result = ThriftServiceBasic.Singin(ref ip, ref port);
                if (result == 200)
                {
                    if (GlobalCache.Func_AutoSignin)
                    {
                        autoLogin.Stop();                       //auto singin funcation
                    }
                    if (Config.SaveUserInfo(Host, Port) == 200) //save ip&port
                    {
                        AppConfigs.AsyncSelectFaceType();
                        var config = Config.RegionList.FirstOrDefault(region => region.RegionNO == GlobalCache.AppRegion);
                        if (config != null)
                        {
                            try
                            {
                                GlobalCache.AppLocation = config.RegionName;
                                HomeView home = new HomeView();
                                CurrentWindow.Close();
                                home.Show();
                            }
                            catch (Exception ex)
                            {
                                string err = ex.Message;
                                Logger <SignUpViewModel> .Log.Error("SignUp_Click", ex);

                                MyMessage.Show("该问题需要联系技术人员处理,\n数据或程序问题");
                                return;
                            }
                        }
                        else
                        {
                            MyMessage.Show("exe.config文件与AreaInfo.xml文件中的区域类型不一致");
                            return;
                        }
                    }
                    else
                    {
                        MyMessage.Show("请您先检查userinfo.xml文件是否存在,若存在,\n请联系技术人员处理");
                    }
                }
                else if (result == 404)
                {
                    MyMessage.Show(string.Format("无法连接到 {0}:{1}", ip, port));
                }
            }
            catch (Exception ex)
            {
                Logger <SignUpViewModel> .Log.Error("SignUp_Click", ex);
            }
            finally
            {
                LoadingVisiblity = Visibility.Collapsed;
            }
        }