public void RequirePasswordUnchecked(object arg)
 {
     if (App.SettingsHelper.RequirePassword)
     {
         NavigationService.Navigate(ViewLocator.View("Password", new { Mode = "Off" }));
     }
 }
 public void RequirePasswordChecked(object arg)
 {
     if (!App.SettingsHelper.RequirePassword)
     {
         NavigationService.Navigate(ViewLocator.View("Password"));
     }
 }
示例#3
0
        private void HandleActions()
        {
            if (NavigationContext.QueryString.ContainsKey("Action"))
            {
                string action = NavigationContext.QueryString["Action"];

                switch (action)
                {
                case "Record":
                    NavigationService.Navigate(ViewLocator.View("Record"));
                    break;

                case "Memo":
                    if (NavigationContext.QueryString.ContainsKey("Id"))
                    {
                        NavigationService.Navigate(ViewLocator.View("Memo", new { Id = NavigationContext.QueryString["Id"] }));
                    }
                    break;

                case "Tag":
                    if (NavigationContext.QueryString.ContainsKey("Id"))
                    {
                        NavigationService.Navigate(ViewLocator.View("List", new { Filter = "Tag", Id = NavigationContext.QueryString["Id"] }));
                    }
                    break;

                case "Favorites":
                    NavigationService.Navigate(ViewLocator.View("Favorites"));
                    break;
                }
            }
        }
示例#4
0
 public virtual void OnNavigating(object sender, NavigatingCancelEventArgs e)
 {
     if (_reset && e.IsCancelable && e.Uri == ViewLocator.View("Main"))
     {
         e.Cancel = true;
         _reset   = false;
     }
 }
        public void FavoriteTap(object arg)
        {
            var favorite = arg as Favorite;

            if (favorite != null)
            {
                NavigationService.Navigate(ViewLocator.View("Memo", new { Id = favorite.Memo.Id }));
            }
        }
示例#6
0
        public void TagTap(object arg)
        {
            var tag = arg as Tag;

            if (tag != null)
            {
                NavigationService.Navigate(ViewLocator.View("List", new { Filter = "Tag", Id = tag.Id }));
            }
        }
示例#7
0
        public void MemoTap(object arg)
        {
            var memo = arg as Memo;

            if (memo != null)
            {
                NavigationService.Navigate(ViewLocator.View("Memo", new { Id = memo.Id }));
            }
        }
示例#8
0
        public void Recover(object arg)
        {
#if BETA
            ShowMessage(AppResources.NotImplementedMessageText, AppResources.NotImplementedMessageCaption,
                        System.Windows.MessageBoxButton.OK);
#else
            NavigationService.Navigate(ViewLocator.View("Recover"));
#endif
        }
示例#9
0
        private void HandleVoiceCommands()
        {
            if (NavigationContext.QueryString.ContainsKey("VoiceCommand"))
            {
                string voiceCommand = NavigationContext.QueryString["VoiceCommand"];

                switch (voiceCommand)
                {
                case "Record":
                    NavigationService.Navigate(ViewLocator.View("Record"));
                    break;

                case "Show":
                    if (NavigationContext.QueryString.ContainsKey("views"))
                    {
                        string view = NavigationContext.QueryString["views"];

                        switch (view)
                        {
                        case "all":
                            NavigationService.Navigate(ViewLocator.View("List"));
                            break;

                        case "favorites":
                            NavigationService.Navigate(ViewLocator.View("Favorites"));
                            break;

                        case "map":
                            NavigationService.Navigate(ViewLocator.View("ListMap"));
                            break;
                        }
                    }
                    break;

                case "Play":
                    if (NavigationContext.QueryString.ContainsKey("plays"))
                    {
                        var plays = NavigationContext.QueryString["plays"];

                        switch (plays)
                        {
                        case "last recorded":
                            var memo = Recent.FirstOrDefault();

                            if (memo != null)
                            {
                                NavigationService.Navigate(ViewLocator.View("Memo", new { Id = memo.Id, Action = "Play" }));
                            }
                            break;
                        }
                    }
                    break;
                }
            }
        }
示例#10
0
 public void Share(object arg)
 {
     if (LicenseHelper.IsPremium)
     {
         NavigationService.Navigate(ViewLocator.View("Share", new { Id = _memo.Id }));
     }
     else
     {
         UpgradeToPremium();
     }
 }
示例#11
0
 public override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     if (NavigationContext.QueryString.ContainsKey("Url"))
     {
         _returnUri = new Uri(Uri.UnescapeDataString(NavigationContext.QueryString["Url"]), UriKind.RelativeOrAbsolute);
     }
     else
     {
         _returnUri = ViewLocator.View("Main");
     }
 }
示例#12
0
 public void Security(object arg)
 {
     if (LicenseHelper.IsPremium)
     {
         NavigationService.Navigate(ViewLocator.View("SecuritySettings"));
     }
     else
     {
         UpgradeToPremium();
     }
 }
示例#13
0
        public async void SocialShare(object arg)
        {
            try
            {
                IsUploading = true;
                string link = null;

                if (Account.Equals(AppResources.SkyDriveNameText))
                {
                    link = await UploadToSkyDriveAsync(true);
                }

                if (Account.Equals(AppResources.SoundCloudNameText))
                {
                    link = await UploadToSoundCloudAsync();
                }

                if (!string.IsNullOrWhiteSpace(link))
                {
                    TaskHelper.ShareSocial(link, _memo.Title);
                }

                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }
            catch (InvalidOperationException)
            {
                if (ShowMessage(string.Format(AppResources.AccountDisconnectedMessageText,
                                              Account), AppResources.AccountDisconnectedMessageCaption,
                                System.Windows.MessageBoxButton.OKCancel) == System.Windows.MessageBoxResult.OK)
                {
                    NavigationService.Navigate(ViewLocator.View("AccountSettings"));
                }

                IsUploading = false;
            }
            catch
            {
                IsUploading = false;
                ShowToast(AppResources.UploadFailedMessageCaption, string.Format(AppResources.UploadFailedMessageText, Account));
            }
        }
示例#14
0
        public void Save(object arg)
        {
            long timestamp = (DateTime.UtcNow.Ticks - 621355968000000000) / 10000000;

            var newMemo = new Memo
            {
                AudioFile   = _fileName,
                Title       = string.Format(AppResources.MemoNameTemplate, timestamp.ToString()),
                Duration    = _recorder.Duration,
                SampleRate  = _recorder.SampleRate,
                Channels    = _recorder.Channels,
                BitRate     = _recorder.BitsRate,
                AudioFormat = _recorder.EncodingFormat.ToString(),
                Latitude    = _location != null ? _location.Coordinate.Latitude : new Nullable <double>(),
                Longitude   = _location != null ? _location.Coordinate.Longitude : new Nullable <double>()
            };


            LocationHelper.StopTracking();
            _isRecording = false;
            ReleaseRecorder();

            Uow.MemoRepository.Add(newMemo);
            //Uow.Save();

            StatusText = AppResources.ReadyStatusText;

            //if (newMemo.AudioFormat.Equals("MP3"))
            //    StorageHelper.WriteId3Tag(newMemo.AudioFile, null, newMemo.Title, "Voice Memos", "Voice Memos", null);

            if (App.SettingsHelper.EditDetails)
            {
                NavigationService.Navigate(ViewLocator.View("Edit", new { Id = newMemo.Id, SourceView = "Record" }));
            }
            else
            {
                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }
        }
示例#15
0
        private void CheckForLoginNavigation(object sender, NavigatingCancelEventArgs e)
        {
            if (!LicenseHelper.IsPremium)
            {
                IsAuthenticated = true;
                return;
            }

            if (SettingsHelper.RequirePassword && !IsAuthenticated &&
                e.NavigationMode == NavigationMode.New && !e.Uri.OriginalString.Contains("LoginView"))
            {
                e.Cancel = true;

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    var url = Uri.EscapeDataString(e.Uri.OriginalString);
                    RootFrame.Navigate(ViewLocator.View("Login", new { Url = url }));
                });
            }
        }
示例#16
0
        public async void Upload(object arg)
        {
            try
            {
                IsUploading = true;

                if (Account.Equals(AppResources.SkyDriveNameText))
                {
                    await UploadToSkyDriveAsync(false);
                }

                if (Account.Equals(AppResources.SoundCloudNameText))
                {
                    await UploadToSoundCloudAsync();
                }

                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }
            catch (InvalidOperationException)
            {
                if (ShowMessage(string.Format(AppResources.AccountDisconnectedMessageText,
                                              Account), AppResources.AccountDisconnectedMessageCaption,
                                System.Windows.MessageBoxButton.OKCancel) == System.Windows.MessageBoxResult.OK)
                {
                    NavigationService.Navigate(ViewLocator.View("AccountSettings"));
                }

                IsUploading = false;
            }
            catch
            {
                IsUploading = false;
                ShowToast(AppResources.UploadFailedMessageCaption, string.Format(AppResources.UploadFailedMessageText, Account));
            }
        }
 public void ChangePassword(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("Password", new { Mode = "Change" }));
 }
示例#18
0
 public void Recording(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("RecordingSettings"));
 }
示例#19
0
 public void General(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("GeneralSettings"));
 }
示例#20
0
 public void Storage(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("StorageSettings"));
 }
示例#21
0
 public void Edit(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("Edit", new { Id = _memo.Id, SourceView = "Memo" }));
 }
示例#22
0
 public void About(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("About"));
 }
示例#23
0
 public void Search(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("Search"));
 }
示例#24
0
 public void ListMap(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("ListMap"));
 }
示例#25
0
 public void Favorites(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("Favorites"));
 }
示例#26
0
 public void Record(object arg)
 {
     NavigationService.Navigate(ViewLocator.View("Record"));
 }