public Login() { InitializeComponent(); try { progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Logging In..."; SqlFactory fact = new SqlFactory(); var user = fact.GetProfile(); if (user != null) { EmailAddress.Text = user.UserName; } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { members = new ObservableCollection<MemberDisplayAPI>(); //(App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Members..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } PullMembers(); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { conversation = new ConversationModel(); //(App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Messages..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } conversation.GroupMessageId = Convert.ToInt64(this.NavigationContext.QueryString["mid"]); PullTopic(); _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromSeconds(20); _timer.Tick += (s, eee) => Tick(); _timer.Start(); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { dues = new Portable.Classes.Controls.Dues.DuesReceipt(); progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Getting Receipt..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } invoiceId = new Guid(this.NavigationContext.QueryString["ivId"]); PullTopic(); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { Voting = new VotingClass(); //(App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Poll..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } Voting.VotingId = Convert.ToInt64(this.NavigationContext.QueryString["pid"]); PullTopic(); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { duesModel = new DuesPortableModel(); //(App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Dues..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } if (SettingsMobile.Instance.AccountSettings.IsTreasurer) { ApplicationBar.IsVisible = true; } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } PullDues(); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { if (e.NavigationMode == NavigationMode.New) { dues = new DuesPortableModel(); //(App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Dues Settings..."; duesId = new Guid(this.NavigationContext.QueryString["dmid"]); if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } PullTopic(); } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { if (e.NavigationMode == NavigationMode.New) { calendarModel = new CalendarEventPortable(); //(App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Info..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } StartTime.Value = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, 0, 0); EndTime.Value = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, 0, 0); calendarModel.CalendarId = SettingsMobile.Instance.AccountSettings.CalendarId; calendarModel.MemberId = SettingsMobile.Instance.User.MemberId; calendarModel.UserId = SettingsMobile.Instance.User.LoginId; LoadInitialData(); } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { ev = new CalendarEventPortable(); var ob = (App.Current as App).SecondPageObject; if (ob != null) ev = (CalendarEventPortable)ob; (App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Saving Checkin..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } CheckInTypeSelect.ItemsSource = CalendarEventPointTypeEnumHelper.CalendarEventPointTypes; ev.CalendarItemId = new Guid(this.NavigationContext.QueryString["evId"]); ev.CalendarId = new Guid(this.NavigationContext.QueryString["calId"]); ev.Name = this.NavigationContext.QueryString["name"]; if (!String.IsNullOrEmpty(ev.Name)) EventName.Text = ev.Name; } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
private void LoginBtn_Click(object sender, RoutedEventArgs e) { try { UserMobile m = new UserMobile(); m.UserName = EmailAddress.Text; m.Password = Password.Text; progressIndicator.IsVisible = true; Task.Run(new Action(() => { try { var user = UserMobileWP.Login(m); if (user.IsLoggedIn) { user.LastMobileLoginDate = DateTime.UtcNow; SqlFactory fact = new SqlFactory(); fact.DeleteProfile(); fact.InsertProfile(new SqlAccount(user)); var json = fact.GetNotificationSettings(); if (json != null) { json.MemberId = user.MemberId.ToString(); NotificationMobileJsonWP.SendNotificationId(json); } Dispatcher.BeginInvoke(delegate { progressIndicator.IsVisible = false; NavigationService.Navigate(new Uri("/View/MyLeague/MyLeague.xaml", UriKind.Relative)); }); } else { Dispatcher.BeginInvoke(delegate { progressIndicator.IsVisible = false; warning.Text = "There was an error logging in, Please try again."; }); } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } Dispatcher.BeginInvoke(delegate { progressIndicator.IsVisible = false; }); })); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
public MainPage() { InitializeComponent(); loadFeedButton_Click(); SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); LoadPushNotifications(); }
public static void PullPublicSkatersByLeague(string leagueId, Action<SkatersJson> callback) { var webClient = new WebClient(); webClient.DownloadStringCompleted += (sender, e) => { try { var data = Json.DeserializeObject<SkatersJson>(e.Result); callback(data); for (int i = 0; i < data.Skaters.Count; i++) { var fact = new SqlFactory(); var sk = fact.GetSkaterProfile(data.Skaters[i].MemberId); if (sk == null) { fact.InsertSkaterProfile(new SqlSkaterProfile() { Bio = data.Skaters[i].Bio, DerbyName = data.Skaters[i].DerbyName, DerbyNameUrl = data.Skaters[i].DerbyNameUrl, DerbyNumber = data.Skaters[i].DerbyNumber, DOB = data.Skaters[i].DOB, GamesCount = data.Skaters[i].GamesCount, Gender = data.Skaters[i].Gender, GotExtendedContent = data.Skaters[i].GotExtendedContent, MemberId = data.Skaters[i].MemberId, HeightFeet = data.Skaters[i].HeightFeet, HeightInches = data.Skaters[i].HeightInches, LeagueId = data.Skaters[i].LeagueId, LeagueLogo = data.Skaters[i].LeagueLogo, LeagueName = data.Skaters[i].LeagueName, LeagueUrl = data.Skaters[i].LeagueUrl, Losses = data.Skaters[i].Losses, photoUrl = data.Skaters[i].photoUrl, ThumbUrl = data.Skaters[i].ThumbUrl, Wins = data.Skaters[i].Wins }); } } } catch (Exception exception) { } }; webClient.Encoding = System.Text.Encoding.UTF8; webClient.DownloadStringAsync(new Uri(MobileConfig.GET_SKATERS_BY_LEAGUEID_URL + "lId=" + leagueId)); }
public static void PullPublicLeagueEvents(string leagueId, Action<EventsJson> callback) { var webClient = new WebClient(); webClient.DownloadStringCompleted += (sender, e) => { try { var data= Json.DeserializeObject<EventsJson>(e.Result); callback(data); foreach (var ev in data.Events) { var sql = new SqlFactory(); var temp = sql.GetCalendarEvent(leagueId, ev.CalendarItemId); if (temp == null) { sql.InsertCalendarEvent(new SqlCalendarEvent() { Address = ev.Address, CalendarItemId = ev.CalendarItemId, EndDate = ev.EndDate, Location = ev.Location, Name = ev.Name, NameUrl = ev.NameUrl, StartDate = ev.StartDate, LeagueId = ev.LeagueId.ToString().Replace("-", "") }); } } } catch (Exception exception) { } }; webClient.Encoding = System.Text.Encoding.UTF8; webClient.DownloadStringAsync(new Uri(MobileConfig.GET_LEAGUE_EVENTS_BY_LEAGUEID_URL + "lid=" + leagueId)); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { SelectedIds = new ObservableCollection<NameIdModel>(); Members = new List<MemberDisplayModel>(); Groups = new List<LeagueGroupModel>(); //(App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Members..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } var check = this.NavigationContext.QueryString.Where(x => x.Key == "g").FirstOrDefault(); if (check.Value == "off") { areGroupsOff = true; Pivot.Items.Remove(Pivot.Items.Single(p => ((PivotItem)p).Name == "groupPivotItem")); } if ((App.Current as App).SecondPageObject != null) SelectedIds = (ObservableCollection<NameIdModel>)(App.Current as App).SecondPageObject; PullGroups(); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
public Signup() { InitializeComponent(); try { progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Signing Up..."; SqlFactory fact = new SqlFactory(); var user = fact.GetProfile(); GenderSelect.ItemsSource = GenderHelper.GenderTypes; PositionSelect.ItemsSource = PositionHelper.PositionTypes; } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); try { if (e.NavigationMode == NavigationMode.New) { calendarModel = new CalendarEventPortable(); //(App.Current as App).SecondPageObject = null; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Event..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } //if (SettingsMobile.Instance.AccountSettings.IsEventsCoordinatorOrBetter) //{ // ApplicationBar.IsVisible = true; //} calendarModel.CalendarItemId = new Guid(this.NavigationContext.QueryString["evId"]); PullDues(); } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
private void RegisterBtn_Click_1(object sender, RoutedEventArgs e) { try { UserMobile m = new UserMobile(); m.UserName = Email.Text; m.Password = Password.Text; m.FirstName = FirstName.Text; if (GenderSelect != null && GenderSelect.SelectedItem != null) m.Gender = Convert.ToInt32((GenderEnum)Enum.Parse(typeof(GenderEnum), GenderSelect.SelectedItem.ToString().Replace(" ", "_"))); if (PositionSelect != null && PositionSelect.SelectedItem != null) m.Position = Convert.ToInt32((DefaultPositionEnum)Enum.Parse(typeof(DefaultPositionEnum), PositionSelect.SelectedItem.ToString().Replace(" ", "_"))); m.IsConnectedToDerby = YesRadio.IsChecked.GetValueOrDefault(); RegisterBtn.IsEnabled = false; progressIndicator.IsVisible = true; Task.Run(new Action(() => { try { var user = UserMobileWP.SignUp(m); if (user.DidSignUp) { SqlFactory fact = new SqlFactory(); fact.InsertProfile(new SqlAccount(user)); var json = fact.GetNotificationSettings(); json.MemberId = user.MemberId.ToString(); NotificationMobileJsonWP.SendNotificationId(json); Dispatcher.BeginInvoke(delegate { progressIndicator.IsVisible = false; NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); }); } else { Dispatcher.BeginInvoke(delegate { progressIndicator.IsVisible = false; warning.Text = user.Error; RegisterBtn.IsEnabled = true; }); } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } Dispatcher.BeginInvoke(delegate { progressIndicator.IsVisible = false; RegisterBtn.IsEnabled = true; }); })); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedFrom(e); try { var currentObject = (App.Current as App).SecondPageObject; if (currentObject != null) { if (currentObject.GetType() == typeof(VotingQuestionClass)) { var quest = ((VotingQuestionClass)currentObject); var tempQuest = Questions.Where(x => x.QuestionId == quest.QuestionId).FirstOrDefault(); if (tempQuest == null) { Voting.Questions.Add(quest); Questions.Add(quest); } else { if (quest.IsDeleted) { Questions.Remove(tempQuest); } else { int index = Questions.IndexOf(tempQuest); Questions.Remove(tempQuest); Questions.Insert(index, quest); QuestionList.ItemsSource = null; QuestionList.ItemsSource = Questions; } } } else if (currentObject.GetType() == typeof(ObservableCollection<NameIdModel>)) Names = ((ObservableCollection<NameIdModel>)currentObject); } else { Voting = new VotingClass(); Questions = new TrulyObservableCollection<VotingQuestionClass>(); QuestionList.ItemsSource = Questions; RecipientsList.ItemsSource = Names; progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Poll..."; if (SettingsMobile.Instance.User == null) { SqlFactory fact = new SqlFactory(); SettingsMobile.Instance.User = fact.GetProfile(); } Voting.VotingId = Convert.ToInt64(this.NavigationContext.QueryString["pid"]); PullTopic(); } (App.Current as App).SecondPageObject = null; } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
public static void PullPublicSkater(string memberId, Action<SkaterJson> callback) { var webClient = new WebClient(); webClient.DownloadStringCompleted += (sender, e) => { try { var data = Json.DeserializeObject<SkaterJson>(e.Result); callback(data); var fact = new SqlFactory().InsertSkaterProfile(new SqlSkaterProfile() { Bio = data.Bio, DerbyName = data.DerbyName, DerbyNameUrl = data.DerbyNameUrl, DerbyNumber = data.DerbyNumber, DOB = data.DOB, GamesCount = data.GamesCount, Gender = data.Gender, GotExtendedContent = data.GotExtendedContent, MemberId = data.MemberId, HeightFeet = data.HeightFeet, HeightInches = data.HeightInches, LeagueId = data.LeagueId, LeagueLogo = data.LeagueLogo, LeagueName = data.LeagueName, LeagueUrl = data.LeagueUrl, Losses = data.Losses, photoUrl = data.photoUrl, ThumbUrl = data.ThumbUrl, Wins = data.Wins }); } catch (Exception exception) { } }; webClient.Encoding = System.Text.Encoding.UTF8; webClient.DownloadStringAsync(new Uri(MobileConfig.GET_SKATER_BY_MEMBERID_URL + "mid=" + memberId)); }
private void MyLeague_Click(object sender, RoutedEventArgs e) { try { SqlFactory fact = new SqlFactory(); var profile = fact.GetProfile(); if (profile == null || profile.LastMobileLoginDate < DateTime.UtcNow.AddDays(-30)) NavigationService.Navigate(new Uri("/View/Account/Login.xaml", UriKind.Relative)); else NavigationService.Navigate(new Uri("/View/MyLeague/MyLeague.xaml", UriKind.Relative)); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
private static void UpdateChannelForRDNation(string channelUri) { Task.Run(() => { NotificationMobileJson json = new NotificationMobileJson(); json.CanSendGameNotifications = true; json.CanSendForumNotifications = true; json.MobileTypeEnum = MobileTypeEnum.WP8; json.NotificationId = channelUri; if (SettingsMobile.Instance.User != null) { json.MemberId = SettingsMobile.Instance.User.MemberId.ToString(); NotificationMobileJsonWP.SendNotificationId(json); } SqlFactory fact = new SqlFactory(); fact.InsertNotificationSettings(json); }); }