Exemplo n.º 1
0
        private async void DownloadJpegButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                await ImagesViewModel.SelectedImageViewModel.SaveImageFileAsync(PostImageVersion.Jpeg);

                SaveFlyout.Hide();
            }
            catch (Exception ex)
            {
                await new MessageDialog(ex.Message, "Error").ShowAsync();
            }
        }
        /// <summary>
        /// Confirm save flyout
        /// </summary>
        private async void ConfirmSave_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(SaveFlyoutUserPath.Text))
            {
                var savePath = SaveFlyoutUserPath.Text;
                SaveProgressBar.Width      = SaveFlyoutUserPath.ActualWidth - CancelSave.ActualWidth - ConfirmSave.ActualWidth - 30; // 30 == combined margin size
                SaveProgressBar.Visibility = Visibility.Visible;

                try
                {
                    if (SaveAllButton.Flyout.IsOpen)
                    {
                        await Client.SaveAllTaskListsToXmlFile(savePath);
                    }
                    else
                    {
                        await Client.SaveTaskListToXmlFile(_activeGuid, savePath);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.GetType() != typeof(FactoryOrchestratorConnectionException))
                    {
                        ContentDialog failedSaveDialog = new ContentDialog
                        {
                            Title           = resourceLoader.GetString("FOXMLSaveFailed"),
                            Content         = $"{ex.Message}",
                            CloseButtonText = resourceLoader.GetString("Ok")
                        };

                        _ = await failedSaveDialog.ShowAsync();
                    }
                }

                SaveProgressBar.Visibility = Visibility.Collapsed;
                SaveFlyout.Hide();
            }
        }
 /// <summary>
 /// Cancel save flyout
 /// </summary>
 private void CancelSave_Click(object sender, RoutedEventArgs e)
 {
     SaveFlyout.Hide();
 }