Beispiel #1
0
        private void ShowNotificationMessage(string message, int duration)
        {
            var textSize = FontUtility.GetTextSize(StatusNotification.FontFamily, StatusNotification.FontSize, message);

            StatusNotification.Width  = textSize.Width + 100; // actual width + padding
            StatusNotification.Height = textSize.Height + 50; // actual height + padding
            StatusNotification.Show(message, duration);
        }
Beispiel #2
0
        private void ShowNotificationMessage(string message, int duration)
        {
            if (StatusNotification == null)
            {
                this.FindName("StatusNotification"); // Lazy loading
            }
            var textSize = FontUtility.GetTextSize(StatusNotification.FontFamily, StatusNotification.FontSize, message);

            StatusNotification.Width  = textSize.Width + 100; // actual width + padding
            StatusNotification.Height = textSize.Height + 50; // actual height + padding
            StatusNotification.Show(message, duration);
        }
Beispiel #3
0
 private void UtilityIndicator_OnTapped(object sender, TappedRoutedEventArgs e)
 {
     if (sender == PathIndicator && !string.IsNullOrEmpty(PathIndicator.Text))
     {
         FocusOnSelectedTextEditor();
         var pathData = new DataPackage();
         pathData.SetText(PathIndicator.Text);
         Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(pathData);
         StatusNotification.Show("Copied", 1500);
     }
     else if (sender is TextBlock textBlock)
     {
         textBlock.ContextFlyout?.ShowAt(textBlock);
     }
 }
Beispiel #4
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (!(sender is TextEditor textEditor))
            {
                textEditor = (Sets.SelectedItem as SetsViewItem)?.Content as TextEditor;
                if (textEditor == null)
                {
                    return;
                }
            }

            StorageFile file;

            if (textEditor.EditingFile == null || e is SaveAsEventArgs ||
                FileSystemUtility.IsFileReadOnly(textEditor.EditingFile) ||
                !await FileSystemUtility.FileIsWritable(textEditor.EditingFile))
            {
                file = await FilePickerFactory.GetFileSavePicker(e, textEditor, DefaultFileName).PickSaveFileAsync();

                textEditor.Focus(FocusState.Programmatic);
            }
            else
            {
                file = textEditor.EditingFile;
            }

            if (file == null)
            {
                return;
            }

            var success = await textEditor.SaveFile(file);

            if (success)
            {
                if (Sets.Items != null)
                {
                    foreach (SetsViewItem setsItem in Sets.Items)
                    {
                        if (setsItem.Content != textEditor)
                        {
                            continue;
                        }

                        setsItem.Header          = file.Name;
                        setsItem.Icon.Visibility = Visibility.Collapsed;

                        PathIndicator.Text       = textEditor.EditingFile.Path;
                        LineEndingIndicator.Text =
                            LineEndingUtility.GetLineEndingDisplayText(textEditor.LineEnding);
                        EncodingIndicator.Text = textEditor.Encoding.EncodingName;
                        break;
                    }
                }
                StatusNotification.Show("Saved", 2000);
            }
            else
            {
                await ContentDialogFactory.GetFileSaveErrorDialog(file).ShowAsync();
            }
        }