public void IconProviderDispose(Image image) { ScalableGreyableImageProvider iconProviderToDispose = null; foreach (var iconProvider in m_IconProviders) { if (iconProvider.HasIconSmall && iconProvider.IconSmall == image) { iconProviderToDispose = iconProvider; break; } if (iconProvider.HasIconMedium && iconProvider.IconMedium == image) { iconProviderToDispose = iconProvider; break; } if (iconProvider.HasIconLarge && iconProvider.IconLarge == image) { iconProviderToDispose = iconProvider; break; } if (iconProvider.HasIconXLarge && iconProvider.IconXLarge == image) { iconProviderToDispose = iconProvider; break; } } if (iconProviderToDispose != null) { m_IconProviders.Remove(iconProviderToDispose); } }
public RichDelegateCommand(String shortDescription, String longDescription, KeyGesture keyGesture, VisualBrush icon, Action executeMethod, Func <bool> canExecuteMethod, ApplicationSettingsBase settingContainer, string settingName) : base(executeMethod, canExecuteMethod, false) { KeyGestureSettingContainer = settingContainer; KeyGestureSettingName = settingName; KeyGesture = keyGesture ?? RefreshKeyGestureSetting(); ShortDescription = (String.IsNullOrEmpty(shortDescription) ? "" : shortDescription); LongDescription = (String.IsNullOrEmpty(longDescription) ? "" : longDescription); m_VisualBrush = icon; if (HasIcon) { // TODO: fetching the magnification level from the app resources breaks encapsulation ! var scale = (Double)Application.Current.Resources["MagnificationLevel"]; IconProvider = new ScalableGreyableImageProvider(m_VisualBrush, scale); //m_IconProviders.Add(IconProvider); } }
private bool askUser(string message, string info) { m_Logger.Log("ShellView.askUser", Category.Debug, Priority.Medium); var label = new TextBlock { Text = message, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider( m_ShellView.LoadTangoIcon("help-browser"), m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var details = new TextBoxReadOnlyCaretVisible { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], BorderThickness = new Thickness(1), Padding = new Thickness(6), TextReadOnly = info }; var windowPopup = new PopupModalWindow(m_ShellView, message, panel, PopupModalWindow.DialogButtonsSet.YesNo, PopupModalWindow.DialogButton.No, true, 360, 200, details, 40, null); windowPopup.ShowModal(); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { return(true); } return(false); }
public ExplorerWindowViewModel(Action activateFileAction, ScalableGreyableImageProvider iconComputer, ScalableGreyableImageProvider iconDrive, ScalableGreyableImageProvider iconFolder, ScalableGreyableImageProvider iconFile) { IconComputer = iconComputer; IconDrive = iconDrive; IconFolder = iconFolder; IconFile = iconFile; FileTreeVM = new FileExplorerViewModel(this); DirViewVM = new DirectoryViewerViewModel(this, activateFileAction); }
public bool askUserConfirmOverwriteFileFolder(string path, bool folder, Window owner) { m_Logger.Log(@"UrakawaSession_Save.askUserConfirmOverwriteFileFolder", Category.Debug, Priority.Medium); var label = new TextBlock { Text = (folder ? Tobi_Plugin_Urakawa_Lang.OverwriteConfirm_Folder : Tobi_Plugin_Urakawa_Lang.OverwriteConfirm_File), Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider(m_ShellView.LoadTangoIcon(@"dialog-warning"), m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var details = new TextBoxReadOnlyCaretVisible { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], BorderThickness = new Thickness(1), Padding = new Thickness(6), TextReadOnly = String.Format(Tobi_Plugin_Urakawa_Lang.UrakawaSession_SavePath, path) }; var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_Urakawa_Lang.Overwrite), panel, PopupModalWindow.DialogButtonsSet.YesNo, PopupModalWindow.DialogButton.No, false, 300, 160, details, 40, owner); windowPopup.ShowModal(); if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Yes) { return(true); } return(false); }
public RichDelegateCommand(String shortDescription, String longDescription, KeyGesture keyGesture, VisualBrush icon, Action <T> executeMethod, Predicate <T> canExecuteMethod) : base(executeMethod, canExecuteMethod, false) { ShortDescription = (String.IsNullOrEmpty(shortDescription) ? "" : shortDescription); LongDescription = (String.IsNullOrEmpty(longDescription) ? "" : longDescription); KeyGesture = keyGesture; IconProvider = new ScalableGreyableImageProvider(icon); }
public string SaveAs() { var shellPresenter = Container.Resolve <IShellPresenter>(); var window = shellPresenter.View as Window; var panel = new FileBrowserPanel(); var windowPopup = new PopupModalWindow(shellPresenter, UserInterfaceStrings.EscapeMnemonic( UserInterfaceStrings.SaveAs), panel, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 500, 300); var iconComputer = new ScalableGreyableImageProvider(shellPresenter.LoadTangoIcon("computer")) { IconDrawScale = shellPresenter.View.MagnificationLevel }; var iconDrive = new ScalableGreyableImageProvider(shellPresenter.LoadTangoIcon("drive-harddisk")) { IconDrawScale = shellPresenter.View.MagnificationLevel }; var iconFolder = new ScalableGreyableImageProvider(shellPresenter.LoadTangoIcon("folder")) { IconDrawScale = shellPresenter.View.MagnificationLevel }; var iconFile = new ScalableGreyableImageProvider(shellPresenter.LoadTangoIcon("text-x-generic-template")) { IconDrawScale = shellPresenter.View.MagnificationLevel }; var viewModel = new ExplorerWindowViewModel(() => windowPopup.ForceClose(PopupModalWindow.DialogButton.Ok), iconComputer, iconDrive, iconFolder, iconFile); panel.DataContext = viewModel; windowPopup.ShowModal(); if (windowPopup.ClickedDialogButton != PopupModalWindow.DialogButton.Ok) { return(null); } if (viewModel.DirViewVM.CurrentItem != null && (ObjectType)viewModel.DirViewVM.CurrentItem.DirType == ObjectType.File) { return(viewModel.DirViewVM.CurrentItem.Path); } return(null); }
private bool askUserAlt(string title, string message) { m_Logger.Log("ShellView.askUser", Category.Debug, Priority.Medium); var label = new TextBlock { Text = message, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider( m_ShellView.LoadTangoIcon("dialog-warning"), //help-browser m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var windowPopup = new PopupModalWindow(m_ShellView, title, panel, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Cancel, true, 400, 200, null, 40, null); windowPopup.ShowModal(); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { return(true); } return(false); }
public bool AskUserRenameXmlID() { var label = new TextBlock { Text = "Automatically rename linked identifiers?\n(recommended)", Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider(m_ShellView.LoadTangoIcon("help-browser"), m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var popup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic("Refactor identifiers?"), panel, PopupModalWindow.DialogButtonsSet.YesNo, PopupModalWindow.DialogButton.Yes, true, 300, 160, null, 0, m_DescriptionPopupModalWindow); popup.ShowModal(); popup.IgnoreEscape = true; return(popup.ClickedDialogButton == PopupModalWindow.DialogButton.Yes); }
public void messageBoxAlert(string message, Window owner) { m_Logger.Log(@"UrakawaSession_Save.messageBoxAlert", Category.Debug, Priority.Medium); var label = new TextBlock { Text = message, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider(m_ShellView.LoadTangoIcon(@"dialog-warning"), m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var windowPopup = new PopupModalWindow(m_ShellView, "Warning", panel, PopupModalWindow.DialogButtonsSet.Ok, PopupModalWindow.DialogButton.Ok, true, 600, 160, null, 40, owner); windowPopup.ShowModal(); }
private void OnClick_ButtonAddMetadata(object sender, RoutedEventArgs e) { Tuple <TreeNode, TreeNode> selection = m_Session.GetTreeNodeSelection(); TreeNode node = selection.Item2 ?? selection.Item1; if (node == null) { return; } var altProp = node.GetOrCreateAlternateContentProperty(); //if (altProp == null) return; //if (DescriptionsListView.SelectedIndex < 0) return; //AlternateContent altContent = (AlternateContent)DescriptionsListView.SelectedItem; //if (altProp.AlternateContents.IndexOf(altContent) < 0) return; var mdAttr = new MetadataAttribute(); mdAttr.Name = ""; // PROMPT_MD_NAME; mdAttr.Value = ""; // PROMPT_MD_VALUE; string newName = null; string newValue = null; bool invalidSyntax = false; bool ok = true; while (ok && ( invalidSyntax || string.IsNullOrEmpty(newName) || string.IsNullOrEmpty(newValue) //|| newName == PROMPT_MD_NAME //|| newValue == PROMPT_MD_VALUE ) ) { ok = showMetadataAttributeEditorPopupDialog("Property", "Content", mdAttr, out newName, out newValue, false, false, invalidSyntax); mdAttr.Name = newName; mdAttr.Value = newValue; if (!string.IsNullOrEmpty(newName) && !string.IsNullOrEmpty(newValue)) { invalidSyntax = m_ViewModel.IsIDInValid(newName) || ( (newName.Equals(XmlReaderWriterHelper.XmlId) || newName.Equals(DiagramContentModelHelper.DiagramElementName)) && m_ViewModel.IsIDInValid(newValue) ); } } if (!ok) { return; } //bool ok = showMetadataAttributeEditorPopupDialog(mdAttr, out newName, out newValue, false); //if (ok && // newName != mdAttr.Name && newValue != mdAttr.Value) //{ foreach (Metadata m in altProp.Metadatas.ContentsAs_Enumerable) { if (m.NameContentAttribute.Name == newName && ( newName.StartsWith(XmlReaderWriterHelper.NS_PREFIX_XML + ":") //newName.Equals(XmlReaderWriterHelper.XmlId) //|| newName.Equals(XmlReaderWriterHelper.XmlLang) ) ) { var label = new TextBlock { Text = Tobi.Plugin.Descriptions.Tobi_Plugin_Descriptions_Lang.AttributeAlreadyExists, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider(m_ShellView.LoadTangoIcon("dialog-warning"), m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi.Plugin.Descriptions.Tobi_Plugin_Descriptions_Lang.DuplicateAttribute), panel, PopupModalWindow.DialogButtonsSet.Ok, PopupModalWindow.DialogButton.Ok, true, 300, 160, null, 0, m_DescriptionPopupModalWindow); //view.OwnerWindow = windowPopup; windowPopup.ShowModal(); return; } } m_ViewModel.AddMetadata(altProp, null, newName, newValue); MetadatasListView.Items.Refresh(); MetadatasListView.SelectedIndex = MetadatasListView.Items.Count - 1; //FocusHelper.FocusBeginInvoke(MetadatasListView); }
private void initializeCommands_Player() { CommandPlaybackRateReset = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateReset_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateReset_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadGnomeGionIcon("Gion_go-previous"), () => { Logger.Log("AudioPaneViewModel.CommandPlaybackRateReset", Category.Debug, Priority.Medium); PlaybackRate = PLAYBACK_RATE_MIN; }, () => true //&& !IsWaveFormLoading , Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ResetPlaybackRate)); m_ShellView.RegisterRichCommand(CommandPlaybackRateReset); // CommandPlaybackRateDown = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateDown_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateDown_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadGnomeGionIcon("Gion_go-down"), () => { Logger.Log("AudioPaneViewModel.CommandPlaybackRateDown", Category.Debug, Priority.Medium); if ((PlaybackRate - PLAYBACK_RATE_STEP) >= PLAYBACK_RATE_MIN) { PlaybackRate -= PLAYBACK_RATE_STEP; } else { PlaybackRate = PLAYBACK_RATE_MIN; Debug.Fail("This should never happen !"); } }, () => (PlaybackRate - PLAYBACK_RATE_STEP) >= PLAYBACK_RATE_MIN //&& !IsWaveFormLoading , Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlaybackRateDown)); m_ShellView.RegisterRichCommand(CommandPlaybackRateDown); // CommandPlaybackRateUp = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateUp_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateUp_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadGnomeGionIcon("Gion_go-up"), () => { Logger.Log("AudioPaneViewModel.CommandPlaybackRateUp", Category.Debug, Priority.Medium); if ((PlaybackRate + PLAYBACK_RATE_STEP) <= PLAYBACK_RATE_MAX) { PlaybackRate += PLAYBACK_RATE_STEP; } else { PlaybackRate = PLAYBACK_RATE_MAX; Debug.Fail("This should never happen !"); } }, () => (PlaybackRate + PLAYBACK_RATE_STEP) <= PLAYBACK_RATE_MAX //&& !IsWaveFormLoading , Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlaybackRateUp)); m_ShellView.RegisterRichCommand(CommandPlaybackRateUp); // CommandAutoPlay = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioAutoPlay_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioAutoPlay_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("applications-multimedia"), () => { Logger.Log("AudioPaneViewModel.CommandAutoPlay", Category.Debug, Priority.Medium); //if (IsAutoPlay) //{ // AudioCues.PlayTock(); //} //else //{ // AudioCues.PlayTockTock(); //} IsAutoPlay = !IsAutoPlay; }, () => true //&& !IsWaveFormLoading , Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ToggleAutoPlayMode)); m_ShellView.RegisterRichCommand(CommandAutoPlay); // // CommandPause = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioPause_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioPause_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("media-playback-pause"), () => { Logger.Log("AudioPaneViewModel.CommandPause", Category.Debug, Priority.Medium); m_PlayAutoAdvance = false; SetRecordAfterPlayOverwriteSelection(-1); long playBytePosition = PlayBytePosition; m_Player.Stop(); SetPlayHeadTimeBypassAutoPlay(playBytePosition); if (EventAggregator != null) { EventAggregator.GetEvent <StatusBarMessageUpdateEvent>().Publish(Tobi_Plugin_AudioPane_Lang.PlaybackStopped); } if (IsMonitoringAlways) { CommandStartMonitor.Execute(); } }, () => State.Audio.HasContent && IsPlaying //&& !IsWaveFormLoading , Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayPause)); m_ShellView.RegisterRichCommand(CommandPause); // CommandPlay = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioPlay_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioPlay_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("media-playback-start"), () => { Logger.Log("AudioPaneViewModel.CommandPlay", Category.Debug, Priority.Medium); CommandPause.Execute(); if (IsMonitoring) { CommandStopMonitor.Execute(); } //#if DEBUG // Logger.Log("AudioPaneViewModel.CommandPlay (called PAUSE)", Category.Debug, Priority.Medium); //#endif if (PlayBytePosition < 0) { m_LastSetPlayBytePosition = 0; } if (!IsSelectionSet) { //if (LastPlayHeadTime >= State.Audio.ConvertBytesToMilliseconds(State.Audio.DataLength)) if (PlayBytePosition >= State.Audio.DataLength) { if (Settings.Default.Audio_DisableAutoJumpToBegin_AtEndOfPlayback) { //m_LastSetPlayBytePosition = State.Audio.DataLength; //PlayBytePosition = State.Audio.DataLength; AudioCues.PlayBeep(); } else { //LastPlayHeadTime = 0; infinite loop ! AudioPlayer_PlayFromTo(0, -1); } } else { AudioPlayer_PlayFromTo(PlayBytePosition, -1); } } else { if (false && PlayBytePosition >= State.Selection.SelectionBeginBytePosition && PlayBytePosition < State.Selection.SelectionEndBytePosition) { //if (verifyBeginEndPlayerValues(byteLastPlayHeadTime, byteSelectionRight)) //{ //} AudioPlayer_PlayFromTo(PlayBytePosition, State.Selection.SelectionEndBytePosition); } else { //if (verifyBeginEndPlayerValues(byteSelectionLeft, byteSelectionRight)) //{ //} AudioPlayer_PlayFromTo(State.Selection.SelectionBeginBytePosition, State.Selection.SelectionEndBytePosition); } } }, () => State.Audio.HasContent && !IsPlaying && (!IsMonitoring || IsMonitoringAlways) && !IsRecording //&& !IsWaveFormLoading , Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayPause)); m_ShellView.RegisterRichCommand(CommandPlay); // CommandPlayAutoAdvance = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioPlayAutoAdvance_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioPlayAutoAdvance_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadGnomeGionIcon("applications-multimedia"), //emblem-system () => { Logger.Log("AudioPaneViewModel.CommandPlayAutoAdvance", Category.Debug, Priority.Medium); m_PlayAutoAdvance = true; CommandPlay.Execute(); }, () => CommandPlay.CanExecute(), Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayAutoAdvance)); m_ShellView.RegisterRichCommand(CommandPlayAutoAdvance); // CommandPlayPreviewLeft = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioPlayPreviewLeft_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioPlayPreviewLeft_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Left")), () => PlayPreviewLeftRight(true), () => CommandPlay.CanExecute(), Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayLeftPreview)); m_ShellView.RegisterRichCommand(CommandPlayPreviewLeft); // CommandPlayPreviewRight = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioPlayPreviewRight_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioPlayPreviewRight_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Right")), () => PlayPreviewLeftRight(false), () => CommandPlay.CanExecute(), Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayRightPreview)); m_ShellView.RegisterRichCommand(CommandPlayPreviewRight); // }
private void initializeCommands_Selection() { CommandSelectPreviousChunk = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioSelectPreviousChunk_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioSelectPreviousChunk_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("go-previous"), () => { Logger.Log("AudioPaneViewModel.CommandSelectPreviousChunk", Category.Debug, Priority.Medium); CommandStepBack.Execute(); SelectChunk(PlayBytePosition); }, () => CommandStepBack.CanExecute(), Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectPreviousChunk)); m_ShellView.RegisterRichCommand(CommandSelectPreviousChunk); // CommandSelectNextChunk = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioSelectNextChunk_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioSelectNextChunk_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("go-next"), () => { Logger.Log("AudioPaneViewModel.CommandSelectNextChunk", Category.Debug, Priority.Medium); CommandStepForward.Execute(); SelectChunk(PlayBytePosition); }, () => CommandStepForward.CanExecute(), Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectNextChunk)); m_ShellView.RegisterRichCommand(CommandSelectNextChunk); // // CommandEndSelection = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioEndSelection_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioEndSelection_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Right1")), () => { Logger.Log("AudioPaneViewModel.CommandEndSelection", Category.Debug, Priority.Medium); if (m_SelectionBeginTmpBytePosition < 0) { return; } CommandPause.Execute(); long begin = m_SelectionBeginTmpBytePosition; long end = PlayBytePosition; AudioCues.PlayTockTock(); if (begin == end) { CommandClearSelection.Execute(); return; } if (begin > end) { long tmp = begin; begin = end; end = tmp; } State.Selection.SetSelectionBytes(begin, end); if (IsAutoPlay) { CommandPlay.Execute(); } //if (IsAutoPlay) //{ // //if (!State.Audio.HasContent) // //{ // // return; // //} // //IsAutoPlay = false; // //LastPlayHeadTime = begin; // //IsAutoPlay = true; // //long bytesFrom = State.Audio.ConvertMillisecondsToBytes(begin); // //long bytesTo = State.Audio.ConvertMillisecondsToBytes(end); // //AudioPlayer_PlayFromTo(bytesFrom, bytesTo); //} }, () => CommandSelectAll.CanExecute() //CanManipulateWaveForm // //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring // && State.Audio.HasContent && m_SelectionBeginTmpBytePosition >= 0, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_EndSelection)); m_ShellView.RegisterRichCommand(CommandEndSelection); // CommandBeginSelection = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioBeginSelection_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioBeginSelection_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Left1")), () => { Logger.Log("AudioPaneViewModel.CommandBeginSelection", Category.Debug, Priority.Medium); //CommandPause.Execute(); CommandClearSelection.Execute(); m_SelectionBeginTmpBytePosition = PlayBytePosition; AudioCues.PlayTock(); }, () => CommandSelectLeft.CanExecute(), //CommandSelectAll.CanExecute() // //CanManipulateWaveForm // ////&& !IsWaveFormLoading && !IsRecording && !IsMonitorin // //&& State.Audio.HasContent, // && PlayBytePosition >= 0, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_BeginSelection)); m_ShellView.RegisterRichCommand(CommandBeginSelection); // CommandSelectLeft = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioSelectLeft_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioSelectLeft_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("format-indent-less"), () => { Logger.Log("AudioPaneViewModel.CommandSelectLeft", Category.Debug, Priority.Medium); if (PlayBytePosition <= 0) { AudioCues.PlayBeep(); return; } State.Selection.SetSelectionBytes(0, PlayBytePosition); PlayBytePosition = State.Selection.SelectionEndBytePosition; //AudioCues.PlayTock(); }, () => CommandSelectAll.CanExecute() //CanManipulateWaveForm // //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring // && State.Audio.HasContent && PlayBytePosition >= 0, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectLeft)); m_ShellView.RegisterRichCommand(CommandSelectLeft); // CommandSelectRight = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioSelectRight_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioSelectRight_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("format-indent-more"), () => { Logger.Log("AudioPaneViewModel.CommandSelectRight", Category.Debug, Priority.Medium); if (PlayBytePosition >= State.Audio.DataLength) { AudioCues.PlayBeep(); return; } State.Selection.SetSelectionBytes(PlayBytePosition, State.Audio.DataLength); //AudioCues.PlayTock(); }, () => CommandSelectLeft.CanExecute(), //CanManipulateWaveForm // //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring // && State.Audio.HasContent && PlayBytePosition >= 0, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectRight)); m_ShellView.RegisterRichCommand(CommandSelectRight); // CommandSelectAll = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdSelectAll_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdSelectAll_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("view-fullscreen"), () => { Logger.Log("AudioPaneViewModel.CommandSelectAll", Category.Debug, Priority.Medium); //if (!State.Audio.HasContent) //{ // if (View != null) // { // View.SelectAll(); // } // return; //} State.Selection.SetSelectionBytes(0, State.Audio.DataLength); //AudioCues.PlayTockTock(); }, () => CanManipulateWaveForm //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring && State.Audio.HasContent, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectAll)); m_ShellView.RegisterRichCommand(CommandSelectAll); // CommandClearSelection = new RichDelegateCommand(Tobi_Plugin_AudioPane_Lang.CmdAudioClearSelection_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioClearSelection_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("edit-clear"), () => { //Logger.Log("AudioPaneViewModel.CommandClearSelection", Category.Debug, Priority.Medium); State.Selection.ClearSelection(); }, () => CommandSelectAll.CanExecute() //CanManipulateWaveForm // //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring // && State.Audio.HasContent && IsSelectionSet, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ClearSelection)); m_ShellView.RegisterRichCommand(CommandClearSelection); // }
private void OnMouseDoubleClick_ListItemMetadataAltContent(object sender, MouseButtonEventArgs e) { Tuple <TreeNode, TreeNode> selection = m_Session.GetTreeNodeSelection(); TreeNode node = selection.Item2 ?? selection.Item1; if (node == null) { return; } var altProp = node.GetAlternateContentProperty(); if (altProp == null) { return; } if (DescriptionsListView.SelectedIndex < 0) { return; } AlternateContent altContent = (AlternateContent)DescriptionsListView.SelectedItem; if (altProp.AlternateContents.IndexOf(altContent) < 0) { return; } if (MetadatasAltContentListView.SelectedIndex < 0) { return; } Metadata md = (Metadata)MetadatasAltContentListView.SelectedItem; string newName = null; string newValue = null; var mdAttrTEMP = new MetadataAttribute(); mdAttrTEMP.Name = md.NameContentAttribute.Name; mdAttrTEMP.Value = md.NameContentAttribute.Value; bool invalidSyntax = false; bool ok = true; while (ok && ( invalidSyntax || string.IsNullOrEmpty(newName) || string.IsNullOrEmpty(newValue) ) ) { ok = showMetadataAttributeEditorPopupDialog(Tobi.Plugin.Descriptions.Tobi_Plugin_Descriptions_Lang.Name, Tobi.Plugin.Descriptions.Tobi_Plugin_Descriptions_Lang.Value, mdAttrTEMP, out newName, out newValue, true, false, invalidSyntax); if (!ok) { return; } else if (newName == md.NameContentAttribute.Name && newValue == md.NameContentAttribute.Value) { return; } mdAttrTEMP.Name = newName; mdAttrTEMP.Value = newValue; if (!string.IsNullOrEmpty(newName) && !string.IsNullOrEmpty(newValue)) { invalidSyntax = m_ViewModel.IsIDInValid(newName) || ( (newName.Equals(XmlReaderWriterHelper.XmlId) || newName.Equals(DiagramContentModelHelper.DiagramElementName)) && m_ViewModel.IsIDInValid(newValue) ); } } //bool ok = showMetadataAttributeEditorPopupDialog(md.NameContentAttribute, out newName, out newValue, true); //if (ok && // (newName != md.NameContentAttribute.Name || newValue != md.NameContentAttribute.Value)) //{ foreach (Metadata m in altContent.Metadatas.ContentsAs_Enumerable) { if (md == m) { continue; } if (m.NameContentAttribute.Name == newName) { var label = new TextBlock { Text = Tobi.Plugin.Descriptions.Tobi_Plugin_Descriptions_Lang.AttributeAlreadyExists, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider(m_ShellView.LoadTangoIcon("dialog-warning"), m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi.Plugin.Descriptions.Tobi_Plugin_Descriptions_Lang.DuplicateAttribute), panel, PopupModalWindow.DialogButtonsSet.Ok, PopupModalWindow.DialogButton.Ok, true, 300, 160, null, 0, m_DescriptionPopupModalWindow); //view.OwnerWindow = windowPopup; windowPopup.ShowModal(); return; } } m_ViewModel.SetMetadataAttr(null, altContent, md, null, newName, newValue); MetadatasAltContentListView.Items.Refresh(); DescriptionsListView.Items.Refresh(); }
private void initializeCommands_View() { CommandStopPlayMonitorRecord = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioStopRecord_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioStopRecord_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) //null, //ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Refresh")), null, () => { //Logger.Log("AudioPaneViewModel.CommandRefresh", Category.Debug, Priority.Medium); OnStopPlayMonitorRecord(); }, () => true, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_StopPlayMonitorRecord)); m_ShellView.RegisterRichCommand(CommandStopPlayMonitorRecord); // CommandRefresh = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioReload_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioReload_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) //null, //ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Refresh")), m_ShellView.LoadTangoIcon("view-refresh"), () => { //Logger.Log("AudioPaneViewModel.CommandRefresh", Category.Debug, Priority.Medium); //StartWaveFormLoadTimer(0); AudioPlayer_LoadWaveForm(false); }, () => CanManipulateWaveForm, //!IsWaveFormLoading, null, null); //IsAudioLoaded m_ShellView.RegisterRichCommand(CommandRefresh); // CommandZoomSelection = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioZoomSelection_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioZoomSelection_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Search")), //shellView.LoadTangoIcon("system-search"), () => { Logger.Log("AudioPaneViewModel.CommandZoomSelection", Category.Debug, Priority.Medium); View.ZoomSelection(); }, () => View != null && State.Audio.HasContent && CanManipulateWaveForm //&&!IsWaveFormLoading && IsSelectionSet, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ZoomSelection)); m_ShellView.RegisterRichCommand(CommandZoomSelection); // CommandZoomFitFull = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioFitFull_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioFitFull_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoomFitFull", Category.Debug, Priority.Medium); View.ZoomFitFull(); }, () => View != null && State.Audio.HasContent && CanManipulateWaveForm, //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ZoomFitFull)); //Settings_KeyGestures.Default.Keyboard_Audio_Zoom_0 m_ShellView.RegisterRichCommand(CommandZoomFitFull); // CommandZoom_0 = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioFitFull_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioFitFull_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { //Logger.Log("AudioPaneViewModel.CommandZoom_0", Category.Debug, Priority.Medium); //View.ZoomFitFull(); CommandZoomFitFull.Execute(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_0)); m_ShellView.RegisterRichCommand(CommandZoom_0); // CommandZoom_1 = new RichDelegateCommand( "Zoom 1", "Zoom 1", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_1", Category.Debug, Priority.Medium); View.Zoom_1(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_1)); m_ShellView.RegisterRichCommand(CommandZoom_1); // CommandZoom_2 = new RichDelegateCommand( "Zoom 2", "Zoom 2", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_2", Category.Debug, Priority.Medium); View.Zoom_2(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_2)); m_ShellView.RegisterRichCommand(CommandZoom_2); // CommandZoom_3 = new RichDelegateCommand( "Zoom 3", "Zoom 3", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_3", Category.Debug, Priority.Medium); View.Zoom_3(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_3)); m_ShellView.RegisterRichCommand(CommandZoom_3); // CommandZoom_4 = new RichDelegateCommand( "Zoom 4", "Zoom 4", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_4", Category.Debug, Priority.Medium); View.Zoom_4(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_4)); m_ShellView.RegisterRichCommand(CommandZoom_4); // CommandZoom_5 = new RichDelegateCommand( "Zoom 5", "Zoom 5", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_5", Category.Debug, Priority.Medium); View.Zoom_5(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_5)); m_ShellView.RegisterRichCommand(CommandZoom_5); // CommandZoom_6 = new RichDelegateCommand( "Zoom 6", "Zoom 6", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_6", Category.Debug, Priority.Medium); View.Zoom_6(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_6)); m_ShellView.RegisterRichCommand(CommandZoom_6); // CommandZoom_7 = new RichDelegateCommand( "Zoom 7", "Zoom 7", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_7", Category.Debug, Priority.Medium); View.Zoom_7(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_7)); m_ShellView.RegisterRichCommand(CommandZoom_7); // CommandZoom_8 = new RichDelegateCommand( "Zoom 8", "Zoom 8", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_8", Category.Debug, Priority.Medium); View.Zoom_8(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_8)); m_ShellView.RegisterRichCommand(CommandZoom_8); // CommandZoom_9 = new RichDelegateCommand( "Zoom 9", "Zoom 9", null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"), () => { Logger.Log("AudioPaneViewModel.CommandZoom_9", Category.Debug, Priority.Medium); View.Zoom_9(); }, () => CommandZoomFitFull.CanExecute(), //&& !IsWaveFormLoading, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_9)); m_ShellView.RegisterRichCommand(CommandZoom_9); // CommandAudioSettings = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioSettings_ShortDesc, Tobi_Plugin_AudioPane_Lang.CmdAudioSettings_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadGnomeNeuIcon("Neu_audio-x-generic"), () => { Logger.Log("AudioPaneViewModel.CommandAudioSettings", Category.Debug, Priority.Medium); var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_AudioPane_Lang.CmdAudioSettings_ShortDesc), new AudioSettings(this), PopupModalWindow.DialogButtonsSet.Close, PopupModalWindow.DialogButton.Close, true, 420, 220, null, 0,null); windowPopup.EnableEnterKeyDefault = true; windowPopup.ShowFloating(()=> { m_SpeechSynthesizer.SpeakAsyncCancelAll(); }); }, () => !IsRecording, Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ShowOptions) ); m_ShellView.RegisterRichCommand(CommandAudioSettings); // #if DEBUG CommandShowAudioOptionsDialog = new RichDelegateCommand( @"Show audio options", null, null, // KeyGesture obtained from settings (see last parameters below) null, ()=> { Logger.Log("AudioPaneViewModel.CommandShowOptionsDialog", Category.Debug, Priority.Medium); //var window = shellView.View as Window; var pane = new AudioOptions { DataContext = this }; var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(@"Show audio options"), pane, PopupModalWindow.DialogButtonsSet.Close, PopupModalWindow.DialogButton.Close, true, 400, 500, null, 0,null); windowPopup.EnableEnterKeyDefault = true; windowPopup.Show(); }, () => true, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ExpertOptions) ); m_ShellView.RegisterRichCommand(CommandShowAudioOptionsDialog); #endif //DEBUG // CommandFocus = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioFocus_ShortDesc, null, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("audio-volume-low"), () => { Logger.Log("AudioPaneViewModel.CommandFocus", Category.Debug, Priority.Medium); View.BringIntoFocus(); }, () => View != null, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Focus_Audio)); m_ShellView.RegisterRichCommand(CommandFocus); // CommandFocusStatusBar = new RichDelegateCommand( Tobi_Plugin_AudioPane_Lang.CmdAudioFocusStatusBar_ShortDesc, null, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadGnomeNeuIcon("Neu_utilities-terminal"), () => { Logger.Log("AudioPaneViewModel.CommandFocusStatusBar", Category.Debug, Priority.Medium); View.BringIntoFocusStatusBar(); }, () => View != null, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Focus_StatusBar)); m_ShellView.RegisterRichCommand(CommandFocusStatusBar); // }
private bool askUserAppUpdate(string thisVersion, string latestVersion) { m_Logger.Log("ShellView.askUserAppUpdate", Category.Debug, Priority.Medium); var label = new TextBlock { Text = Tobi_Lang.TobiUpdate_Message, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var label2 = new TextBlock { Text = "[" + thisVersion + " --> " + latestVersion + "]", Margin = new Thickness(8, 0, 8, 8), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider(LoadTangoIcon("help-browser"), MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; panel.Children.Add(iconProvider.IconLarge); var panel2 = new StackPanel { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, }; panel.Children.Add(panel2); panel2.Children.Add(label); panel2.Children.Add(label2); //panel.Margin = new Thickness(8, 8, 8, 0); //var details = new TextBoxReadOnlyCaretVisible // { // TextReadOnly = Tobi_Lang.ExitConfirm //}; var windowPopup = new PopupModalWindow(this, UserInterfaceStrings.EscapeMnemonic(Tobi_Lang.TobiUpdate_Title), panel, PopupModalWindow.DialogButtonsSet.YesNo, PopupModalWindow.DialogButton.No, true, 400, 200, null, 40, null); windowPopup.ShowModal(); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { if (m_UrakawaSession != null && m_UrakawaSession.DocumentProject != null && m_UrakawaSession.IsDirty) { PopupModalWindow.DialogButton button = m_UrakawaSession.CheckSaveDirtyAndClose(PopupModalWindow.DialogButtonsSet.YesNoCancel, "exit"); if (PopupModalWindow.IsButtonEscCancel(button)) { return(false); } } return(true); } return(false); }
private void OnClick_ButtonAddMetadataAttr(object sender, RoutedEventArgs e) { if (MetadatasListView.SelectedIndex < 0) { return; } Metadata md = (Metadata)MetadatasListView.SelectedItem; var mdAttr = new MetadataAttribute(); mdAttr.Name = ""; // PROMPT_MD_NAME; mdAttr.Value = ""; // PROMPT_MD_VALUE; string newName = null; string newValue = null; bool invalidSyntax = false; bool ok = true; while (ok && ( invalidSyntax || string.IsNullOrEmpty(newName) || string.IsNullOrEmpty(newValue) //|| newName == PROMPT_MD_NAME //|| newValue == PROMPT_MD_VALUE ) ) { ok = showMetadataAttributeEditorPopupDialog("Name", "Value", mdAttr, out newName, out newValue, false, true, invalidSyntax); mdAttr.Name = newName; mdAttr.Value = newValue; if (!string.IsNullOrEmpty(newName) && !string.IsNullOrEmpty(newValue)) { invalidSyntax = m_ViewModel.IsIDInValid(newName) || ( (newName.Equals(XmlReaderWriterHelper.XmlId) || newName.Equals(DiagramContentModelHelper.DiagramElementName)) && m_ViewModel.IsIDInValid(newValue) ); } } if (!ok) { return; } //bool ok = showMetadataAttributeEditorPopupDialog(mdAttr, out newName, out newValue, false); //if (ok && // newName != mdAttr.Name && newValue != mdAttr.Value) //{ if (md.OtherAttributes != null) { foreach (MetadataAttribute mAtt in md.OtherAttributes.ContentsAs_Enumerable) { if (mAtt.Name == newName) { var label = new TextBlock { Text = "This attribute already exists.", Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var iconProvider = new ScalableGreyableImageProvider(m_ShellView.LoadTangoIcon("dialog-warning"), m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic("Duplicate attribute!"), panel, PopupModalWindow.DialogButtonsSet.Ok, PopupModalWindow.DialogButton.Ok, true, 300, 160, null, 0, m_DescriptionPopupModalWindow); //view.OwnerWindow = windowPopup; windowPopup.ShowModal(); return; } } } m_ViewModel.AddMetadataAttr(md, newName, newValue); MetadataAttributesListView.Items.Refresh(); MetadataAttributesListView.SelectedIndex = MetadataAttributesListView.Items.Count - 1; //FocusHelper.FocusBeginInvoke(MetadataAttributesListView); }
//public RichDelegateCommand OpenImageDescriptionsManualCommand { get; private set; } private void initCommands() { m_Logger.Log(@"ShellView.initCommands", Category.Debug, Priority.Medium); OpenOnlineDocCommand = new RichDelegateCommand( Tobi_Lang.CmdDocOnline_ShortDesc, Tobi_Lang.CmdDocOnline_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) null, () => { m_Logger.Log(@"ShellView.OpenOnlineDocCommand", Category.Debug, Priority.Medium); ExecuteShellProcess("http://www.daisy.org/tobi/doc"); }, () => !m_UrakawaSession.isAudioRecording, Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Help) ); RegisterRichCommand(OpenOnlineDocCommand); OpenLocalDocCommand = new RichDelegateCommand( Tobi_Lang.CmdDocLocal_ShortDesc, Tobi_Lang.CmdDocLocal_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) null, () => { m_Logger.Log(@"ShellView.OpenLocalDocCommand", Category.Debug, Priority.Medium); string appFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string chmPath = Path.Combine(appFolder, "TobiHelp.chm"); ExecuteShellProcess(chmPath); }, () => !m_UrakawaSession.isAudioRecording, Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Help) ); RegisterRichCommand(OpenLocalDocCommand); //OpenImageDescriptionsManualCommand = new RichDelegateCommand( // Tobi_Lang.CmdOpenImageDescriptionsManual_ShortDesc, // Tobi_Lang.CmdOpenImageDescriptionsManual_LongDesc, // null, // KeyGesture obtained from settings (see last parameters below) // null, // () => // { // m_Logger.Log(@"ShellView.OpenImageDescriptionsManualCommand", Category.Debug, Priority.Medium); // ExecuteShellProcess("http://www.daisy.org/tobi/image-description-manual"); // }, // () => true, // Settings_KeyGestures.Default, // null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowTobiFolder) // ); //RegisterRichCommand(OpenImageDescriptionsManualCommand); // ExitCommand = new RichDelegateCommand( Tobi_Lang.CmdMenuExit_ShortDesc, Tobi_Lang.CmdMenuExit_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) //UserInterfaceStrings.Menu_Exit_KEYS, LoadTangoIcon(@"system-log-out"), //ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Exit")), //LoadTangoIcon("document-save"), () => { m_Logger.Log(@"ShellView.ExitCommand", Category.Debug, Priority.Medium); if (askUserConfirmExit()) { exit(); } }, () => { m_Logger.Log(@"Application.Current.Windows.Count: " + Application.Current.Windows.Count + " -- " + Debugger.IsAttached, Category.Debug, Priority.Medium); return(Application.Current.Windows.Count == #if NET40 (Debugger.IsAttached ? 2 : 1) #else 1 #endif && !m_UrakawaSession.isAudioRecording); }, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_AppExit)); RegisterRichCommand(ExitCommand); // MagnifyUiResetCommand = new RichDelegateCommand( Tobi_Lang.CmdUIResetMagnification_ShortDesc, Tobi_Lang.CmdUIResetMagnification_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) LoadTangoIcon(@"weather-clear"), () => { m_Logger.Log(@"ShellView.MagnifyUiResetCommand", Category.Debug, Priority.Medium); MagnificationLevel = 1; }, () => !m_UrakawaSession.isAudioRecording, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_UI_Zoom_Reset)); RegisterRichCommand(MagnifyUiResetCommand); // MagnifyUiIncreaseCommand = new RichDelegateCommand( Tobi_Lang.CmdUIIncreaseMagnification_ShortDesc, Tobi_Lang.CmdUIIncreaseMagnification_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) //LoadTangoIcon("mail-forward"), ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource(@"Horizon_Image_Zoom_In")), () => { m_Logger.Log(@"ShellView.MagnifyUiIncreaseCommand", Category.Debug, Priority.Medium); MagnificationLevel += 0.15; }, () => !m_UrakawaSession.isAudioRecording, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_UI_Zoom_Increase)); RegisterRichCommand(MagnifyUiIncreaseCommand); // MagnifyUiDecreaseCommand = new RichDelegateCommand( Tobi_Lang.CmdUIDecreaseMagnification_ShortDesc, Tobi_Lang.CmdUIDecreaseMagnification_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource(@"Horizon_Image_Zoom_out")), () => { m_Logger.Log(@"ShellView.MagnifyUiDecreaseCommand", Category.Debug, Priority.Medium); MagnificationLevel -= 0.15; }, () => !m_UrakawaSession.isAudioRecording, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_UI_Zoom_Decrease)); RegisterRichCommand(MagnifyUiDecreaseCommand); // #if ICONS DisplayPreviewIconsDebugCommand = new RichDelegateCommand( UserInterfaceStrings.IconsDebug, null, UserInterfaceStrings.IconsDebug_KEYS, null, DisplayPreviewIconsDebugCommand_Executed, () => true); RegisterRichCommand(DisplayPreviewIconsDebugCommand); #endif #if DEBUG ManageShortcutsCommand = new RichDelegateCommand( Tobi_Lang.CmdManageShortcuts_ShortDesc, Tobi_Lang.CmdManageShortcuts_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) LoadTangoIcon(@"preferences-desktop-keyboard-shortcuts"), () => { m_Logger.Log(@"ShellView.ManageShortcutsCommand_Executed", Category.Debug, Priority.Medium); var windowPopup = new PopupModalWindow(this, UserInterfaceStrings.EscapeMnemonic(Tobi_Lang.CmdManageShortcuts_ShortDesc), new KeyboardShortcuts(this), PopupModalWindow.DialogButtonsSet.Ok, PopupModalWindow.DialogButton.Ok, true, 500, 600, null, 0, null); windowPopup.ShowFloating(null); }, () => true, Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_DisplayShortcuts) ); RegisterRichCommand(ManageShortcutsCommand); #endif //#if DEBUG // ShowLogFilePathCommand = new RichDelegateCommand( // UserInterfaceStrings.ShowLogFilePath, // UserInterfaceStrings.ShowLogFilePath_, // null, // KeyGesture obtained from settings (see last parameters below) // null, //LoadTangoIcon(@"help-browser"), // () => // { // m_Logger.Log(@"ShellView.ShowLogFilePathCommand", Category.Debug, Priority.Medium); // var label = new TextBlock // { // Text = UserInterfaceStrings.ShowLogFilePath_, // Margin = new Thickness(8, 0, 8, 0), // HorizontalAlignment = HorizontalAlignment.Center, // VerticalAlignment = VerticalAlignment.Center, // Focusable = true, // TextWrapping = TextWrapping.Wrap // }; // var iconProvider = new ScalableGreyableImageProvider(LoadTangoIcon("edit-find"), MagnificationLevel); // var panel = new StackPanel // { // Orientation = Orientation.Horizontal, // HorizontalAlignment = HorizontalAlignment.Center, // VerticalAlignment = VerticalAlignment.Stretch, // }; // panel.Children.Add(iconProvider.IconLarge); // panel.Children.Add(label); // //panel.Margin = new Thickness(8, 8, 8, 0); // var details = new TextBoxReadOnlyCaretVisible(ApplicationConstants.LOG_FILE_PATH) // { // }; // var windowPopup = new PopupModalWindow(this, // UserInterfaceStrings.EscapeMnemonic( // UserInterfaceStrings.ShowLogFilePath), // panel, // PopupModalWindow.DialogButtonsSet.Close, // PopupModalWindow.DialogButton.Close, // true, 300, 160, details, 40); // windowPopup.ShowModal(); // }, // () => true, // Settings_KeyGestures.Default, // null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_DisplayLogFilePath) // ); // RegisterRichCommand(ShowLogFilePathCommand); // // //#endif //DEBUG // OpenTobiIsolatedStorageCommand = new RichDelegateCommand( Tobi_Lang.CmdOpenTobiIsolatedStorage_ShortDesc, Tobi_Lang.CmdOpenTobiIsolatedStorage_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) LoadGnomeNeuIcon(@"Neu_applications-office"), () => { m_Logger.Log(@"ShellView.OpenTobiIsolatedStorageCommand", Category.Debug, Priority.Medium); ExecuteShellProcess(ExternalFilesDataManager.STORAGE_FOLDER_PATH); }, () => !m_UrakawaSession.isAudioRecording, Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowTobiFolder) ); RegisterRichCommand(OpenTobiIsolatedStorageCommand); // OpenTobiFolderCommand = new RichDelegateCommand( Tobi_Lang.CmdOpenTobiFolder_ShortDesc, Tobi_Lang.CmdOpenTobiFolder_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) LoadGnomeNeuIcon(@"Neu_user-home"), () => { m_Logger.Log(@"ShellView.OpenTobiFolderCommand", Category.Debug, Priority.Medium); ExecuteShellProcess(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); }, () => !m_UrakawaSession.isAudioRecording, Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowTobiFolder) ); RegisterRichCommand(OpenTobiFolderCommand); // OpenTobiSettingsFolderCommand = new RichDelegateCommand( Tobi_Lang.CmdOpenTobiSettingsFolder_ShortDesc, Tobi_Lang.CmdOpenTobiSettingsFolder_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) LoadGnomeFoxtrotIcon(@"Foxtrot_folder"), () => { m_Logger.Log(@"ShellView.OpenTobiSettingsFolderCommand", Category.Debug, Priority.Medium); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal); string settingsPath = Path.GetDirectoryName(config.FilePath); ExecuteShellProcess(settingsPath); }, () => !m_UrakawaSession.isAudioRecording, Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowTobiSettingsFolder) ); RegisterRichCommand(OpenTobiSettingsFolderCommand); // #if DEBUG HelpCommand = new RichDelegateCommand( Tobi_Lang.CmdHelp_ShortDesc, Tobi_Lang.CmdHelp_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) LoadTangoIcon("help-browser"), () => { m_Logger.Log("ShellView.HelpCommand", Category.Debug, Priority.Medium); throw new NotImplementedException("Functionality not implemented, sorry :(", new ArgumentOutOfRangeException("First Inner exception", new FileNotFoundException("Second inner exception !"))); // try // { } //catch (Exception ex) //{ // ExceptionHandler.Handle(ex, false, this); //} }, () => true, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Help)); RegisterRichCommand(HelpCommand); #endif // //PreferencesCommand = new RichDelegateCommand( // UserInterfaceStrings.Preferences, // UserInterfaceStrings.Preferences_, // null, // KeyGesture obtained from settings (see last parameters below) // LoadTangoIcon("preferences-system"), // () => Debug.Fail("Functionality not implemented yet."), // () => true, // Settings_KeyGestures.Default, // PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Preferences)); //RegisterRichCommand(PreferencesCommand); // //WebHomeCommand = new RichDelegateCommand(UserInterfaceStrings.WebHome, // UserInterfaceStrings.WebHome_, // UserInterfaceStrings.WebHome_KEYS, // //ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Home_icon")), // LoadTangoIcon("go-home"), // ()=> { throw new NotImplementedException("Functionality not implemented, sorry :("); }, ()=> true); //RegisterRichCommand(WebHomeCommand); //// //NavNextCommand = new RichDelegateCommand(UserInterfaceStrings.NavNext, // UserInterfaceStrings.NavNext_, // UserInterfaceStrings.NavNext_KEYS, // ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Forward")), // ()=> { throw new NotImplementedException("Functionality not implemented, sorry :("); }, ()=> true); //RegisterRichCommand(NavNextCommand); //// //NavPreviousCommand = new RichDelegateCommand(UserInterfaceStrings.NavPrevious, // UserInterfaceStrings.NavPrevious_, // UserInterfaceStrings.NavPrevious_KEYS, // ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Back")), // ()=> { throw new NotImplementedException("Functionality not implemented, sorry :("); }, ()=> true); //RegisterRichCommand(NavPreviousCommand); }
public void Popup() { var navView = m_Container.Resolve <DescriptionsNavigationView>(); if (navView != null) { navView.UpdateTreeNodeSelectionFromListItem(); } Tuple <TreeNode, TreeNode> selection = m_Session.GetTreeNodeSelection(); TreeNode node = selection.Item2 ?? selection.Item1; if (node == null) { return; } var navModel = m_Container.Resolve <DescriptionsNavigationViewModel>(); if (navModel.DescriptionsNavigator == null) { return; } bool found = false; foreach (DescribableTreeNode dnode in navModel.DescriptionsNavigator.DescribableTreeNodes) { found = dnode.TreeNode == node; if (found) { break; } } if (!found) { var label = new TextBlock { Text = "You must first select an image to describe.", Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.WrapWithOverflow }; var iconProvider = new ScalableGreyableImageProvider(m_ShellView.LoadTangoIcon("dialog-warning"), m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); var popup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_Descriptions_Lang.CmdEditDescriptions_ShortDesc), panel, PopupModalWindow.DialogButtonsSet.Ok, PopupModalWindow.DialogButton.Ok, true, 340, 160, null, 0, null); popup.ShowModal(); return; } var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_Descriptions_Lang.CmdEditDescriptions_ShortDesc), this, PopupModalWindow.DialogButtonsSet.OkApplyCancel, PopupModalWindow.DialogButton.Apply, true, 1000, 600, null, 0, null); //this.OwnerWindow = windowPopup; DONE in ON PANEL LOADED EVENT windowPopup.IgnoreEscape = true; //var bindings = Application.Current.MainWindow.InputBindings; //foreach (var binding in bindings) //{ // if (binding is KeyBinding) // { // var keyBinding = (KeyBinding)binding; // if (keyBinding.Command == m_ShellView.ExitCommand) // { // continue; // } // windowPopup.InputBindings.Add(keyBinding); // } //} //windowPopup.InputBindings.AddRange(Application.Current.MainWindow.InputBindings); //windowPopup.KeyUp += (object sender, KeyEventArgs e) => // { // var key = (e.Key == Key.System // ? e.SystemKey // : (e.Key == Key.ImeProcessed ? e.ImeProcessedKey : e.Key)); // if (key == Key.Escape) // { // m_EventAggregator.GetEvent<EscapeEvent>().Publish(null); // } // }; //windowPopup.Closed += (sender, ev) => Dispatcher.BeginInvoke( // DispatcherPriority.Background, // (Action)(() => // { // // // })); m_Session.DocumentProject.Presentations.Get(0).UndoRedoManager.StartTransaction (Tobi_Plugin_Descriptions_Lang.CmdEditDescriptions_ShortDesc, Tobi_Plugin_Descriptions_Lang.CmdEditDescriptions_LongDesc, "EDIT_IMAGE_DESCRIPTIONS"); //Tuple<TreeNode, TreeNode> selection = m_Session.GetTreeNodeSelection(); //TreeNode node = selection.Item2 ?? selection.Item1; //if (node == null) return; bool hadAltProp = true; var altProp = node.GetAlternateContentProperty(); //node.GetAlternateContentProperty(); if (altProp == null) { hadAltProp = false; altProp = node.GetOrCreateAlternateContentProperty(); DebugFix.Assert(altProp != null); } m_DescriptionPopupModalWindow = windowPopup; windowPopup.ShowModal(); m_DescriptionPopupModalWindow = null; if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Ok || windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Apply) { altProp = node.GetAlternateContentProperty(); //node.GetAlternateContentProperty(); if (altProp != null) { removeEmptyDescriptions(altProp); } bool empty = m_Session.DocumentProject.Presentations.Get(0).UndoRedoManager.IsTransactionEmpty; m_Session.DocumentProject.Presentations.Get(0).UndoRedoManager.EndTransaction(); if (empty) { altProp = node.GetAlternateContentProperty(); //node.GetAlternateContentProperty(); if (altProp != null && !hadAltProp) { #if DEBUG DebugFix.Assert(altProp.IsEmpty); #endif //DEBUG node.RemoveProperty(altProp); } } } else { m_Session.DocumentProject.Presentations.Get(0).UndoRedoManager.CancelTransaction(); altProp = node.GetAlternateContentProperty(); //node.GetAlternateContentProperty(); if (altProp != null && !hadAltProp) { #if DEBUG DebugFix.Assert(altProp.IsEmpty); #endif //DEBUG node.RemoveProperty(altProp); } } if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Apply) { Popup(); } }
private void OnLoaded_Panel(object sender, RoutedEventArgs e) { var win = Window.GetWindow(this); //if (win is PopupModalWindow) // OwnerWindow = (PopupModalWindow)win; OwnerWindow = win as PopupModalWindow; // can be NULL !! if (m_iconAudioHigh1 == null) { m_iconAudioHigh1 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-low"), m_ShellView.MagnificationLevel); ButtonAudio_LongDesc.Content = m_iconAudioHigh1.IconMedium; m_iconAudioHigh2 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-low"), m_ShellView.MagnificationLevel); ButtonAudio_Summary.Content = m_iconAudioHigh2.IconMedium; m_iconAudioHigh3 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-low"), m_ShellView.MagnificationLevel); ButtonAudio_SimplifiedLanguage.Content = m_iconAudioHigh3.IconMedium; m_iconAudioHigh4 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-low"), m_ShellView.MagnificationLevel); ButtonAudio_SimplifiedImage.Content = m_iconAudioHigh4.IconMedium; m_iconAudioHigh5 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-low"), m_ShellView.MagnificationLevel); ButtonAudio_TactileImage.Content = m_iconAudioHigh5.IconMedium; } if (m_iconAudioMuted1 == null) { m_iconAudioMuted1 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-muted"), m_ShellView.MagnificationLevel); ButtonNoAudio_LongDesc.Content = m_iconAudioMuted1.IconMedium; m_iconAudioMuted2 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-muted"), m_ShellView.MagnificationLevel); ButtonNoAudio_Summary.Content = m_iconAudioMuted2.IconMedium; m_iconAudioMuted3 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-muted"), m_ShellView.MagnificationLevel); ButtonNoAudio_SimplifiedLanguage.Content = m_iconAudioMuted3.IconMedium; m_iconAudioMuted4 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-muted"), m_ShellView.MagnificationLevel); ButtonNoAudio_SimplifiedImage.Content = m_iconAudioMuted4.IconMedium; m_iconAudioMuted5 = new ScalableGreyableImageProvider(LoadTangoIcon("audio-volume-muted"), m_ShellView.MagnificationLevel); ButtonNoAudio_TactileImage.Content = m_iconAudioMuted5.IconMedium; } m_iconAudioHigh1.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioHigh2.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioHigh3.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioHigh4.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioHigh5.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioMuted1.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioMuted2.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioMuted3.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioMuted4.IconDrawScale = m_ShellView.MagnificationLevel; m_iconAudioMuted5.IconDrawScale = m_ShellView.MagnificationLevel; m_ViewModel.OnPanelLoaded(); forceRefreshDataUI(); }