Пример #1
0
    //static PlayerOperationsClassLib playerOps;

    public static void Main()
    {
        Application.Init();
        LogInWindow login = new LogInWindow();

        Application.Run();
    }
Пример #2
0
        private async void Current_Startup(object sender, StartupEventArgs e)
        {
            var startupArguments = new StartupArguments();

            startupArguments.Parse(e.Args);

            if (!string.IsNullOrEmpty(startupArguments.Culture))
            {
                Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo(startupArguments.Culture);
            }

            var splashScreen = new SplashScreen(LocalizationHelper.GetResourceManager().GetString("TXT_SPLASH_SCREEN_PATH"));

            splashScreen.Show(false);

            CheckForUpdates();

            await AsyncHelper.CallSync(InitialiseApplication);

            splashScreen.Close(new TimeSpan(0, 0, 0));

            var window = new LogInWindow();

            if (window.ShowDialog() == true)
            {
                ShutdownMode = ShutdownMode.OnMainWindowClose;
                MainWindow   = new MainWindow();

                MainWindow.ShowDialog();
            }
            else
            {
                Current.Shutdown();
            }
        }
        private void logInButton_Click(object sender, RoutedEventArgs e)
        {
            LogInWindow lw = new LogInWindow();

            lw.Show();
            this.Close();
        }
        private void signOutButton_Click(object sender, RoutedEventArgs e)
        {
            File.Delete("./data.bin");
            LogInWindow lw = new LogInWindow();

            lw.Show();
            this.Close();
        }
Пример #5
0
 public MainViewModel()
 {
     if (!IsLoaded)
     {
         IsLoaded = true;
         LogInWindow loginWindow = new LogInWindow();
         loginWindow.ShowDialog();
     }
     //MessageBox.Show("Access to MainViewModel --> DataContext's MainWindow.xaml", "WareHouseManagment", MessageBoxButton.OK, MessageBoxImage.Information);
 }
Пример #6
0
        public AudioPacketHandler(LogInWindow home_window, ChatWindow chat_room)
        {
            if (home_window == null || chat_room == null)
            {
                throw new ArgumentNullException();
            }

            this.SetChatRoom(chat_room);
            this.SetSocket(home_window);
        }
Пример #7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IServices        server = new ServerProxy("127.0.0.1", 55555);
            ClientController ctrl   = new ClientController(server);
            LogInWindow      win    = new LogInWindow(ctrl);

            Application.Run(win);
        }
Пример #8
0
        /// <summary>
        /// Logs current user out, closes MainWindow and returns to LogIn window
        /// </summary>
        /// <param name="sender">unused</param>
        /// <param name="e">unused</param>
        private void LogOutBtn() /*_Click(object sender, RoutedEventArgs e) */
        {
            //setSelection(ref LogOutBtn, ref LogOutLbl, "AssetManagementItems");

            // log out user
            UserManager.GetUserManager.LogoutUser("Logout from MainWindow.");

            // logging out and in is not expected to be too common, so simply recreate LogInWindow and transfer control to it.
            var newWin = new LogInWindow();

            App.Current.MainWindow = newWin;
            newWin.Show();
            this.Close();
        }
Пример #9
0
        public void LogIn()
        {
            if (LogInWindow != null)
            {
                return;
            }

            LogInWindow = new LogInWindow(config);
            LogInWindow.Show();

            LogInWindow.Closed += new EventHandler((sender, e) =>
            {
                LogInWindow = null;
            });
        }
Пример #10
0
        private void Login_Click(object sender, RoutedEventArgs e)                                 //登录按钮
        {
            LogInWindow logIn = new LogInWindow();

            logIn.ShowDialog();
            if (logIn.IsLogIn == true)
            {
                this.User = logIn.LoginUser;
                LoginButton.Visibility = Visibility.Hidden;
                userInfo.Visibility    = Visibility.Visible;
                coin.Visibility        = Visibility.Visible;
                userInfo.Text          = "当前用户:" + User.UserId;
                coin.Text = "积分:" + User.Coin.ToString();
            }
        }
Пример #11
0
        private void DeletePlayer(object obj)
        {
            if (HelperClass.CurrentPlayerID != null)
            {
                ClearPlayerGameHistory(obj);
                Player = CrapsGameDBEntities.Players?.Where(x => x.PlayerID == HelperClass.CurrentPlayerID)?.FirstOrDefault();
                CrapsGameDBEntities.Players.Remove(Player);
                SaveChanges("NoMessageBox");
                UserName = string.Empty;
                Password = string.Empty;
                HelperClass.CurrentPlayerID = null;

                LogInWindow showLogInWindow = new LogInWindow();
                showLogInWindow.Show();
                CloseCurrentWindow();
            }
        }
Пример #12
0
        private void SilButtonClicked(object sender, RoutedEventArgs e)
        {
            var context = new MarketDBContext();

            var selection = SaleRecordList.SelectedItem;

            if (selection == null)
            {
                MessageBox.Show("Seçim yapılmadı"); return;
            }

            SaleItem         saleItem = (SaleItem)selection;
            string           message  = $"Seçilen satışı silmek istiyor musunuz?";
            string           caption  = "Onay";
            MessageBoxButton buttons  = MessageBoxButton.YesNo;
            MessageBoxImage  icon     = MessageBoxImage.Question;

            if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.Yes)
            {
                //Ask for login
                var returnValue = false;

                LogInWindow Login = new LogInWindow();
                returnValue = (bool)Login.ShowDialog();

                if (returnValue == false)
                {
                    return;
                }

                Sale sale = context.Sales.Find(saleItem.ID);
                context.Sales.Remove(sale);

                context.SaveChanges();
                RefreshList("");

                SaleIDText.Text = String.Empty;
            }
            else
            {
                return;
            }
        }
 // METHODS
 #region Commands
 private void ShowCabinetOrRegistrateMethod(object obj)
 {
     if (IsAuthorized(obj))
     {
         cabinetWindow = new CabinetWindow()
         {
             DataContext = this
         };
         cabinetWindow.ShowDialog();
     }
     else
     {
         logInWindow = new LogInWindow()
         {
             DataContext = this
         };
         logInWindow.ShowDialog();
     }
 }
        private void exit()
        {
            try
            {
                User deserializedeUser = new();
                XmlSerializeWrapper <User> .Serialize(deserializedeUser, "../lastUser.xml");

                var window = Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive && x.Name == "MainAppWindow");

                LogInWindow logInWindow = new LogInWindow();
                logInWindow.Show();

                window.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show("Сообщение ошибки: " + exception.Message, "Произошла ошибка");
            }
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            List <OptionsPack> optionsPacks = XmlSerializeWrapper <List <OptionsPack> > .Deserialize("../appSettings.xml", FileMode.Open);

            OptionsPack currentUserSettings = optionsPacks.Find(x => x.OptionUserId == DeserializedUser.deserializedUser.Id);

            if (currentUserSettings?.IsSplashScreenShown ?? true)
            {
                SplashScreen splash = new SplashScreen("../Resources/foodTrackSplash.png");
                splash.Show(autoClose: false, topMost: false);
                splash.Close(TimeSpan.FromSeconds(1));
            }
            using (UnitOfWork unit = new UnitOfWork())
            {
                IEnumerable <User> resultUserFound = unit.UserRepository.Get(x => x.UserLogin == DeserializedUser.deserializedUser.UserLogin);

                if (resultUserFound.Count() != 0 && (currentUserSettings?.IsStayAuthorized ?? false))
                {
                    if (resultUserFound.First <User>().UserPassword.SequenceEqual <byte>(DeserializedUser.deserializedUser.UserPassword))
                    {
                        MainWindow mainWindow = new MainWindow();

                        mainWindow.Show();

                        currentUserSettings.setAppTheme();
                        currentUserSettings.setAppAccent();

                        OptionsViewModel.OptionsPack = currentUserSettings;
                    }
                    else
                    {
                        LogInWindow logInWindow = new LogInWindow();
                        logInWindow.Show();
                    }
                }
                else
                {
                    LogInWindow logInWindow = new LogInWindow();
                    logInWindow.Show();
                }
            }
        }
Пример #16
0
        public void LogoutMethod()
        {
            LogInWindow       main = new LogInWindow();
            CirculationWindow win1 = new CirculationWindow();

            try
            {
                MessageBoxResult messageBoxResult = MessageBox.Show("Would you like to change profiles?",
                                                                    "Log out",
                                                                    MessageBoxButton.YesNo,
                                                                    MessageBoxImage.Asterisk);
                if (messageBoxResult.ToString() == "Yes")
                {
                    main.Show();
                    win1.Close();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Problem Sigining out");
            }
        }
        // CONSTRUCTORS
        /// <summary>
        /// Basic constructor with 1 parametr
        /// </summary>
        /// <param name="dataAccessService">Programs dataAccessService</param>
        public ApplicationViewModel(IDataAccessService dataAccessService)
        {
            this.dataAccessService = dataAccessService;
            this.sessionTimer      = new DispatcherTimer()
            {
                Interval = System.TimeSpan.FromSeconds(1)
            };
            this.randomizer = new System.Random();

            this.isDataRequireUpdate = true;
            this.gameRunning         = false;
            this.gameTime            = System.TimeSpan.FromSeconds(0);
            this.orders    = new ObservableCollection <Order>();
            this.champions = null;

            #region Window Initialize
            logInWindow   = null;
            cabinetWindow = null;
            #endregion

            #region Commands Initialize
            logIn  = new RelayCommand(LogInMethod, IsNotAuthorized);
            logOut = new RelayCommand(LogOutMethod, IsAuthorized);
            signUp = new RelayCommand(SignUpMethod, IsNotAuthorized);

            startGame    = new RelayCommand(StartGameMethod, AuthorizedAndGameIsNotRunning);
            executeOrder = new RelayCommand(ExecuteOrderMethod, GameRunningAndOrderSelected);
            searchOrder  = new RelayCommand(SearchOrderMethod, GameRunning);
            removeOrder  = new RelayCommand(RemoveOrderMethod, GameRunningAndOrderSelected);

            showCabinetOrRegistrate = new RelayCommand(ShowCabinetOrRegistrateMethod, GameIsNotRunning);
            showScores = new RelayCommand(ShowScoresMethod);
            #endregion

            sessionTimer.Tick += SessionTimer_Tick;
        }
 public MainWindow()
 {
     InitializeComponent();
     try
     {
         string[] lines = File.ReadAllLines("./data.bin");
         if (lines.Length == 0)
         {
             LogInWindow lW = new LogInWindow();
             this.Close();
             lW.Show();
         }
         else
         {
             FetchUserInfo(lines[0]);
             FetchProducts();
         }
     }   catch (Exception)
     {
         LogInWindow lW = new LogInWindow();
         this.Close();
         lW.Show();
     }
 }
Пример #19
0
        private void btn_LogIn_Click(object sender, RoutedEventArgs e)
        {
            LogInWindow logInWindow = new LogInWindow();

            Show();
        }
Пример #20
0
 public void SetSocket(LogInWindow home_window)
 {
     this.home_window = home_window;
 }
Пример #21
0
        public void ShowLogInWindow()
        {
            LogInWindow showLogInWindow = new LogInWindow();

            showLogInWindow.Show();
        }
Пример #22
0
 public void SetAudioPacketHandler(LogInWindow home_window, ChatWindow chat_room)
 {
     this.audio_packet_handler = new AudioPacketHandler(home_window, chat_room);
 }
Пример #23
0
 internal void GetLogInWindowInstance(LogInWindow logInWindow)
 {
     logInWindowInstance = logInWindow;
 }
 public void SetSocketandChatRoom(LogInWindow home_window, ChatWindow chat_room)
 {
     this.audio_handler.SetAudioPacketHandler(home_window, chat_room);
 }
Пример #25
0
        private void ConferenceGrid_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var loginWindow = new LogInWindow(conferences.ToList().ElementAt(ConferenceGrid.CurrentCell.RowIndex), controller);

            loginWindow.Show();
        }
Пример #26
0
        public LogInWindowVM(LogInWindow logInWindow)
        {
            _logInWindow = logInWindow;

            AppVM.Instace.ToString();
        }
 private void ShowLogInWindow()
 {
     _logInWindow = Container.Resolve <LogInWindow>();
     _logInWindow.Show();
 }