コード例 #1
0
ファイル: RejectionView.xaml.cs プロジェクト: radtek/vas
 private void ListView_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
 {
     if (ApplicationView.Value == ApplicationViewState.Snapped)
     {
         ApplicationView.TryUnsnap();
     }
 }
コード例 #2
0
        /// <summary>
        /// Shows the flyout that has the passed Flyout Id and also allows it to pass a parameter and a success callback.
        /// </summary>
        /// <param name="flyoutId">The Flyout id.</param>
        /// <param name="parameter">The parameter.</param>
        /// <param name="successAction">The success action.</param>
        public void ShowFlyout(string flyoutId, object parameter, Action successAction)
        {
            if (FlyoutResolver == null)
            {
                return;
            }

            if (ApplicationView.Value == ApplicationViewState.Snapped)
            {
                _isUnsnapping = true;

                // Save ShowFlyout parameters so that they can be called in Current_SizeChanged handler
                _flyoutId      = flyoutId;
                _parameter     = parameter;
                _successAction = successAction;
                ApplicationView.TryUnsnap();
            }
            else
            {
                var flyout = FlyoutResolver(flyoutId);

                if (flyout != null)
                {
                    flyout.Open(parameter, successAction);
                }
            }
        }
コード例 #3
0
 private void grdSettings_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (ApplicationView.TryUnsnap() || ApplicationView.Value != ApplicationViewState.Snapped)
     {
         Windows.UI.ApplicationSettings.SettingsPane.Show();
     }
 }
コード例 #4
0
        /// <summary>
        /// Download the selected items.
        /// </summary>
        private async void downloadButton_Click(object sender, RoutedEventArgs e)
        {
            bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) ||
                              ApplicationView.TryUnsnap());

            if (!unsnapped)
            {
                NotifyUser("Cannot unsnap the sample.");
                return;
            }


            // Select a folder as target.
            Windows.Storage.Pickers.FolderPicker picker = new Windows.Storage.Pickers.FolderPicker();
            picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;

            picker.FileTypeFilter.Add("*");

            var folder = await picker.PickSingleFolderAsync();

            if (folder != null)
            {
                // Download the items.
                var itemsToDownload = itemGridView.SelectedItems.Select(i => (i as DataModel.SampleDataItem).Content);
                FTP.FTPDownloadManager.Instance.DownloadFTPItemsAsync(
                    itemsToDownload, folder, credential);
            }

            // Clear the selection.
            itemGridView.SelectedItems.Clear();
            itemListView.SelectedItems.Clear();
        }
コード例 #5
0
ファイル: InvoiceListViewModel.cs プロジェクト: radtek/vas
 public void ExpandButton(string expandString)
 {
     if (ApplicationView.Value == ApplicationViewState.Snapped)
     {
         ApplicationView.TryUnsnap();
     }
 }
コード例 #6
0
        public async Task LoadDetail(int invoiceid, string lineItemId)
        {
            try
            {
                if (ApplicationView.Value == ApplicationViewState.Snapped)
                {
                    ApplicationView.TryUnsnap();
                }
                IsBusy      = true;
                IsChildBusy = true;
                var serializableData = new { InvoiceId = invoiceid, LineItemId = lineItemId };
                this.LineItemDetails = await ServiceInvoker.Instance.InvokeServiceUsingGet <LineItemDetail>(ServiceInvoker.Instance.AppendUrl(string.Format(ServiceInvoker.GetLineItemSummary, invoiceid, lineItemId)));

                SetSummaryListsFromInvoiceDetail(this.LineItemDetails, this.Invoice);
                var a = this.LineItemDetails.LineItemId;
                IsChildBusy = false;
                IsBusy      = false;
                Messenger.Default.Send <ReturnToPage>(new ReturnToPage()
                {
                    PageItem = NavigationFactory.GetNavigationItem(Destination.InvoiceLineItemsView), Invoice = this.Invoice, LineItemId = this.LineItemDetails.LineItemId
                });
            }
            catch (T360Exception ex)
            {
                string message = getMessages(ex);
                ShowErrorMessage(message, Constants.InvoiceLineItemDetailFailed);
                if (T360ErrorCodes.NotInReviewerQueue.Equals(ex.ErrorCodes[0].Code))
                {
                    Navigator.Navigate(Destination.InvoiceListView);
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Returns a StorageFile that the user has selected as the encode destination.
        /// Selects a few common encoding formats.
        /// </summary>
        public static async Task <StorageFile> GetFileFromSavePickerAsync()
        {
            // Attempt to ensure that the view is not snapped, otherwise the picker will not display.
            if (ApplicationView.Value == ApplicationViewState.Snapped && !ApplicationView.TryUnsnap())
            {
                throw new Exception("File picker cannot display in snapped view.");
            }

            FileSavePicker picker = new FileSavePicker();

            picker.FileTypeChoices.Add("JPEG image", new string[] { ".jpg" });
            picker.FileTypeChoices.Add("PNG image", new string[] { ".png" });
            picker.FileTypeChoices.Add("BMP image", new string[] { ".bmp" });
            picker.DefaultFileExtension   = ".png";
            picker.SuggestedFileName      = "Output file";
            picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
            StorageFile file = await picker.PickSaveFileAsync();

            if (file == null)
            {
                throw new Exception("User did not select a file.");
            }

            return(file);
        }
コード例 #8
0
        async void OpenFileButton_Click(object sender, RoutedEventArgs e)
        {
            if (!ApplicationView.TryUnsnap())
            {
                VisualStateManager.GoToState(this, string.Format("Filled{0}", DisplayProperties.ResolutionScale), true);
            }

            await PickFileAsync(false);
        }
コード例 #9
0
        private async void StartMultipartUpload_Click(object sender, RoutedEventArgs e)
        {
            // By default 'serverAddressField' is disabled and URI validation is not required. When enabling the text
            // box validating the URI is required since it was received from an untrusted source (user input).
            // The URI is validated by calling Uri.TryCreate() that will return 'false' for strings that are not valid URIs.
            // Note that when enabling the text box users may provide URIs to machines on the intrAnet that require
            // the "Home or Work Networking" capability.
            Uri uri;

            if (!Uri.TryCreate(serverAddressField.Text.Trim(), UriKind.Absolute, out uri))
            {
                rootPage.NotifyUser("Invalid URI.", NotifyType.ErrorMessage);
                return;
            }

            // Verify that we are currently not snapped, or that we can unsnap to open the picker.
            if (ApplicationView.Value == ApplicationViewState.Snapped && !ApplicationView.TryUnsnap())
            {
                rootPage.NotifyUser("File picker cannot be opened in snapped mode. Please unsnap first.", NotifyType.ErrorMessage);
                return;
            }

            FileOpenPicker picker = new FileOpenPicker();

            picker.FileTypeFilter.Add("*");
            IReadOnlyList <StorageFile> files = await picker.PickMultipleFilesAsync();

            if (files.Count == 0)
            {
                rootPage.NotifyUser("No file selected.", NotifyType.ErrorMessage);
                return;
            }

            List <BackgroundTransferContentPart> parts = new List <BackgroundTransferContentPart>();

            for (int i = 0; i < files.Count; i++)
            {
                BackgroundTransferContentPart part = new BackgroundTransferContentPart("File" + i, files[i].Name);
                part.SetFile(files[i]);
                parts.Add(part);
            }

            BackgroundUploader uploader = new BackgroundUploader();
            UploadOperation    upload   = await uploader.CreateUploadAsync(uri, parts);

            String fileNames = files[0].Name;

            for (int i = 1; i < files.Count; i++)
            {
                fileNames += ", " + files[i].Name;
            }

            Log(String.Format("Uploading {0} to {1}, {2}", fileNames, uri.AbsoluteUri, upload.Guid));

            // Attach progress and completion handlers.
            await HandleUploadAsync(upload, true);
        }
コード例 #10
0
        /// <summary>
        /// To choose a media file to open.
        /// The file must be of extension .mp4, .wmv or .mp3.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void OpenFile_Click(object sender, RoutedEventArgs e)
        {
            if (!ApplicationView.TryUnsnap())
            {
                VisualStateManager.GoToState(this, string.Format("Filled{0}", DisplayProperties.ResolutionScale), true);
            }

            await PickFileAsync();

            //MediaDuration.Text = mediaElement.NaturalDuration.ToString();
        }
コード例 #11
0
        public static bool EnsureUnsnapped()
        {
            bool success = true;

            // Try to unsnap if we are currently snapped
            if (ApplicationView.Value == ApplicationViewState.Snapped)
            {
                success = ApplicationView.TryUnsnap();
            }

            return(success);
        }
コード例 #12
0
ファイル: MainPage.xaml.cs プロジェクト: amazing0844/Note
 async void EnsureUnsnapped()
 {
     // FilePicker APIs will not work if the application is in
     //a snapped state
     // If an app wants to show a FilePicker while snapped, it
     //must attempt to unsnap first
     unSnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());
     if (!unSnapped)
     {
         MessageDialog msg = new MessageDialog("Cannot open file picker in snapped view ");
         await msg.ShowAsync();
     }
 }
コード例 #13
0
        private bool EnsureUnsnapped()
        {
            // FilePicker APIs will not work if the application is in a snapped state.
            // If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
            bool unsnapped = true;

            if (ApplicationView.Value == ApplicationViewState.Snapped)
            {
                unsnapped = ApplicationView.TryUnsnap();
            }

            return(unsnapped);
        }
コード例 #14
0
        public async Task <int> PickFile()
        {
            if (ApplicationView.Value != ApplicationViewState.Snapped || ApplicationView.TryUnsnap())
            {
                FileOpenPicker picker = new FileOpenPicker();
                picker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
                foreach (string ext in VideoExtensions)
                {
                    picker.FileTypeFilter.Add(ext);
                }
                StorageFile file = await picker.PickSingleFileAsync();

                return(AddFile(file, 0));
            }
            return(-1);
        }
コード例 #15
0
        async void PlayListCreationButton_Click(object sender, RoutedEventArgs e)
        {
            if (!ApplicationView.TryUnsnap())
            {
                VisualStateManager.GoToState(this, "FullScreenLandscape", true);
            }

            myMediaElement.Stop();

            await PickFileAsync(true);

            if (MediaPlayList.Count > 0)
            {
                myPlaylist.ItemsSource   = MediaPlayList;
                myPlaylist.SelectedIndex = 0;
            }
        }
コード例 #16
0
        private async void StartUpload_Click(object sender, RoutedEventArgs e)
        {
            // By default 'serverAddressField' is disabled and URI validation is not required. When enabling the text
            // box validating the URI is required since it was received from an untrusted source (user input).
            // The URI is validated by calling Uri.TryCreate() that will return 'false' for strings that are not valid URIs.
            // Note that when enabling the text box users may provide URIs to machines on the intrAnet that require
            // the "Home or Work Networking" capability.
            Uri uri;

            if (!Uri.TryCreate(serverAddressField.Text.Trim(), UriKind.Absolute, out uri))
            {
                rootPage.NotifyUser("Invalid URI.", NotifyType.ErrorMessage);
                return;
            }

            // Verify that we are currently not snapped, or that we can unsnap to open the picker.
            if (ApplicationView.Value == ApplicationViewState.Snapped && !ApplicationView.TryUnsnap())
            {
                rootPage.NotifyUser("File picker cannot be opened in snapped mode. Please unsnap first.", NotifyType.ErrorMessage);
                return;
            }

            FileOpenPicker picker = new FileOpenPicker();

            picker.FileTypeFilter.Add("*");
            StorageFile file = await picker.PickSingleFileAsync();

            if (file == null)
            {
                rootPage.NotifyUser("No file selected.", NotifyType.ErrorMessage);
                return;
            }

            BackgroundUploader uploader = new BackgroundUploader();

            uploader.SetRequestHeader("Filename", file.Name);

            UploadOperation upload = uploader.CreateUpload(uri, file);

            Log(String.Format("Uploading {0} to {1}, {2}", file.Name, uri.AbsoluteUri, upload.Guid));

            // Attach progress and completion handlers.
            await HandleUploadAsync(upload, true);
        }
コード例 #17
0
        private static async void OpenFile()
        {
            if (ApplicationView.Value != ApplicationViewState.Snapped || ApplicationView.TryUnsnap())
            {
                Debug.Log("OpenFile...");

                Selection.Clear();
                LastOpenFiles.Clear();
                IsBusy = true;

                try
                {
                    FileOpenPicker openPicker = new FileOpenPicker();
                    openPicker.ViewMode = CurrentViewMode;
                    openPicker.SuggestedStartLocation = CurrentLocation;

                    foreach (string ext in Extensions.SelectMany(extension => extension.Extensions))
                    {
                        openPicker.FileTypeFilter.Add(ext.StartsWith("*") ? ext : "." + ext);
                    }

                    StorageFile file = await openPicker.PickSingleFileAsync();

                    if (file != null)
                    {
                        Selection.Add(file.Path);
                        LastOpenFiles.Add(file);
                    }
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex.ToString());
                }

                IsBusy = false;

                Debug.Log("OpenFile end: " + Selection.Count);
            }
            else
            {
                Debug.LogError("OpenFile: could not unsnap! " + Selection.Count);
            }
        }
コード例 #18
0
        /// <summary>
        /// Create FileOpenPicker and set file filter.
        /// </summary>
        /// <param name="typeFilterList">The filter type list.</param>
        /// <returns>
        /// The FileOpenPicker created.
        /// </returns>
        private FileOpenPicker FileTypePicker(List <string> typeFilterList)
        {
            // Verify that we are currently not snapped, or that we can unsnap to open the picker.
            if (ApplicationView.Value == ApplicationViewState.Snapped && !ApplicationView.TryUnsnap())
            {
                return(null);
            }

            FileOpenPicker picker = new FileOpenPicker();

            picker.CommitButtonText = "Select Files";

            foreach (var type in typeFilterList)
            {
                picker.FileTypeFilter.Add(type);
            }

            return(picker);
        }
コード例 #19
0
        /// <summary>
        ///     https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh700391.aspx
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (((ApplicationView.Value != ApplicationViewState.Snapped) ||
                 ApplicationView.TryUnsnap()))
            {
                var savePicker = new FileSavePicker();
                savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;

                // Dropdown of file types the user can save the file as
                savePicker.FileTypeChoices.Add("Rich Text", new List <string> {
                    ".rtf"
                });

                // Default file name if the user does not type one in or select a file to replace
                savePicker.SuggestedFileName = "New Document";

                var file = await savePicker.PickSaveFileAsync();

                if (file != null)
                {
                    // Prevent updates to the remote version of the file until we
                    // finish making changes and call CompleteUpdatesAsync.
                    CachedFileManager.DeferUpdates(file);
                    // write to file
                    var randAccStream =
                        await file.OpenAsync(FileAccessMode.ReadWrite);

                    inputText.Document.SaveToStream(TextGetOptions.FormatRtf, randAccStream);

                    // Let Windows know that we're finished changing the file so the
                    // other app can update the remote version of the file.
                    var status = await CachedFileManager.CompleteUpdatesAsync(file);

                    if (status != FileUpdateStatus.Complete)
                    {
                        var errorBox =
                            new MessageDialog("File " + file.Name + " couldn't be saved.");
                        await errorBox.ShowAsync();
                    }
                }
            }
        }
コード例 #20
0
        /// <summary>
        /// Returns a StorageFile containing an image in a supported format.
        /// </summary>
        public static async Task <StorageFile> GetFileFromOpenPickerAsync()
        {
            // Attempt to ensure that the view is not snapped, otherwise the picker will not display.
            if (ApplicationView.Value == ApplicationViewState.Snapped && !ApplicationView.TryUnsnap())
            {
                throw new Exception("File picker cannot display in snapped view.");
            }

            FileOpenPicker picker = new FileOpenPicker();

            FillDecoderExtensions(picker.FileTypeFilter);
            picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
            StorageFile file = await picker.PickSingleFileAsync();

            if (file == null)
            {
                throw new Exception("User did not select a file.");
            }

            return(file);
        }
コード例 #21
0
ファイル: Main.xaml.cs プロジェクト: pietpukkel/Chat
        private bool CleanPaneState()
        {
            try
            {
                if (CurrentFlyout != null)
                {
                    CurrentFlyout.Hide();
                }

                AppBar.IsOpen = false;

                if (ApplicationView.Value == ApplicationViewState.Snapped)
                {
                    ApplicationView.TryUnsnap();
                    return(false);
                }

                return(true);
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }

            return(false);
        }
コード例 #22
0
        public SnappedPlayerViewPresenter(
            IMediaElementContainer mediaElementContainer,
            IGoogleMusicSessionService sessionService,
            IPlayQueueService queueService,
            INavigationService navigationService,
            SnappedPlayerBindingModel snappedPlayerBindingModel)
            : base(mediaElementContainer, sessionService, queueService, navigationService, snappedPlayerBindingModel)
        {
            this.queueService = queueService;
            this.isRadio      = this.queueService.IsRadio;

            this.RepeatAllCommand =
                new DelegateCommand(
                    () => { },
                    () => this.queueService.State != QueueState.Busy && !this.isRadio);

            this.ShuffleCommand =
                new DelegateCommand(
                    () => { },
                    () => this.queueService.State != QueueState.Busy && !this.isRadio);

            this.AddToQueueCommand = new DelegateCommand(
                () =>
            {
                if (ApplicationView.TryUnsnap())
                {
                    navigationService.NavigateTo <IStartPageView>();
                }
            });

            this.queueService.StateChanged += async(sender, args) => await this.Dispatcher.RunAsync(async() =>
            {
                this.UpdateCommands();

                await this.View.ScrollIntoCurrentSongAsync();
            });
        }
コード例 #23
0
ファイル: InvoiceListView.xaml.cs プロジェクト: radtek/vas
        private async void InvoiceList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            InvoiceListViewModel invoiceListVM = (InvoiceListViewModel)DataContext;

            if (invoiceListVM.MultiSelect)
            {
                invoiceListVM.InvoiceCount = InvoiceList.SelectedItems.Count.ToString();
                return;
            }
            if (ApplicationView.Value == ApplicationViewState.Snapped)
            {
                ApplicationView.TryUnsnap();
            }
            try
            {
                if (invoiceListVM.SelectedInvoice > -1)
                {
                    if (canCallServer)
                    {
                        bool selectionSuccess = await invoiceListVM.SetSummary(invoiceListVM.InvoiceDetails[invoiceListVM.SelectedInvoice].InvoiceId);

                        if (selectionSuccess)
                        {
                            previousSelectedInvoice = invoiceListVM.SelectedInvoice;
                        }
                        else
                        {
                            invoiceListVM.SelectedInvoice = previousSelectedInvoice;
                        }
                        if (invoiceListVM.SelectedInvoice == -1)
                        {
                            if (invoiceListVM.InvoiceDetails.Count > 0)
                            {
                                UserPreference.Instance.SelectedInvoiceId = 0;
                                InvoiceList.ScrollIntoView(InvoiceList.Items[0], ScrollIntoViewAlignment.Default);
                            }
                        }
                        else
                        {
                            UserPreference.Instance.SelectedInvoiceId = invoiceListVM.InvoiceDetails[invoiceListVM.SelectedInvoice].InvoiceId;
                            InvoiceList.ScrollIntoView(InvoiceList.Items[invoiceListVM.SelectedInvoice], ScrollIntoViewAlignment.Default);
                        }
                    }
                    else
                    {
                        canCallServer = true;
                    }
                    invoiceListVM.HasSelectedInvoice = Visibility.Visible;
                }
                if (invoiceListVM.SelectedInvoice == -1)
                {
                    invoiceListVM.HasSelectedInvoice = Visibility.Collapsed;
                }
            }
            catch (T360Exception ex)
            {
                if (T360ErrorCodes.NotInReviewerQueue.Equals(ex.ErrorCodes[0].Code))
                {
                    invoiceListVM.ReloadList(-1);
                }
                else
                {
                    string msg = invoiceListVM.getErrorMessages(ex);
                    invoiceListVM.showErrorMessages(msg);
                }
            }
        }
コード例 #24
0
        //<Snippetall_checksnapped>
        //<Snippetcs_checksnapped>
        internal bool EnsureUnsnapped()
        {
            // FilePicker APIs will not work if the application is in a snapped state.
            // If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
            bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());

            if (!unsnapped)
            {
                NotifyUser("Cannot unsnap the sample.", NotifyType.StatusMessage);
            }

            return(unsnapped);
        }
コード例 #25
0
 internal bool EnsureUnsnapped()
 {
     // FilePicker APIs will not work if the application is in a snapped state. If an app wants to show a FilePicker while snapped,
     // it must attempt to unsnap first.
     return((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());
 }
コード例 #26
0
        private bool EnsureUnsnapped()
        {
            // using Windows.UI.ViewManagement;
            bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());

            return(unsnapped);
        }
コード例 #27
0
        private async void Button_Import_Click(object sender, RoutedEventArgs e)
        {
            StringBuilder  contents      = new StringBuilder();
            StorageFile    selectedFile2 = null;
            FileOpenPicker openPicker    = new FileOpenPicker();

            openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            openPicker.FileTypeFilter.Add(".pfx");
            openPicker.FileTypeFilter.Add(".p12");

            if (ApplicationView.Value == ApplicationViewState.Snapped)
            {
                if (ApplicationView.TryUnsnap())
                {
                    selectedFile2 = await openPicker.PickSingleFileAsync();
                }
            }
            else
            {
                selectedFile2 = await openPicker.PickSingleFileAsync();
            }

            if (selectedFile2 != null)
            {
                CredentialPanel cp           = new CredentialPanel();
                bool            foco         = cp.Focus(Windows.UI.Xaml.FocusState.Programmatic);
                CustomDialog    customDialog = new CustomDialog(cp, labels.GetString("Etiqueta_peticion_pass"));
                customDialog.Commands.Add(new UICommand(labels.GetString("Boton_aceptar")));
                customDialog.Commands.Add(new UICommand(labels.GetString("Boton_cancelar")));
                customDialog.DefaultCommandIndex = 0;
                customDialog.CancelCommandIndex  = 1;
                IUICommand com = await customDialog.ShowAsync();

                if (com.Label.Equals(labels.GetString("Boton_aceptar")))
                {
                    if (cp.getPassword() != null)
                    {
                        using (StreamReader reader = new StreamReader(await selectedFile2.OpenStreamForReadAsync()))
                        {
                            char[] password = cp.getPassword().ToCharArray();
                            try
                            {
                                store = new Pkcs12Store(reader.BaseStream, password);
                                if (store != null)
                                {
                                    await selectedFile2.CopyAsync(localFolder, selectedFile2.Name, NameCollisionOption.ReplaceExisting);

                                    storeData = new StoreData();
                                    storeData.LoadData();
                                    _source = storeData.GetGroupsByCategory();
                                    ItemGridView2.ItemsSource = storeData.Collection;
                                    EvaluateDeleteButton(storeData);
                                    // Le quitamos la extensión al nombre del almacén por coherencia con el borrado, que al pillarlo de la lista no tiene extensión.
                                    AfirmaMetroUtils.showMessage(labels.GetString("Info_almacen_importado") + selectedFile2.Name.Replace(selectedFile2.FileType, "") + "\".", "Importación de almacén correcta");

                                    // Lanzamos:
                                    var options = new Windows.System.LauncherOptions();
                                    options.DisplayApplicationPicker = true;
                                    var file2 = await localFolder.GetFileAsync(selectedFile2.Name);

                                    bool success = await Windows.System.Launcher.LaunchFileAsync(file2, options);
                                }
                            }
                            catch
                            {
                                AfirmaMetroUtils.showMessage(labels.GetString("Error_carga_almacen"), "Error en la importación de almacén");
                            }
                        }
                    }
                }
            }
        }
コード例 #28
0
        /// <summary>
        ///     Shows the 'Save File' dialog and returns the resulting file. Returns null if the
        ///     operation was cancelled.
        /// </summary>
        /// <returns>
        ///     A task that contains the result of selecting the file and that enables this method
        ///     to be awaited.
        /// </returns>
        private static async Task <StorageFile> ShowSaveFileDialogAsync()
        {
            // Ensure that the application is not snapped, to avoid errors.
            // See: https://docs.microsoft.com/en-us/windows/uwp/files/quickstart-save-a-file-with-a-picker
            bool unsnapped = (ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap();

            FileSavePicker savePicker = new FileSavePicker();

            savePicker.FileTypeChoices.Add("Image", new List <string>()
            {
                ".png"
            });
            savePicker.SuggestedFileName      = DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss") + "-Collage";
            savePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;

            StorageFile file = await savePicker.PickSaveFileAsync();

            return(file);
        }
コード例 #29
0
        /// <summary> Shows the file selector to pick one or more images. </summary>
        /// <returns> The collection of selected files, if any. </returns>
        private static async Task <IReadOnlyList <StorageFile> > ShowImageFileSelectorAsync()
        {
            // Ensure that the application is not snapped, to avoid errors.
            // See: https://docs.microsoft.com/en-us/windows/uwp/files/quickstart-save-a-file-with-a-picker
            bool unsnapped = (ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap();

            FileOpenPicker fileOpenPicker = new FileOpenPicker();

            // Image extension filters.
            fileOpenPicker.FileTypeFilter.Add(".png");
            fileOpenPicker.FileTypeFilter.Add(".jpg");
            fileOpenPicker.FileTypeFilter.Add(".jpeg");

            fileOpenPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;

            IReadOnlyList <StorageFile> selectedImages = await fileOpenPicker.PickMultipleFilesAsync();

            return(selectedImages);
        }
コード例 #30
0
        public bool EnsureUnsnapped()
        {
            bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());

            if (!unsnapped)
            {
            }
            return(unsnapped);
        }