private User getRecentUser() { string userData = File.ReadAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "/UserData.txt"); CollectorService.Provider provider; if (userData != string.Empty) { provider = new CollectorService.Provider(); string credentials = provider.RetrieveCredentials(userData.Trim()); if (!string.IsNullOrEmpty(credentials)) { return new User() { UserName = credentials.Split(',')[0], Password = credentials.Split(',')[1], MobileNumber = userData.Trim(), ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png") }; } else { return new User() { UserName = "******", Password = "******", MobileNumber = userData.Trim(), ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png") }; } } else { ConfigurationWindow configuration = new ConfigurationWindow(); configuration.ShowDialog(); if (configuration.Mobile != "") { File.WriteAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "/UserData.txt", configuration.Mobile); provider = new CollectorService.Provider(); string credentials = provider.RetrieveCredentials(configuration.Mobile.Trim()); if (!string.IsNullOrEmpty(credentials)) { return new User() { UserName = credentials.Split(',')[0], Password = credentials.Split(',')[1], MobileNumber = configuration.Mobile.Trim(), ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png") }; } else { return new User() { UserName = "******", Password = "******", MobileNumber = userData.Trim(), ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png") }; } } } return null; }
private User getRecentUser() { string userData = File.ReadAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "/UserData.txt"); CollectorService.Provider provider; if (userData != string.Empty) { provider = new CollectorService.Provider(); string credentials = provider.RetrieveCredentials(userData.Trim()); if (!string.IsNullOrEmpty(credentials)) { return(new User() { UserName = credentials.Split(',')[0], Password = credentials.Split(',')[1], MobileNumber = userData.Trim(), ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png") }); } else { return(new User() { UserName = "******", Password = "******", MobileNumber = userData.Trim(), ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png") }); } } else { ConfigurationWindow configuration = new ConfigurationWindow(); configuration.ShowDialog(); if (configuration.Mobile != "") { File.WriteAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "/UserData.txt", configuration.Mobile); provider = new CollectorService.Provider(); string credentials = provider.RetrieveCredentials(configuration.Mobile.Trim()); if (!string.IsNullOrEmpty(credentials)) { return(new User() { UserName = credentials.Split(',')[0], Password = credentials.Split(',')[1], MobileNumber = configuration.Mobile.Trim(), ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png") }); } else { return(new User() { UserName = "******", Password = "******", MobileNumber = userData.Trim(), ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png") }); } } } return(null); }