Exemplo n.º 1
0
        internal async void SaveCode()
        {
            FolderPicker folderPicker = new FolderPicker();

            folderPicker.FileTypeFilter.Add("*");
            folderPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            StorageFolder folder = await folderPicker.PickSingleFolderAsync();

            string ext = (string)BasicLib.GetSetting(SettingsNames.GCODE_FILE_EXT);

            foreach (GcodeFile f in Code)
            {
                try
                {
                    if (System.IO.Path.GetExtension(f.FileName) != ext)
                    {
                        f.FileName = System.IO.Path.ChangeExtension(f.FileName, ext);
                    }

                    StorageFile file = await folder.CreateFileAsync(f.FileName, CreationCollisionOption.ReplaceExisting);

                    if (file != null)
                    {
                        await Windows.Storage.FileIO.WriteTextAsync(file, f.Code);
                    }
                }
                catch (Exception e)
                {
                    CoreWindowDialog dlg = new CoreWindowDialog(e.Message);
                    dlg.ShowAsync();
                }
            }
        }
Exemplo n.º 2
0
        private async void CreateLoginDialogAsync()
        {
            var dialog = new CoreWindowDialog("Welcome to Pusher");

            dialog.Commands.Add(new UICommand("Login with Pushbullet", PerformLoginAsync));
            await dialog.ShowAsync();
        }
Exemplo n.º 3
0
 async Task ShowDialog(string s)
 {
     CoreWindowDialog dialog = new CoreWindowDialog(s);
     await dialog.ShowAsync();
 }