private void webClient_DownloadTrainRoutesCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                string json = e.Result;


                if (!string.IsNullOrEmpty(json))
                {
                    RootStationObject rootStationObj = JsonConvert.DeserializeObject <RootStationObject>(json);
                    stationList = rootStationObj.RESULTS.stationList;
                    formatStationName();

                    if (stationList != null)
                    {
                        populateStations();
                    }
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.ShowAsync("AW SNAP :-(", MessageBoxButtons.OK, "We are having trouble downloading data due to temporary server unavailability at the moment.");
            }
            this.busyIndicator.IsRunning = false;
        }
示例#2
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem selectedCtx = (MenuItem)sender;
            FavoriteScheduleViewModel favSchedView = (sender as MenuItem).DataContext as FavoriteScheduleViewModel;

            if (selectedCtx.Name.Equals("menuRename"))
            {
                ControlTemplate imageTemplate = (ControlTemplate)this.Resources["InputPrompt"];
                //RadInputPrompt.Show(imageTemplate, "Title", new string[] { "yes", "no" });

                RadInputPrompt.Show(imageTemplate, APPCONTEXT.scheduleListPromptTitle, new string[] { "save", "cancel" }, APPCONTEXT.scheduleListPromptMessage, closedHandler: (args) =>
                {
                    string value    = args.Text;
                    int buttonIndex = args.ButtonIndex;
                    if (buttonIndex == 0)
                    {
                        updateFavoriteShceduleName(favSchedView, value);
                        createFavoriteScheduleList();
                        populateFavoriteSchedule();
                        RadMessageBox.ShowAsync("There you go :)", MessageBoxButtons.OK, "Your favorite shedule is updated successfully.");
                    }
                });
            }
            else
            {
                removeFavoriteSchedule(favSchedView);
                createFavoriteScheduleList();
                populateFavoriteSchedule();
                RadMessageBox.ShowAsync("There you go :)", MessageBoxButtons.OK, "Shedule is removed from your favorites.");
            }
        }
示例#3
0
 private async Task CheckForUpgrade()
 {
     if (await IsUpgradeAvailable())
     {
         await Deployment.Current.Dispatcher.InvokeAsync(async() =>
         {
             var args = await RadMessageBox.ShowAsync(buttonsContent: new List <object> {
                 Resources.Yes, Resources.No
             },
                                                      title: Resources.UpgradeTitle,
                                                      message: Resources.UpgradeText);
             if (args.Result == DialogResult.OK)
             {
                 var marketplaceTask = new MarketplaceDetailTask();
                 try
                 {
                     marketplaceTask.Show();
                 }
                 catch (InvalidOperationException)
                 {
                 }
             }
         });
     }
 }
示例#4
0
        private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            var settingsService = KernelService.Kernel.Get <ISettingsService>();
            var settingsKey     = String.Format("{0}initialMessageShown", (App.Current as App).currentVersion);

            if (ApplicationUsageHelper.ApplicationRunsCountForCurrentVersion == 1 && !settingsService.LoadSetting <bool>(settingsKey))
            {
                //Show intro dialog
                await RadMessageBox.ShowAsync(Shane.Church.StirlingBirthday.Strings.Resources.WelcomeCaption, MessageBoxButtons.OK, Shane.Church.StirlingBirthday.Strings.Resources.WelcomeText);

                settingsService.SaveSetting <bool>(true, settingsKey);
            }
        }
示例#5
0
        private async Task CheckForUpgrade()
        {
            if (await IsUpgradeAvailable())
            {
#if !WP8
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    RadMessageBox.Show(buttonsContent: new List <object> {
                        Resources.AppResources.Yes, Resources.AppResources.No
                    },
                                       title: Resources.AppResources.UpgradeTitle,
                                       message: Resources.AppResources.UpgradeText,
                                       closedHandler: (args) =>
                    {
                        if (args.Result == DialogResult.OK)
                        {
                            var marketplaceTask = new MarketplaceDetailTask();
                            try
                            {
                                marketplaceTask.Show();
                            }
                            catch (InvalidOperationException)
                            {
                            }
                        }
                    });
                });
#else
                await Deployment.Current.Dispatcher.InvokeAsync(async() =>
                {
                    var args = await RadMessageBox.ShowAsync(buttonsContent: new List <object> {
                        Shane.Church.StirlingBirthday.Strings.Resources.Yes, Shane.Church.StirlingBirthday.Strings.Resources.No
                    },
                                                             title: Shane.Church.StirlingBirthday.Strings.Resources.UpgradeTitle,
                                                             message: Shane.Church.StirlingBirthday.Strings.Resources.UpgradeText);
                    if (args.Result == DialogResult.OK)
                    {
                        var marketplaceTask = new MarketplaceDetailTask();
                        try
                        {
                            marketplaceTask.Show();
                        }
                        catch (InvalidOperationException)
                        {
                        }
                    }
                });
#endif
            }
        }
        void getTicketPrices(string startStationId, string endStationId)
        {
            string serviceUri = getServiceUri(WebService.TicketPrices, startStationId, endStationId);

            if (isInterntConAvailable())
            {
                WebClient webClient = new WebClient();
                webClient.DownloadStringCompleted += webClient_DownloadTicketPricesCompleted;
                webClient.DownloadStringAsync(new Uri(serviceUri));
            }
            else
            {
                RadMessageBox.ShowAsync("AW SNAP :-(", MessageBoxButtons.OK, "We are having trouble downloading data due to network connectivity or temporary server unavailability at the moment. Please make sure you are connected to internet and try again.");
            }
        }
        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            StationList startStation = (StationList)acbFromStation.SelectedItem;
            StationList endStation   = (StationList)acbToStation.SelectedItem;

            if (startStation == null || endStation == null || txtFirstClass.Text == "")
            {
                RadMessageBox.ShowAsync("AW SNAP!", MessageBoxButtons.OK, "Ticket prices are unavailabe for sharing");
            }
            else
            {
                string[] args         = { startStation.stationName, endStation.stationName, txtFirstClass.Text, txtSecondClass.Text, txtThirdClass.Text };
                string   shareMessage = string.Format(APPCONTEXT.ticketPriceShareMessage, args);
                AppUtility.shareStatusTask(shareMessage);
            }
        }
示例#8
0
 void createCombinedTrainList()
 {
     trianQuery = (TRAINQUERY)NavigationService.GetNavigationData();
     populateHeader(trianQuery);
     if (isInterntConAvailable())
     {
         WebClient webClient = new WebClient();
         webClient.DownloadStringCompleted += webClient_DownloadCombinedTrainsCompleted;
         webClient.DownloadStringAsync(new Uri(getServiceUri(trianQuery)));
         this.busyIndicator.IsRunning = true;
     }
     else
     {
         RadMessageBox.ShowAsync("AW SNAP :-(", MessageBoxButtons.OK, "We are having trouble downloading data due to temporary server unavailability at the moment.");
     }
 }
示例#9
0
        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            ControlTemplate imageTemplate = (ControlTemplate)this.Resources["ImageTemplate"];

            //RadInputPrompt.Show(imageTemplate, "Title", new string[] { "yes", "no" });

            RadInputPrompt.Show(imageTemplate, APPCONTEXT.scheduleListPromptTitle, new string[] { "save", "cancel" }, APPCONTEXT.scheduleListPromptMessage, closedHandler: (args) =>
            {
                string value    = args.Text;
                int buttonIndex = args.ButtonIndex;
                if (buttonIndex == 0)
                {
                    logFavoriteSchedule(value);
                    RadMessageBox.ShowAsync("Yeey!", MessageBoxButtons.OK, "Schedule is added to the favorites.");
                }
            });
        }
        private async Task CallAfterTap(string dua, string trans)
        {
            StackPanel sp     = new StackPanel();
            TextBlock  duabox = new TextBlock();

            duabox.LineHeight = 75;
            duabox.FontFamily = new System.Windows.Media.FontFamily("/Assets/Fonts/trado.ttf#Traditional Arabic");
            duabox.FontSize   = 50;
            duabox.Text       = dua;
            TextBlock transbox = new TextBlock();

            transbox.Text     = Environment.NewLine + "Translation : " + trans;
            transbox.FontSize = 20;
            sp.Children.Add(duabox);
            sp.Children.Add(transbox);
            await RadMessageBox.ShowAsync(sp, vibrate : false);
        }
示例#11
0
        private void lsRecentSearch_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            RecentSearchViewModel recentSearch = (RecentSearchViewModel)lsRecentSearch.SelectedItem;

            if (recentSearch != null)
            {
                if (isInterntConAvailable())
                {
                    lsRecentSearch.SelectedItem = null;
                    TRAINQUERY queryObj = getQueryObject(recentSearch);
                    NavigationService.Navigate(new Uri("/ScheduleListPage.xaml", UriKind.Relative), queryObj);
                }
                else
                {
                    lsRecentSearch.SelectedItem = null;
                    RadMessageBox.ShowAsync("AW SNAP :-(", MessageBoxButtons.OK, "We are having trouble downloading data due to network connectivity or temporary server unavailability at the moment. Please make sure you are connected to internet and try again.");
                }
            }
        }
示例#12
0
        async void rateReminder_ReminderClosed(object sender, ReminderClosedEventArgs e)
        {
            if (e.MessageBoxEventArgs.Result == DialogResult.Cancel)
            {
                var eArgs = await RadMessageBox.ShowAsync(buttonsContent : new List <object>()
                {
                    Shane.Church.StirlingBirthday.Strings.Resources.GiveFeedbackButton, Shane.Church.StirlingBirthday.Strings.Resources.NoThanksButton
                },
                                                          title : Shane.Church.StirlingBirthday.Strings.Resources.FeedbackTitle,
                                                          message : Shane.Church.StirlingBirthday.Strings.Resources.FeedbackContent);

                if (eArgs.ButtonIndex == 0)
                {
                    EmailComposeTask emailTask = new EmailComposeTask();
                    emailTask.To      = "*****@*****.**";
                    emailTask.Subject = emailTask.Subject = Shane.Church.StirlingBirthday.Strings.Resources.TechnicalSupportEmailSubject;
                    emailTask.Show();
                }
            }
        }
示例#13
0
 private void btnSearch_Click(object sender, RoutedEventArgs e)
 {
     if (isInterntConAvailable())
     {
         if (validateInputs())
         {
             TRAINQUERY queryObj = getQueryObject();
             logRecentSearch();
             //logFavoriteSchedule();
             NavigationService.Navigate(new Uri("/ScheduleListPage.xaml", UriKind.Relative), queryObj);
         }
         else
         {
             RadMessageBox.ShowAsync("AW SNAP!", MessageBoxButtons.OK, "Looks like you have not selected start station and end station");
         }
     }
     else
     {
         RadMessageBox.ShowAsync("AW SNAP :-(", MessageBoxButtons.OK, "We are having trouble downloading data due to network connectivity or temporary server unavailability at the moment. Please make sure you are connected to internet and try again.");
     }
 }
示例#14
0
        private void webClient_DownloadTrainRoutesCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try {
                string json = e.Result;


                if (!string.IsNullOrEmpty(json))
                {
                    RootStationObject rootStationObj = JsonConvert.DeserializeObject <RootStationObject>(json);
                    stationList = rootStationObj.RESULTS.stationList;
                    formatStationName();
                    if (stationList != null)
                    {
                        populateStations();
                    }
                }
            }
            catch (Exception ex) {
                RadMessageBox.ShowAsync("Error!", MessageBoxButtons.OK, "Error retrieving information from server. Please check your internet connection and try again.");
            }
        }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            if (isInterntConAvailable())
            {
                if (validateInputs())
                {
                    StationList startStation = (StationList)acbFromStation.SelectedItem;
                    StationList endStation   = (StationList)acbToStation.SelectedItem;

                    getTicketPrices(startStation.stationID.ToString(), endStation.stationID.ToString());
                }
                else
                {
                    RadMessageBox.ShowAsync("AW SNAP!", MessageBoxButtons.OK, "Looks like you have not selected start station and end station");
                }
            }
            else
            {
                RadMessageBox.ShowAsync("AW SNAP :-(", MessageBoxButtons.OK, "We are having trouble downloading data due to network connectivity or temporary server unavailability at the moment. Please make sure you are connected to internet and try again.");
            }
        }
        private void webClient_DownloadTicketPricesCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                string json = e.Result;


                if (!string.IsNullOrEmpty(json))
                {
                    RootPriceObject rootPriceObj = JsonConvert.DeserializeObject <RootPriceObject>(json);
                    priceList = rootPriceObj.RESULTS.priceList;

                    if (priceList != null)
                    {
                        setTicketPrices();
                    }
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.ShowAsync("AW SNAP :-(", MessageBoxButtons.OK, "We are having trouble downloading data due to temporary server unavailability at the moment.");
            }
        }
示例#17
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _log.LogPageView("ExcelExport");

            _model = KernelService.Kernel.Get <ExcelExportViewModel>();
            _model.ExportBeginning += () =>
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    this.busyIndicator.IsRunning = true;
                });
            };
            _model.ExportCompleted += (isSuccess) =>
            {
                Deployment.Current.Dispatcher.BeginInvoke(async() =>
                {
                    this.busyIndicator.IsRunning = false;
                    if (isSuccess)
                    {
                        await RadMessageBox.ShowAsync(new object[] { Shane.Church.WhatIEat.Strings.Resources.Ok }, Shane.Church.WhatIEat.Strings.Resources.UploadSuccessTitle, Shane.Church.WhatIEat.Strings.Resources.UploadSuccessMessage);
                    }
                    else
                    {
                        await RadMessageBox.ShowAsync(new object[] { Shane.Church.WhatIEat.Strings.Resources.Ok }, Shane.Church.WhatIEat.Strings.Resources.UploadFailedTitle, Shane.Church.WhatIEat.Strings.Resources.UploadFailedMessage);
                    }
                });
            };
            this.DataContext = _model;

            if (!_model.AreAdsVisible && AdMediator_3BB1FC != null)
            {
                AdPanel.Children.Remove(AdMediator_3BB1FC);
                AdMediator_3BB1FC = null;
            }

            base.OnNavigatedTo(e);
        }