private void Accept_Click(object sender, RoutedEventArgs e)
        {
            if (Items == null)
            {
                Hide(ContentDialogResult.Secondary);
                return;
            }

            if (IsEditingCompression && SelectedItem is StorageVideo video)
            {
                video.Compression = (int)CompressionValue.Value;

                IsEditingCompression = false;
                return;
            }

            if (IsEditingCropping && SelectedItem is StorageMedia media)
            {
                media.CropRectangle = Cropper.CropRectangle;
                media.Refresh();

                Select_Click(null, null);

                IsEditingCropping = false;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SelectedItem"));
                return;
            }

            if (SelectedItem != null && SelectedItems.IsEmpty())
            {
                SelectedItems.Add(SelectedItem);
            }

            if (IsGroupingEnabled)
            {
                ViewModel.Settings.IsSendGrouped = IsGrouped;
            }

            SelectedItem.Caption = CaptionInput.GetFormattedText()
                                   .Substring(0, ViewModel.CacheService.Options.MessageCaptionLengthMax);

            Hide(ContentDialogResult.Primary);
        }
예제 #2
0
        private void Accept_Click(object sender, RoutedEventArgs e)
        {
            if (Items == null)
            {
                Hide(ContentDialogBaseResult.Cancel);
                return;
            }

            if (IsEditingCompression && SelectedItem is StorageVideo video)
            {
                video.Compression = (int)CompressionValue.Value;

                IsEditingCompression = false;
                return;
            }

            if (IsEditingCropping && SelectedItem is StorageMedia media)
            {
                media.CropRectangle = Cropper.CropRectangle;
                media.Refresh();

                IsEditingCropping = false;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SelectedItem"));
                return;
            }

            if (SelectedItem != null && SelectedItems.IsEmpty())
            {
                SelectedItems.Add(SelectedItem);
            }

            if (IsGroupingEnabled)
            {
                ApplicationSettings.Current.IsSendGrouped = IsGrouped;
            }

            Hide(ContentDialogBaseResult.OK);
        }