예제 #1
0
        // Constructor
        public MainPage()
        {
            IScheduler scheduler = Scheduler.Dispatcher;

            scheduler.Schedule(() =>
            {
                InitializeComponent();
                SystemTray.SetOpacity(this, 0.0);
                SetRefreshImage();
                if (!(App.isoSettings.Contains("UpComing")))
                {
                    App.isoSettings.Add("UpComing", "");
                }
                if (!(App.isoSettings.Contains("FinalKey")))
                {
                    App.isoSettings.Add("FinalKey", "");
                }

                RefreshTileTask();
            });
            DataContext = App.MainViewModel;



#if DEBUG
            ScheduledAction action = ScheduledActionService.Find("CanucksNewsScheduler");
            if (action != null)
            {
                ScheduledActionService.LaunchForTest("CanucksNewsScheduler", TimeSpan.FromSeconds(1));
            }
            #endif
        }
예제 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainPage()
        {
            InitializeComponent();

            if (App.Current.Host.Content.ScaleFactor == 150)
            {
                BgBrush.ImageSource = new BitmapImage(
                    new Uri(@"Assets/Background-720p.png", UriKind.Relative)
                    );
                barBottomMargin = 444;
            }
            else
            {
                BgBrush.ImageSource = new BitmapImage(
                    new Uri(@"Assets/Background.png", UriKind.Relative)
                    );
                barBottomMargin = 394;
            }

            SystemTray.SetOpacity(this, 0.01);

            App.AudioModel.AudioBufferChanged += new AudioBufferChangedEventHandler(AudioBufferChanged);

            InitializeVisualizationBars();
        }
예제 #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public ArtistPivotPage()
 {
     InitializeComponent();
     DataContext = App.ViewModel;
     SystemTray.SetOpacity(this, 0.01);
     CreateAppBar();
 }
예제 #4
0
 void showProgress()
 {
     Deployment.Current.Dispatcher.BeginInvoke(() => {
         SystemTray.SetOpacity(this, 1);
         progress.IsVisible = true;
     });
 }
예제 #5
0
        public Twitter()
        {
            InitializeComponent();

            DataContext = TwitterViewModel;
            SystemTray.SetOpacity(this, 0.0);
        }
예제 #6
0
 void hideProgress()
 {
     Deployment.Current.Dispatcher.BeginInvoke(() => {
         SystemTray.SetOpacity(this, 0);
         progress.IsVisible = false;
     });
 }
예제 #7
0
        public async Task <SubmitResultType> Submit()
        {
            ProgressIndicator progress = new ProgressIndicator
            {
                IsVisible       = true,
                IsIndeterminate = true,
                Text            = AppResources.PostsPage_Submitting
            };

            PhoneApplicationPage page = (App.Current.RootVisual as PhoneApplicationFrame).Content as PhoneApplicationPage;

            SystemTray.SetOpacity(page, 1);
            SystemTray.SetIsVisible(page, true);
            SystemTray.SetProgressIndicator(page, progress);

            SubmitResultType result = await SubmitInternal(_thread.Number);

            if (result == SubmitResultType.Success)
            {
                progress.Text = AppResources.PostsPage_PostSuccess;

                Task ignore = Task.Delay(1000).ContinueWith(task =>
                {
                    SystemTray.SetProgressIndicator(page, null);
                    SystemTray.SetIsVisible(page, false);
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
            else
            {
                SystemTray.SetProgressIndicator(page, null);
                SystemTray.SetIsVisible(page, false);
            }
            return(result);
        }
        /// <summary>
        /// Show or iide the progress bar
        /// </summary>
        /// <param name="sender">the current page that call the progress</param>
        /// <param name="displayText">Text to be displayed</param>
        /// <param name="displayTime">Time to automatically hide the progress, in miliseconds</param>
        /// <param name="isIndeterminate">True for non progress loading</param>
        /// <param name="isVisible">True to be displayed, false for hide</param>
        public static void ShowProgress(object sender, string displayText, int displayTime, bool isIndeterminate,
                                        bool isVisible)
        {
            var progress = new ProgressIndicator
            {
                IsVisible       = isVisible,
                IsIndeterminate = isIndeterminate,
                Text            = displayText
            };

            SystemTray.SetIsVisible((DependencyObject)sender, isVisible);
            SystemTray.SetOpacity((DependencyObject)sender, 0.7);
            SystemTray.SetProgressIndicator((DependencyObject)sender, progress);

            if (displayTime > 0)
            {
                ThreadPool.QueueUserWorkItem(obj =>
                {
                    Thread.Sleep(displayTime);

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        //MessageBox.Show("after delay");
                        SystemTray.SetIsVisible((DependencyObject)sender, false);
                    });
                });
            }
        }
예제 #9
0
        private async Task LoadSequensesList()
        {
            try
            {
                SystemTray.SetIsVisible(this, true);
                SystemTray.SetOpacity(this, 0);
                progress.IsVisible = true;
                string url                   = string.Format(SEQ_URI, LoginService.SignInUserName, Keys.WP_CLIENT_ID);
                var    httpClient            = new HttpClient(new HttpClientHandler());
                HttpResponseMessage response = await httpClient.GetAsync(new Uri(url));

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var responseString = await response.Content.ReadAsStringAsync();

                    httpClient.Dispose();
                    JObject jobj    = JObject.Parse(responseString);
                    bool    hasMore = jobj["more"] != null ? (bool)jobj["more"] : false;
                    JArray  jlist   = (JArray)jobj["ss"];
                    var     seqList = new List <ImgSequence>();
                    foreach (JObject obj in jlist)
                    {
                        var    sq   = new ImgSequence();
                        string mkey = obj["mkey"].ToString();
                        sq.MKey  = mkey;
                        sq.Image = string.Format("https://d1cuyjsrcm0gby.cloudfront.net/{0}/thumb-320.jpg", mkey);
                        string capturedAt = obj["captured_at"].ToString();
                        sq.Place = obj["location"].ToString();
                        if (string.IsNullOrEmpty(sq.Place))
                        {
                            sq.Place = "Unknown location";
                        }

                        try
                        {
                            var dt = new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(Convert.ToDouble(capturedAt));
                            sq.Date = dt.ToShortDateString();
                        }
                        catch (Exception) { }
                        seqList.Add(sq);
                    }

                    sequenceList.ItemsSource = seqList;
                    App.SequenceListCache    = seqList;
                }
                else
                {
                    await ShowErrorResponse(response, "An error occurred while getting your sequenses.");
                }
            }
            catch (Exception ex)
            {
                SystemTray.SetIsVisible(this, false);
                progress.IsVisible = false;
                MessageBox.Show("An error occurred while getting your sequenses: " + ex.Message, "Error", MessageBoxButton.OK);
            }

            SystemTray.SetIsVisible(this, false);
            progress.IsVisible = false;
        }
예제 #10
0
        private async Task LoadProfile()
        {
            try
            {
                SystemTray.SetIsVisible(this, true);
                SystemTray.SetOpacity(this, 0);
                progress.IsVisible = true;
                string url                   = string.Format(PROFILE_URI, LoginService.SignInUserName, Keys.WP_CLIENT_ID);
                var    httpClient            = new HttpClient(new HttpClientHandler());
                HttpResponseMessage response = await httpClient.GetAsync(new Uri(url));

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var responseString = await response.Content.ReadAsStringAsync();

                    httpClient.Dispose();
                    JObject jobj  = JObject.Parse(responseString);
                    string  about = jobj["about"] != null ? jobj["about"].ToString() : "";
                    string  img   = jobj["avatar"] != null ? jobj["avatar"].ToString() : "";
                    string  user  = jobj["user"] != null ? jobj["user"].ToString() : "";
                    LoginService.SignInUserName = user;
                    numConnections.Text         = jobj["connections_all"] != null ? jobj["connections_all"].ToString() : "0";
                    numMeters.Text    = jobj["connections_all"] != null ? jobj["distance_all"].ToString() : "0";
                    numPhotos.Text    = jobj["connections_all"] != null ? jobj["images_all"].ToString() : "0";
                    aboutTxt.Text     = about;
                    emailAddress.Text = user;
                    if (string.IsNullOrEmpty(numMeters.Text))
                    {
                        numMeters.Text = "0";
                    }
                    BitmapImage bitmap = null;
                    if (!string.IsNullOrEmpty(img))
                    {
                        bitmap = new BitmapImage(new Uri(img))
                        {
                            CreateOptions = BitmapCreateOptions.IgnoreImageCache
                        };
                        profileImg.Source = bitmap;
                    }

                    App.NumConnProfileCache   = numConnections.Text;
                    App.NumMetersProfileCache = numMeters.Text;
                    App.NumPhotosProfileCache = numPhotos.Text;
                    App.AboutProfileCache     = about;
                    App.ImageProfileCache     = bitmap;
                }
                else
                {
                    await ShowErrorResponse(response, "An error occurred while getting your profile.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred while getting your profile: " + ex.Message, "Error", MessageBoxButton.OK);
            }

            SystemTray.SetIsVisible(this, false);
            progress.IsVisible = false;
        }
예제 #11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public MainPage()
 {
     InitializeComponent();
     DataContext = App.ViewModel;
     SystemTray.SetOpacity(this, 0.01);
     LocalAudioList.LayoutUpdated      += OnFavoriteLayoutUpdated;
     RecommendationsList.LayoutUpdated += OnRecommendationsLayoutUpdated;
 }
예제 #12
0
 public StudyPage()
 {
     InitializeComponent();
     prog = new ProgressIndicator();
     SystemTray.SetOpacity(this, 0.5);
     SystemTray.SetProgressIndicator(this, prog);
     prog.IsIndeterminate = true;
     prog.Text            = "Creating category...";
 }
 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
 {
     //Set Progress Indicator on PageLoad.
     if (isFirstLoad)
     {
         SystemTray.SetOpacity(this, 0.7);
         var progressIndicator = new ProgressIndicator();
         SystemTray.SetProgressIndicator(this, progressIndicator);
         SetProgressIndicator(true, AppResources.Stave_Loading);
     }
 }
예제 #14
0
        private void InitializeSystemTray()
        {
            ProgressIndicator prog = new ProgressIndicator();

            prog.IsIndeterminate = true;
            prog.IsVisible       = false;

            SystemTray.SetOpacity(this, 0);
            SystemTray.SetProgressIndicator(this, prog);
            SystemTray.SetIsVisible(this, false);
        }
예제 #15
0
 /// <summary>
 /// Fancy UI to show progress of downloading map
 /// </summary>
 private void InitializeProgressIndicator()
 {
     SystemTray.SetIsVisible(this, true);
     SystemTray.SetOpacity(this, 0.5);
     SystemTray.SetBackgroundColor(this, Colors.Black);
     SystemTray.SetForegroundColor(this, Colors.White);
     prog = new ProgressIndicator();
     prog.IsIndeterminate = true;
     prog.IsVisible       = true;
     SystemTray.SetProgressIndicator(this, prog);
 }
예제 #16
0
 internal static void ShowProgress(PhoneApplicationPage page, string text, double opacity)
 {
     SystemTray.SetOpacity(page, opacity);
     SystemTray.SetIsVisible(page, true);
     SystemTray.SetProgressIndicator(page, new ProgressIndicator()
     {
         IsIndeterminate = true,
         IsVisible       = true,
         Text            = text
     });
 }
예제 #17
0
        public MainPage()
        {
            isExit = false;

            InitializeComponent();
            BuildLocalizedApplicationBar();

            BackgroundAudioPlayer.Instance.PlayStateChanged += Instance_PlayStateChanged;

            SystemTray.SetIsVisible(this, true);
            SystemTray.SetOpacity(this, 0);
        }
        public StockTwits_Auth()
        {
            InitializeComponent();

            SystemTray.SetOpacity(this, 0);

            indicator                 = new ProgressIndicator();
            indicator.IsVisible       = false;
            indicator.IsIndeterminate = true;

            SystemTray.SetProgressIndicator(this, indicator);
        }
예제 #19
0
        public async Task Save()
        {
            if (SelectedIndex >= 0 && SelectedIndex < ImagePosts.Count)
            {
                bool cantSave = false;

                Models.API.APIPost.FileTypes fileType = (ImagePosts[SelectedIndex] as ImageViewerPostViewModel).FileType;
                if (fileType == Models.API.APIPost.FileTypes.webm || fileType == Models.API.APIPost.FileTypes.swf || fileType == Models.API.APIPost.FileTypes.gif)
                {
                    cantSave = true;
                }

                ProgressIndicator progress = new ProgressIndicator
                {
                    IsVisible       = true,
                    IsIndeterminate = true,
                    Text            = cantSave ? AppResources.ImageViewerPage_CantSave : AppResources.ImageViewerPage_SavingImage
                };

                PhoneApplicationPage page = (App.Current.RootVisual as PhoneApplicationFrame).Content as PhoneApplicationPage;

                SystemTray.SetOpacity(page, 0.99);
                SystemTray.SetIsVisible(page, true);
                SystemTray.SetProgressIndicator(page, progress);

                if (cantSave)
                {
                    await Task.Delay(1000);
                }
                else
                {
                    bool result = await SaveInternal(ImagePosts[SelectedIndex] as ImageViewerPostViewModel);

                    if (result)
                    {
                        progress.Text = AppResources.ImageViewerPage_ImageSaved;
                        await Task.Delay(400);
                    }
                    else
                    {
                        progress.Text = AppResources.ImageViewerPage_ImageFailed;
                        await Task.Delay(1000);
                    }
                }

                SystemTray.SetProgressIndicator(page, null);
                SystemTray.SetIsVisible(page, false);
            }
        }
예제 #20
0
        private async void loginButton_Click(object sender, RoutedEventArgs e)
        {
            if (email.Text.Trim() == string.Empty || password.Password.Trim() == string.Empty)
            {
                MessageBox.Show("Please enter both e-mail and password to login.", "Login failed", MessageBoxButton.OK);
                return;
            }

            progress.IsVisible       = true;
            progress.IsIndeterminate = true;
            SystemTray.SetIsVisible(this, true);
            SystemTray.SetOpacity(this, 0);
            await Login(email.Text.Trim(), password.Password);

            SystemTray.SetIsVisible(this, false);
            progress.IsVisible = false;
        }
예제 #21
0
        public void Set(Color?bg, Color?fg, double?op)
        {
            if (bg.HasValue)
            {
                SystemTray.SetBackgroundColor(managedPage, bg.Value);
            }

            if (fg.HasValue)
            {
                SystemTray.SetForegroundColor(managedPage, fg.Value);
            }

            if (op.HasValue)
            {
                SystemTray.SetOpacity(managedPage, op.Value);
            }
        }
예제 #22
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            btnalert.IsEnabled = true;

            SystemTray.SetIsVisible(this, true);
            SystemTray.SetOpacity(this, .9);

            prog                 = new ProgressIndicator();
            prog.IsVisible       = false;
            prog.IsIndeterminate = false;
            prog.Text            = "Getting GPS location...";

            SystemTray.SetProgressIndicator(this, prog);

            Addresses = new List <string>();
            GetSettings();
            BuildLocalizedApplicationBar();

            if (Rate.HasAppBeenRated().ToUpper() == "YES")
            {
                _rated         = true;
                App.gTextLimit = App.gTextLimitExtended;
            }
            else
            {
                _rated         = false;
                App.gTextLimit = App.gTextLimitTrial;
            }

            if ((Application.Current as App).IsTrial)
            {
                TextStatusMessage           = AppResources.TrialTextSent + App.gSentTextCount.ToString() + "/" + App.gTextLimit;
                TextStatusMessageVisibility = Visibility.Visible;
            }
            else
            {
                TextStatusMessage           = string.Empty;
                TextStatusMessageVisibility = Visibility.Collapsed;
            };

            this.DataContext = this;
        }
예제 #23
0
    public MainPage()
    {
        InitializeComponent();

        _progressIndicator = new ProgressIndicator
        {
            IsIndeterminate = true,
            Text            = "Loading...",
            IsVisible       = true,
        };

        SystemTray.SetIsVisible(this, true);
        SystemTray.SetProgressIndicator(this, _progressIndicator);
        SystemTray.SetOpacity(this, 1);

        //something is a very long here

        _progressIndicator.IsVisible = false;
        SystemTray.SetIsVisible(this, false);
    }
예제 #24
0
    void activateProgressIndicator()
    {
        // In theory, you should not need to use Dispatcher here with async/await.
        // But without a complete code example, it's impossible for me to
        // say for sure, so I've left it as-is.
        Deployment.Current.Dispatcher.BeginInvoke(() =>
        {
            var currentPage = App.RootFrame.Content as PhoneApplicationPage;
            SystemTray.SetIsVisible(currentPage, true);
            SystemTray.SetOpacity(currentPage, 0.5);
            SystemTray.SetBackgroundColor(currentPage, Colors.White);
            SystemTray.SetForegroundColor(currentPage, Colors.Black);

            progressIndicator                 = new ProgressIndicator();
            progressIndicator.IsVisible       = true;
            progressIndicator.IsIndeterminate = true;
            progressIndicator.Text            = message;

            SystemTray.SetProgressIndicator(currentPage, progressIndicator);
        });
    }
예제 #25
0
        public void Cadastrar()
        {
            ParseObject cadastro = new ParseObject("Usuarios");

            cadastro["Nome"]  = txt_nome.Text;
            cadastro["Email"] = txt_email.Text;
            cadastro["Senha"] = txt_senha.Password;

            if (chk_foodtruck.IsChecked == true)
            {
                cadastro["foodtruck"] = true;
            }
            else
            {
                cadastro["foodtruck"] = false;

                SystemTray.SetIsVisible(this, true);
                SystemTray.SetOpacity(this, 1);

                ProgressIndicator progresso = new ProgressIndicator
                {
                    IsVisible       = true,
                    IsIndeterminate = true,
                    Text            = "Aguarde um instante..."
                };

                this.DataContext = null;
                SystemTray.SetProgressIndicator(this, progresso);

                cadastro.SaveAsync();

                MessageBoxResult resultado = MessageBox.Show("Cadastro realizado com sucesso", "Seja Bem-Vindo!", MessageBoxButton.OK);

                if (resultado == MessageBoxResult.OK)
                {
                    NavigationService.GoBack();
                }
            }
        }
예제 #26
0
        public MainPage()
        {
            InitializeComponent();
            listings.ItemsSource            = App.LatestShows;
            shows.ItemsSource               = App.Shows;
            downloads.ItemsSource           = App.Torrents;
            clientAddClientType.ItemsSource = EnumHelper <Enums.ClientTypes> .GetNames();

            App.LatestShows.DataLoading += (s, e) => { showProgress("Loading data, please wait..."); };
            App.LatestShows.DataLoaded  += (s, e) => { hideProgress(); };
            App.LatestShows.DataError   += (s, e) => {
                Deployment.Current.Dispatcher.BeginInvoke(() => {
                    MessageBox.Show("No result came from your query.");
                    hideProgress();
                });
            };
            App.LatestShows.DataSearching += (s, e) => {
                Deployment.Current.Dispatcher.BeginInvoke(() => {
                    showProgress("Searching, please wait...");
                });
            };

            App.Shows.DataLoading += (s, e) => { showProgress("Loading data, please wait..."); };
            App.Shows.DataLoaded  += (s, e) => { hideProgress(); };

            App.Torrents.DataLoading += (s, e) => { showProgress("Loading data, please wait..."); };
            App.Torrents.DataLoaded  += (s, e) => { hideProgress(); };

            pivot.LoadingPivotItem += new EventHandler <PivotItemEventArgs>(pivot_DataLoading);
            pivot.LoadedPivotItem  += new EventHandler <PivotItemEventArgs>(pivot_DataLoaded);

            SystemTray.SetOpacity(this, 0.0);
            progress = new ProgressIndicator {
                IsVisible       = false,
                IsIndeterminate = true,
                Text            = "Loading, please wait...",
            };
            SystemTray.SetProgressIndicator(this, progress);
        }
예제 #27
0
        private async Task LoadFeed()
        {
            try
            {
                SystemTray.SetIsVisible(this, true);
                SystemTray.SetOpacity(this, 0);
                progress.IsVisible = true;
                string url        = string.Format(FEED_URI, Keys.WP_CLIENT_ID);
                var    httpClient = new HttpClient(new HttpClientHandler());
                var    request    = new HttpRequestMessage(HttpMethod.Get, new Uri(url));
                request.Headers.Add("Authorization", "Bearer " + LoginService.SignInToken);
                request.Headers.Add("If-Modified-Since", DateTime.UtcNow.ToString("r"));
                HttpResponseMessage response = await httpClient.SendAsync(request);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var responseString = await response.Content.ReadAsStringAsync();

                    httpClient.Dispose();
                    JObject jobj     = JObject.Parse(responseString);
                    JArray  jlist    = (JArray)jobj["feed"];
                    var     feedList = new List <FeedItem>();
                    foreach (JObject obj in jlist)
                    {
                        var    item               = new FeedItem();
                        string action             = obj["action"] != null ? obj["action"].ToString() : "";
                        string type               = obj["type"] != null ? obj["type"].ToString() : "";
                        string object_type        = obj["object_type"] != null ? obj["object_type"].ToString() : "";
                        string object_key         = obj["object_key"] != null ? obj["object_key"].ToString() : "";
                        string object_value       = obj["object_value"] != null ? obj["object_value"].ToString() : "";
                        string image_url          = obj["image_url"] != null ? obj["image_url"].ToString() : "";
                        string image_key          = obj["image_key"] != null ? obj["image_key"].ToString() : "";
                        string main_description   = obj["main_description"] != null ? obj["main_description"].ToString() : "";
                        string detail_description = obj["detail_description"] != null ? obj["detail_description"].ToString() : "";
                        string created_at         = obj["created_at"] != null ? obj["created_at"].ToString() : null;
                        string started_at         = obj["started_at"] != null ? obj["started_at"].ToString() : null;
                        string updated_at         = obj["updated_at"] != null ? obj["updated_at"].ToString() : null;
                        string id          = obj["id"] != null ? obj["id"].ToString() : "";
                        int    nbr_objects = obj["nbr_objects"] != null ? (int)obj["nbr_objects"] : 0;

                        string user = obj["user"] != null ? obj["user"].ToString() : "";
                        bool   open = obj["open"] != null ? (bool)obj["open"] : false;

                        var dtcreated_at = created_at != null ? new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(Convert.ToDouble(created_at)) : DateTime.MinValue;
                        var dtstarted_at = started_at != null ? new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(Convert.ToDouble(started_at)) : DateTime.MinValue;
                        var dtupdated_at = updated_at != null ? new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(Convert.ToDouble(updated_at)) : DateTime.MinValue;

                        item.Action            = action;
                        item.Type              = type;
                        item.ObjectType        = object_type;
                        item.ObjectKey         = object_key;
                        item.ObjectValue       = object_value;
                        item.ImageUrl          = image_url;
                        item.ImageKey          = image_key;
                        item.MainDescription   = main_description;
                        item.DetailDescription = detail_description;
                        item.CreatedAt         = dtcreated_at;
                        item.StartedAt         = started_at;
                        item.UpdatedAt         = updated_at;
                        item.Id         = id;
                        item.NbrObjects = nbr_objects;
                        item.User       = user == LoginService.SignInEmail ? "You" : user;
                        item.Open       = open;
                        item.FirstLine  = item.User + " " + item.MainDescription;
                        if (dtstarted_at.DayOfYear == DateTime.Now.DayOfYear && dtstarted_at.Year == DateTime.Now.Year)
                        {
                            item.SecondLine = "Today";
                        }
                        else
                        {
                            item.SecondLine = dtstarted_at.ToShortDateString();
                        }

                        if (dtstarted_at == DateTime.MinValue)
                        {
                            item.SecondLine = "";
                        }

                        feedList.Add(item);
                    }

                    eventList.ItemsSource = feedList;
                    App.EventListCache    = feedList;
                    App.FeedLastRefreshed = DateTime.Now;
                }
                else
                {
                    //MessageBox.Show("An error occurred while getting your feed. Please try again.", "Error", MessageBoxButton.OK);
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("An error occurred while getting your feed: " + ex.Message, "Error", MessageBoxButton.OK);
            }

            ShowHideList(App.EventListCache != null && App.EventListCache.Count > 0);
            SystemTray.SetIsVisible(this, false);
            progress.IsVisible = false;
        }
예제 #28
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();


            #region trial Check
            if (App.IsTrial == true)
            {
                // enable ads
                adControl.Visibility = System.Windows.Visibility.Visible;
                //adControl.IsAutoRefreshEnabled = true;
                adControl.IsEnabled             = true;
                adControl.IsAutoCollapseEnabled = false;
            }
            else
            {
                // disables ads
                adControl.Visibility = System.Windows.Visibility.Collapsed;
                //adControl.IsAutoRefreshEnabled = false;
                adControl.IsEnabled             = false;
                adControl.IsAutoCollapseEnabled = false;
            }
            #endregion


            OrientationChanged += new EventHandler <OrientationChangedEventArgs>(MainPage_OrientationChanged);

            // initially check
            PageOrientation po = this.Orientation;
            if (po == PageOrientation.Portrait || po == PageOrientation.PortraitDown || po == PageOrientation.PortraitUp)
            {
                // return pivot to original position
                MapHeight           = 800;
                MainPivot.Margin    = new Thickness(0, 125, 0, 0);
                AllPivot.Header     = "all";
                FreewayPivot.Header = "highways";
                RoadPivot.Header    = "roads";

                // this.ApplicationBar.IsVisible = this.ApplicationBar.IsVisible;
            }
            else if (po == PageOrientation.Landscape || po == PageOrientation.LandscapeLeft || po == PageOrientation.LandscapeRight)
            {
                // hiding pivot header in landscape mode
                MapHeight           = 480;
                MainPivot.Margin    = new Thickness(0, 30, 0, 0);
                AllPivot.Header     = "";
                FreewayPivot.Header = "";
                RoadPivot.Header    = "";
                //    this.ApplicationBar.IsVisible = !this.ApplicationBar.IsVisible;
            }



            isolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings;


            // disable lock screen timer
            Microsoft.Phone.Shell.PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

            // References:
            // http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx
            // http://msdn.microsoft.com/en-us/library/hh441726.aspx
            // http://json.codeplex.com
            // Bing Maps REST Services API Reference: http://msdn.microsoft.com/en-us/library/ff701722.aspx
            // Adding Tile Layers (overlays) http://msdn.microsoft.com/en-us/library/ee681902.aspx

            wc = new WebClient();
            wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(REST_traffic);
            //wc.DownloadStringAsync(new Uri("http://dev.virtualearth.net/REST/v1/Traffic/Incidents/37,-105,45,-94?key=" + Id));

            // caching
            Current_Location.CacheMode = new BitmapCache();
            mMap.ZoomLevel             = 10;
            //mMap.ZoomBarVisibility = System.Windows.Visibility.Visible;
            Current_Location.Style          = (Style)(Application.Current.Resources["PushpinStyle"]);
            Current_Location.PositionOrigin = PositionOrigin.Center;

            MyPreviousLocation.X = 0; MyPreviousLocation.Y = 0;
            #region Progress Indicator
            SystemTray.SetIsVisible(this, true);
            SystemTray.SetOpacity(this, 0.5);
            SystemTray.SetBackgroundColor(this, Colors.Black);
            SystemTray.SetForegroundColor(this, Colors.White);
            prog = new ProgressIndicator();
            prog.IsIndeterminate = true;
            prog.IsVisible       = true;
            SystemTray.SetProgressIndicator(this, prog);

            #endregion
        }
예제 #29
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public AboutPage()
 {
     InitializeComponent();
     UpdateVersionString();
     SystemTray.SetOpacity(this, 0.01);
 }
예제 #30
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public MixesPage()
 {
     InitializeComponent();
     DataContext = App.ViewModel;
     SystemTray.SetOpacity(this, 0.01);
 }