private void RoutesRadioButton_Checked(object sender, RoutedEventArgs e)
 {
     if (!IsLoading)
     {
         SettingsManager.SetSetting("LaunchPage", false, 2);
     }
 }
 private void WarnOnDownloadLowBandwidthSwitch_Toggled(object sender, RoutedEventArgs e)
 {
     if (!IsLoading)
     {
         SettingsManager.SetSetting("LimitedData.WarnOnDownload", false, WarnOnDownloadLowBandwidthSwitch.IsOn);
     }
 }
 private void DelayDownloadingStopsLowBandwidthSwitch_Toggled(object sender, RoutedEventArgs e)
 {
     if (!IsLoading)
     {
         SettingsManager.SetSetting("LimitedData.ManuallyDownloadStops", false, !DelayDownloadingStopsLowBandwidthSwitch.IsOn);
     }
 }
 private void CancelOnBandwidthChangedLowBandwidthSwitch_Toggled(object sender, RoutedEventArgs e)
 {
     if (!IsLoading)
     {
         SettingsManager.SetSetting("CancelDownloadsOnBandwidthChanged", false, CancelOnBandwidthChangedLowBandwidthSwitch.IsOn);
     }
 }
 private void TechnicalModeSwitch_Toggled(object sender, RoutedEventArgs e)
 {
     if (!IsLoading)
     {
         SettingsManager.SetSetting("TechnicalMode", false, TechnicalModeSwitch.IsOn);
     }
 }
 private void LimitedDataFavoritesRadioButton_Checked(object sender, RoutedEventArgs e)
 {
     if (!IsLoading)
     {
         SettingsManager.SetSetting("LimitedData.LaunchPage", false, 1);
     }
 }
        private async void OnStopsClicked(BusStop[] stops, BasicGeoposition location)
        {
            BasicGeoposition newCenter = location;

            newCenter.Latitude = location.Latitude + (MainMap.TopLeft.Latitude - MainMap.BottomRight.Latitude) / 2 - 50 * MainMap.LatitudePerPixel;
            double halfLatSpan = (MainMap.TopLeft.Latitude - MainMap.BottomRight.Latitude) / 2.5;
            double halfLonSpan = (MainMap.BottomRight.Longitude - MainMap.TopLeft.Longitude) / 2.5;

            if (halfLatSpan > 0 && halfLonSpan > 0)
            {
                await MainMap.MapControl.TrySetViewBoundsAsync(new GeoboundingBox(new BasicGeoposition()
                {
                    Latitude = newCenter.Latitude + halfLatSpan, Longitude = newCenter.Longitude - halfLonSpan
                },
                                                                                  new BasicGeoposition()
                {
                    Latitude = newCenter.Latitude - halfLatSpan, Longitude = newCenter.Longitude + halfLonSpan
                }), null, MapAnimationKind.Linear);
            }

            MapControl.SetLocation(StopArrivalBoxGrid, new Geopoint(location));
            StopArrivalBox.SetStops(stops);
            VisualStateManager.GoToState(this, "ArrivalBoxShown", true);
            if (!SettingsManager.GetSetting("ShowStopPageTipShown", true, false) && (new Random()).NextDouble() < 0.05)
            {
                SettingsManager.SetSetting("ShowStopPageTipShown", true, true);
                await Task.Delay(1000);

                await StopArrivalBox.ShowHelpTip();
            }
        }
示例#8
0
        private async void RootFrame_Navigated(object sender, NavigationEventArgs e)
        {
            CheckCorrectButton();
            await Task.Delay(1000);

            if (ActualWidth < 500)
            {
                if (!SettingsManager.GetSetting("DownloadRoutesTipShown", true, false) && (new Random()).NextDouble() < 0.05)
                {
                    SettingsManager.SetSetting("DownloadRoutesTipShown", true, true);
                    await ShowPopup(CompactRoutesButton, AnimationDirection.Bottom, 250, 135, typeof(HelpTip), new Tuple <AnimationDirection, Thickness, string>(AnimationDirection.Top, new Thickness(0), "Tap here to download route schedules for offline viewing."));
                }
            }
        }
示例#9
0
        public static async Task <BasicGeoposition?> GetCurrentLocation(PositionAccuracy acc)
        {
            var loc = new Geolocator();

            try
            {
                loc.DesiredAccuracy = acc;
                var result = (await loc.GetGeopositionAsync()).Coordinate.Point.Position;
                SettingsManager.SetSetting <double[]>("LastLocation", true, new double[] { result.Latitude, result.Longitude });
                return(result);
            }
            catch (Exception) { }
            return(null);
        }
示例#10
0
        //private void CoreTitleBar_LayoutMetricsChanged(CoreApplicationViewTitleBar sender, object args)
        //{
        //    MainOuterFrame.SystemButtonsWidth = NoTitleBar ? 0 : sender.SystemOverlayRightInset;
        //}

        protected override async void OnActivated(IActivatedEventArgs args)
        {
            base.OnActivated(args);
            if (args.Kind == ActivationKind.ToastNotification)
            {
                var toastArgs = args as ToastNotificationActivatedEventArgs;
                if (toastArgs.Argument.StartsWith("messageTapped"))
                {
                    //await MainHamburgerBar.ShowPopup(null, AnimationDirection.Bottom, Window.Current.Bounds.Width * 0.9, 100 + 30000 / Window.Current.Bounds.Width, typeof(MessagePopupPage), SettingsManager.GetSetting<string>("Message" + toastArgs.Argument.Substring(13), false));
                }
                if (toastArgs.Argument.StartsWith("suppressMessage"))
                {
                    SettingsManager.SetSetting("SuppressMessage" + toastArgs.Argument.Substring(15), true, true);
                }
            }
        }
        private static void _FavoriteArrivals_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            string favsDecoded;

            using (MemoryStream stream = new MemoryStream())
            {
                FavoriteArrivalsSerializer.WriteObject(stream, _FavoriteArrivals.ToArray());
                stream.Position = 0;
                StreamReader reader = new StreamReader(stream);
                favsDecoded = reader.ReadToEnd();
            }
            SettingsManager.SetSetting("FavoriteArrivals", true, favsDecoded);
            if (FavoritesChanged != null)
            {
                FavoritesChanged(null, new EventArgs());
            }
        }
示例#12
0
        public static void ShowMessage(Message message)
        {
            if (SettingsManager.GetSetting("SuppressMessage" + message.Id, true, false))
            {
                return;
            }

            string title          = message.Caption;
            string content        = message.ShortSummary + " Tap for more...";
            string toastVisual    = $@"<visual>
                          <binding template='ToastGeneric'>
                            <text>{title}</text>
                            <text>{content}</text>
                          </binding>
                        </visual>";
            string toastActions   = $@"<actions>
                           <action activationType = 'foreground' arguments = 'dismiss' content = 'Ok' />
                           <action activationType = 'foreground' arguments = 'suppressMessage{message.Id.ToString()}' content = 'Stop Showing This' />
                         </actions>";
            string toastXmlString = $@"<toast activationType='foreground' launch='messageTapped{message.Id.ToString()}'>
                             {toastVisual}
                             {toastActions}
                           </toast>";

            XmlDocument toastXml = new XmlDocument();

            toastXml.LoadXml(toastXmlString);
            var toast = new ToastNotification(toastXml);

            toast.Tag   = "message" + message.Id.ToString();
            toast.Group = "messages";
            SettingsManager.SetSetting("Message" + message.Id, false, message.FullText);
            List <int> messages = SettingsManager.GetSetting("Message", false, new int[0]).ToList();

            if (!messages.Contains(message.Id))
            {
                messages.Add(message.Id);
                SettingsManager.SetSetting("Messages", false, messages.ToArray());
            }

            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }