Exemplo n.º 1
0
        private void LoadSecureFile()
        {
            IsNewStart = false;

            SecureFolder = FileSystemStorageItemBase.Create(Path.Combine(ApplicationData.Current.LocalCacheFolder.Path, "SecureFolder"), StorageItemTypes.Folder, CreateOption.OpenIfExist);

            foreach (SecureAreaStorageItem Item in SecureFolder.GetChildrenItems(false, ItemFilters.File))
            {
                SecureCollection.Add(Item);
            }

            if (SecureCollection.Count == 0)
            {
                EmptyTips.Visibility = Visibility.Visible;
            }
        }
Exemplo n.º 2
0
        private async void Save_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (CurrentEncoding != null)
                {
                    try
                    {
                        using (FileStream Stream = FileSystemStorageItemBase.Create(TextFile.Path, StorageItemTypes.File, CreateOption.ReplaceExisting).GetFileStreamFromFile(AccessMode.Write))
                            using (StreamWriter Writer = new StreamWriter(Stream, CurrentEncoding))
                            {
                                await Writer.WriteAsync(Text.Text).ConfigureAwait(true);
                            }
                    }
                    catch
                    {
                        QueueContentDialog Dialog = new QueueContentDialog
                        {
                            Title           = Globalization.GetString("Common_Dialog_ErrorTitle"),
                            Content         = Globalization.GetString("QueueDialog_CouldReadWriteFile_Content"),
                            CloseButtonText = Globalization.GetString("Common_Dialog_CloseButton")
                        };

                        await Dialog.ShowAsync().ConfigureAwait(true);
                    }

                    Frame.GoBack();
                }
                else
                {
                    InvalidTip.IsOpen = true;
                }
            }
            catch
            {
                InvalidTip.IsOpen = true;
            }
        }