public MainWindow() { InitializeComponent(); startupPage = new StartupPage(MainContentFrame); MainContentFrame.Content = startupPage; }
public void Get_IntroductionPageId_For_Given_Sequence(string pageId, int sequenceId, int providerTypeId) { var startupPage = new StartupPage { PageId = pageId, ProviderTypeId = providerTypeId }; var taskListConfiguration = new TaskListConfiguration { Id = sequenceId, Title = "test configuration", StartupPages = new List <StartupPage> { startupPage, new StartupPage { PageId = pageId + "A", ProviderTypeId = providerTypeId + 1 }, new StartupPage { PageId = pageId + "Z", ProviderTypeId = providerTypeId - 1 }, } }; _configuration.Setup(x => x.Value).Returns(new List <TaskListConfiguration> { taskListConfiguration }); _service = new ProcessPageFlowService(_qnaApiClient.Object, _configuration.Object); var returnedPageId = _service.GetIntroductionPageIdForSequence(sequenceId, providerTypeId).Result; Assert.AreEqual(pageId, returnedPageId); }
public App() { Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MzA4MTIyQDMxMzgyZTMyMmUzME4rVWJvRGdVY0ZibWlYbUFBN1dyNVFjemJ5djZ5dWQzZzdMaDNEQ1hBN3M9"); InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); DependencyService.Register <MockDataStore>(); DependencyService.Register <IProcessLoader>(); Config.client = new System.Net.Http.HttpClient(); MainPage = new StartupPage(); CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) => { System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}"); }; CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) => { System.Diagnostics.Debug.WriteLine("Received"); }; CrossFirebasePushNotification.Current.OnNotificationAction += (s, p) => { System.Diagnostics.Debug.WriteLine("Action"); if (!string.IsNullOrEmpty(p.Identifier)) { System.Diagnostics.Debug.WriteLine($"ActionId: {p.Identifier}"); foreach (var data in p.Data) { System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}"); } } }; }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model; theModel.initializationProgress += TheModel_initializationProgress; // Show the version. Version thisVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; tbVersion.Text = string.Format("CopyRight To Helixgen,Version: {0}.{1}", thisVersion.Major.ToString(), thisVersion.Minor.ToString()); // showMainPage(); //AnalysPage = new AnalysePage(this); startupPage = new StartupPage(theModel); setUpPage = new setUp(this); idInputPage = new IDInput(this); Loginpage = new loginPage(this); AnalysPage = new AnalysePage(this); runResultPage = new RunResultPage(this); //_mainPage = new MainPage(this); NavFrame.Navigate(Loginpage); /* * StartupPage startupPage = new StartupPage(theModel); * * NavFrame.Navigate(startupPage); * Thread.Sleep(0); * * NavFrame.LoadCompleted += NavFrame_Startup_Navigated; */ #if false OpticsControlPage opticsPage = new OpticsControlPage(); NavFrame.Navigate(opticsPage); opticsPage.Initialize(); #endif #if false Thread.Sleep(10000); Task.Factory.StartNew(() => { Application.Current.Dispatcher.Invoke( delegate { showMainPage(); } ); } ); #endif }
public MainWindow() { StyleManager.ApplicationTheme = new MaterialTheme(); InitializeComponent(); //State = new OAuthState(); DataContext = this; StartupPage page = new StartupPage(); frmMain.Navigate(page); this.Height = (System.Windows.SystemParameters.PrimaryScreenHeight); this.Width = (System.Windows.SystemParameters.PrimaryScreenWidth); }
private void ForgotPassword3NextButton_Click(object sender, RoutedEventArgs e) { string selected_ForgotPasswordCode = UserModel.UserModel.twoFAcode; UserModel.UserModel cm = UserModel.UserModel._currentUserModel; string userID = cm.userID; Console.WriteLine(userID + "TEICJASMCA"); if (ForgotPasswordCodeTextBox.Text == selected_ForgotPasswordCode) { MessageBox.Show("Correct!"); string date = AlgorithmLibary.PredictionModel.getCurrentDate(); string loginTime = DateTime.Now.ToString("HH.mm"); string publicIP = PredictionModel.getCurrentPublicIP(); string publicMAC = PredictionModel.getCurrentMAC(); Console.WriteLine(publicMAC + "HELLO"); UserModel.UserModel.saveDateTimeOfUser(userID, connectionString, loginTime, date, publicIP, publicMAC); string exist = UserModel.UserModel.checkFollowUp(userID, connectionString); SqlConnection con; SqlCommand cmd; string riskLevelStatement = null; riskLevelStatement = "Low"; con = new SqlConnection(connectionString); try { string connectionString = conSettings.ConnectionString; con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("DELETE FROM [dbo].[FailedAttempt] where UserID = '" + userID + "'", con); cmd.ExecuteNonQuery(); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } finally { con.Close(); } if (exist != null) { UserModel.UserModel.updateFollowUp(userID, connectionString, "False"); //Navigate to Chester page Page cloud = new StartupPage(); this.NavigationService.Navigate(cloud); } else { UserModel.UserModel.saveFollowUp(userID, connectionString, "False"); //Navigate To chester page Page cloud = new StartupPage(); this.NavigationService.Navigate(cloud); } PredictionModel.SessionRiskValue = riskLevelStatement; } else { MessageBox.Show("Invalid code! Please Try Again"); counter++; if (counter > 3) { MessageBox.Show("More than 3 Failed attempts! Account will be locked now!"); string exist = UserModel.UserModel.checkFollowUp(userID, connectionString); if (exist != null) { UserModel.UserModel.updateFollowUp(userID, connectionString, "True"); } else { UserModel.UserModel.saveFollowUp(userID, connectionString, "True"); } Page LoginPage = new LoginPage(); this.NavigationService.Navigate(LoginPage); counter = 0; } } }
private void ButtonNext_Click(object sender, RoutedEventArgs e) { PasswordTextBox.Password = GetSha512FromString(PasswordTextBox.Password); //MessageBox.Show(PasswordTextBox.Password); try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("select * from [dbo].[test] where UserID = '" + UserIDTextBox.Text + "' and Password = '******'", con); reader = cmd.ExecuteReader(); int count = 0; while (reader.Read()) { count += 1; Console.WriteLine(" | UserID : " + reader.GetString(0) + " | Password : "******" | Name : " + reader.GetString(2) + " | Email : " + reader.GetString(3) + " | ContactNo : " + reader.GetString(4)); } if (count == 1) { string userID = UserIDTextBox.Text; string[][] userList = checkUserEligibility(userID, connectionString); UserModel.UserModel.currentUserID = userID; string currentUser = UserModel.UserModel.currentUserID; //MessageBox.Show(currentUser + "is thios"); UserModel.UserModel um = UserModel.UserModel.retrieveUserFromDatabase(currentUser); Console.WriteLine(um.userPassword); string checkForFollowUp = UserModel.UserModel.checkFollowUp(userID, connectionString); (App.Current as App).LoginUserID = UserIDTextBox.Text; try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("select count(*) from [dbo].[FailedAttempt] where UserID = '" + UserIDTextBox.Text + "'", con); Int32 noOfFailedLoginAttempt = (Int32)cmd.ExecuteScalar(); //MessageBox.Show(noOfFailedLoginAttempt.ToString() + " unsuccessful login attempt(s)"); if (noOfFailedLoginAttempt > 3) { MessageBox.Show("Account is locked , please complete TWO FA"); string subject = "Authentication Message"; string subjectBody = "Authentication Code is "; UserModel.UserModel cm = UserModel.UserModel.currentUserModel; string email = cm.userEmail; UserModel.UserModel.do2fa(subject, subjectBody, email); Page authentication1 = new Authentication1(); this.NavigationService.Navigate(authentication1); } else { if (checkForFollowUp == "True") { //MessageBox.Show("Account is locked , please complete TWO FA"); string subject = "Authentication Message"; string subjectBody = "Authentication Code is "; UserModel.UserModel cm = UserModel.UserModel.currentUserModel; string email = cm.userEmail; UserModel.UserModel.do2fa(subject, subjectBody, email); Page authentication = new Authentication(); this.NavigationService.Navigate(authentication); } else { //MessageBox.Show("Account not locked."); if (userList.Count() < 30) { string date = AlgorithmLibary.PredictionModel.getCurrentDate(); string loginTime = DateTime.Now.ToString("HH.mm"); string publicIP = PredictionModel.getCurrentPublicIP(); string publicMAC = PredictionModel.getCurrentMAC(); string userLogInPreference = getUserLogInPreference(userID, connectionString); string userComputerPreference = getUserComputerPreference(userID, connectionString); //The method below is supposed to read from the database all the entries of hostname for this specific user string[] currentHostnameSet = getUserHostNameSet(userID, connectionString); foreach (var element in currentHostnameSet) { Console.WriteLine(element + "JADSjc"); } //string[] currentHostnameSet = //{ // "JUSTINSOH-PC", // "JUSTINSOH-PC", // "JUSTINSOH-PC", // "JUSTINSOH-PCC", // "JUSTINSOH-PCC", // "JUSTINSOH-PCC", //}; double logInRisk = evaulateUserLogInString(userLogInPreference, loginTime); double userHostRisk = evaulateUserComputerPreference(userComputerPreference, currentHostnameSet); logInRisk = logInRisk * 0.3; userHostRisk = userHostRisk * 0.7; double totalRisk = logInRisk + userHostRisk; Console.WriteLine(userHostRisk + " HOSTNAME"); Console.WriteLine(logInRisk + "LOG IN RISK"); Console.WriteLine(totalRisk); string riskStatement = null; string riskStatementLevel = null; if (totalRisk <= 0.4) { riskStatementLevel = "Low"; riskStatement = "The risk level is low"; UserModel.UserModel.saveDateTimeOfUser(userID, connectionString, loginTime, date, publicIP, publicMAC); Page cloud = new StartupPage(); this.NavigationService.Navigate(cloud); } // Removing access control and giving access control else if (totalRisk <= 0.70) { riskStatementLevel = "Medium"; riskStatement = "The risk level is medium"; Page cloud = new StartupPage(); UserModel.UserModel.saveDateTimeOfUser(userID, connectionString, loginTime, date, publicIP, publicMAC); //MessageBox.Show("Entry Saved"); //UserModel.UserModel.deleteDateTimeOfUser(userID, connectionString, loginTime, date); //MessageBox.Show("Entry Deleted"); this.NavigationService.Navigate(cloud); //Remove Access Control } //Instantly Re authenticate else if (totalRisk > 0.70) { riskStatementLevel = "High"; riskStatement = "The risk level is high"; string subject = "Authentication Message"; string subjectBody = "Authentication Code is "; UserModel.UserModel cm = UserModel.UserModel.currentUserModel; Console.WriteLine(cm.userName + "Hellolols"); string email = cm.userEmail; UserModel.UserModel.do2fa(subject, subjectBody, email); Page authentication = new Authentication(); this.NavigationService.Navigate(authentication); MessageBox.Show("2FA has been sent to your email"); } PredictionModel.SessionRiskValue = riskStatementLevel; Console.WriteLine(riskStatement); MessageBox.Show(riskStatement); } else if (userList.Count() >= 30) { //Run the login prediction string date = AlgorithmLibary.PredictionModel.getCurrentDate(); string loginTime = DateTime.Now.ToString("HH.mm"); string publicIP = PredictionModel.getCurrentPublicIP(); string publicMAC = PredictionModel.getCurrentMAC(); string[][] logInCollection = getUserLogInData(userID, connectionString); double testTime = Convert.ToDouble(loginTime); double testDay = Convert.ToDouble(date); PredictionModel logInPredictionModel = new PredictionModel(testTime, testDay, logInCollection); string logInRiskLevel = logInPredictionModel.logInRisk; string logInOutput = logInPredictionModel.logInOutput; Console.WriteLine(logInOutput); Console.WriteLine("The risk level is " + logInRiskLevel); string[][] ipAddressCollection = getUserIPAddressCollection(userID, connectionString); Console.Write(ipAddressCollection.Count()); string[] query = new string[] { publicIP, publicMAC, date }; PredictionModel ipPredictionModel = new PredictionModel(ipAddressCollection, query); string ipRisk = ipPredictionModel.ipRisk; string ipOutput = ipPredictionModel.ipOutput; Console.WriteLine(ipOutput); double logInPercentage = Convert.ToDouble(logInRiskLevel) / 5.0; double ipPercentage = Convert.ToDouble(ipRisk); logInPercentage = (logInPercentage / 100) * 30; ipPercentage = (ipPercentage / 100) * 70; double riskLevel = logInPercentage + ipPercentage; Console.WriteLine(logInPercentage); Console.WriteLine(ipRisk); Console.WriteLine(riskLevel); string riskStatement = null; string riskStatementLevel = null; //Can do anything if (riskLevel <= 0.4) { riskStatementLevel = "Low"; riskStatement = "The risk level is low"; UserModel.UserModel.saveDateTimeOfUser(userID, connectionString, loginTime, date, publicIP, publicMAC); //Navigate To Chester Page cloud = new StartupPage(); this.NavigationService.Navigate(cloud); } // Removing access control and giving access control else if (riskLevel <= 0.70) { riskStatementLevel = "Medium"; riskStatement = "The risk level is medium"; Page cloud = new StartupPage(); UserModel.UserModel.saveDateTimeOfUser(userID, connectionString, loginTime, date, publicIP, publicMAC); //MessageBox.Show("Entry Saved"); //UserModel.UserModel.deleteDateTimeOfUser(userID, connectionString, loginTime, date); //MessageBox.Show("Entry Deleted"); this.NavigationService.Navigate(cloud); //Remove Access Control } //Instantly Re authenticate else if (riskLevel > 0.70) { riskStatementLevel = "High"; riskStatement = "The risk level is high"; //Do 2FA string subject = "Authentication Message"; string subjectBody = "Authentication Code is "; UserModel.UserModel cm = UserModel.UserModel.currentUserModel; string email = cm.userEmail; UserModel.UserModel.do2fa(subject, subjectBody, email); Page authentication = new Authentication(); this.NavigationService.Navigate(authentication); MessageBox.Show("2FA has been sent to your email"); } PredictionModel.SessionRiskValue = riskStatementLevel; Console.WriteLine("The current Risk Level is " + riskLevel); Console.WriteLine(riskStatement); MessageBox.Show(riskStatement); } } (App.Current as App).LoginUserID = UserIDTextBox.Text; //MessageBox.Show("Successful Login."); //this.NavigationService.Navigate(new Uri(@"EditUserInfo.xaml", UriKind.RelativeOrAbsolute)); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } finally { con.Close(); } } else { MessageBox.Show("Invalid user id or password."); try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("select * from [dbo].[test] where UserID = '" + UserIDTextBox.Text + "'", con); reader = cmd.ExecuteReader(); int countt = 0; while (reader.Read()) { countt += 1; } if (countt == 1) { try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("INSERT INTO[dbo].[FailedAttempt](UserID, Date) VALUES (@UserID, @Date)", con); cmd.Parameters.AddWithValue("@UserID", UserIDTextBox.Text); cmd.Parameters.AddWithValue("@Date", DateTime.Now.ToShortDateString()); cmd.ExecuteNonQuery(); try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("select count(*) from [dbo].[FailedAttempt] where UserID = '" + UserIDTextBox.Text + "'", con); Int32 noOfFailedLoginAttempt = (Int32)cmd.ExecuteScalar(); MessageBox.Show(noOfFailedLoginAttempt.ToString() + " unsuccessful login attempt(s)"); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } finally { con.Close(); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } finally { con.Close(); } } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } finally { con.Close(); } } UserIDTextBox.Clear(); PasswordTextBox.Clear(); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } finally { con.Close(); } }
private void Button_Click(object sender, RoutedEventArgs e) { Page cloud = new StartupPage(); this.NavigationService.Navigate(cloud); }
private void ConfirmAllChanges(object sender, RoutedEventArgs e) { Page cloud = new StartupPage(); this.NavigationService.Navigate(cloud); }