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 string showTextEditorPopupDialog(string editedText, String dialogTitle) { m_Logger.Log("showTextEditorPopupDialog", Category.Debug, Priority.Medium); var editBox = new TextBoxReadOnlyCaretVisible { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], Text = editedText, TextWrapping = TextWrapping.WrapWithOverflow, AcceptsReturn = true }; var windowPopup = new PopupModalWindow(m_ShellView, dialogTitle, new ScrollViewer { Content = editBox, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled, VerticalScrollBarVisibility = ScrollBarVisibility.Auto }, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 350, 200, null, 40, m_DescriptionPopupModalWindow); windowPopup.EnableEnterKeyDefault = true; editBox.Loaded += new RoutedEventHandler((sender, ev) => { editBox.SelectAll(); FocusHelper.FocusBeginInvoke(editBox); }); windowPopup.ShowModal(); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { string str = editBox.Text == null ? "" : editBox.Text.Trim(); //if (string.IsNullOrEmpty(str)) //{ // return ""; //} return(str); } return(null); }
private void ShowDialog() { m_Logger.Log("SettingsPlugin.ShowDialog", Category.Debug, Priority.Medium); var view = m_Container.Resolve <SettingsView>(); var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_Settings_Lang.Preferences), view, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Cancel, true, 800, 500, null, 0, null); windowPopup.IgnoreEscape = true; //view.OwnerWindow = windowPopup; m_SettingsAggregator.SaveAll(); // Not strictly necessary..but just to make double-sure we've got the current settings in persistent storage. windowPopup.ShowFloating(null); windowPopup.Closed += (o, args) => { m_DialogIsShowing = false; // This line is not strictly necessary, but this way we make sure the CanShowDialog method (CanExecute) is called to refresh the command visual enabled/disabled status. CommandManager.InvalidateRequerySuggested(); if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Ok) { m_SettingsAggregator.SaveAll(); } else { m_SettingsAggregator.ReloadAll(); } view = null; // TODO: view is not collected ! (at least in VS debugger) // despite PartCreationPolicy(CreationPolicy.NonShared) //GC.Collect(); //GC.WaitForFullGCComplete(); }; m_DialogIsShowing = true; }
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 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(); }
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 PagesPaneViewModel( IEventAggregator eventAggregator, ILoggerFacade logger, [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] IShellView view, [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] IUrakawaSession session) { m_EventAggregator = eventAggregator; m_Logger = logger; m_ShellView = view; m_session = session; m_Logger.Log("PagesPaneViewModel.initializeCommands", Category.Debug, Priority.Medium); CommandRenumberPages = new RichDelegateCommand( Tobi_Plugin_NavigationPane_Lang.CmdNavigationRenumberPages_ShortDesc, Tobi_Plugin_NavigationPane_Lang.CmdNavigationRenumberPages_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) null, //m_ShellView.LoadTangoIcon("bookmark-new"), () => { if (PagesNavigator_Pages.Count <= 0) { return; } var textBox_pageNumberStringPrefix = new TextBox() { Text = "" }; var label_pageNumberStringPrefix = new TextBlock() { Text = Tobi_Plugin_NavigationPane_Lang.PageNumberPrefix + ": ", Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var panel_pageNumberStringPrefix = new DockPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 0, 18) }; label_pageNumberStringPrefix.SetValue(DockPanel.DockProperty, Dock.Left); panel_pageNumberStringPrefix.Children.Add(label_pageNumberStringPrefix); panel_pageNumberStringPrefix.Children.Add(textBox_pageNumberStringPrefix); var textBox_pageNumberIntegerStart = new TextBox() { Text = "1" }; var label_pageNumberIntegerStart = new TextBlock() { Text = Tobi_Plugin_NavigationPane_Lang.PageNumberStart + ": ", Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var panel_pageNumberIntegerStart = new DockPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 0, 0) }; label_pageNumberIntegerStart.SetValue(DockPanel.DockProperty, Dock.Left); panel_pageNumberIntegerStart.Children.Add(label_pageNumberIntegerStart); panel_pageNumberIntegerStart.Children.Add(textBox_pageNumberIntegerStart); var panel = new StackPanel { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, }; panel.Children.Add(panel_pageNumberStringPrefix); panel.Children.Add(panel_pageNumberIntegerStart); var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_NavigationPane_Lang.CmdNavigationRenumberPages_ShortDesc), panel, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, false, 250, 160, null, 40, null); windowPopup.ShowModal(); if (windowPopup.ClickedDialogButton != PopupModalWindow.DialogButton.Ok) { return; } string prefix = ""; if (!String.IsNullOrEmpty(textBox_pageNumberStringPrefix.Text)) { prefix = textBox_pageNumberStringPrefix.Text; } int pageNumber = 1; if (!String.IsNullOrEmpty(textBox_pageNumberIntegerStart.Text)) { try { pageNumber = Int32.Parse(textBox_pageNumberIntegerStart.Text); } catch (Exception ex) { return; } } var treeNodes = new List <TreeNode>(PagesNavigator_Pages.Count); foreach (Page marked in PagesNavigator_Pages) { treeNodes.Add(marked.TreeNode); } string pageNumberStr = ""; m_session.DocumentProject.Presentations.Get(0).UndoRedoManager.StartTransaction(Tobi_Plugin_NavigationPane_Lang.CmdNavigationRenumberPages_ShortDesc, Tobi_Plugin_NavigationPane_Lang.CmdNavigationRenumberPages_LongDesc, "PAGE_BREAKS_RENUMBER"); foreach (TreeNode treeNode in treeNodes) { pageNumberStr = prefix + (pageNumber++); var cmd = treeNode.Presentation.CommandFactory.CreateTreeNodeChangeTextCommand(treeNode, pageNumberStr); treeNode.Presentation.UndoRedoManager.Execute(cmd); } m_session.DocumentProject.Presentations.Get(0).UndoRedoManager.EndTransaction(); }, () => m_session.DocumentProject != null && !m_session.isAudioRecording && !m_session.IsXukSpine, //SelectedTreeNode != null, //!m_UrakawaSession.IsSplitMaster && Settings_KeyGestures.Default, null) //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_RemoveAllDocMarks) ; m_ShellView.RegisterRichCommand(CommandRenumberPages); CommandFindFocusPage = new RichDelegateCommand( @"PAGES CommandFindFocus DUMMY TXT", @"PAGES CommandFindFocus DUMMY TXT", null, // KeyGesture set only for the top-level CompositeCommand null, () => { m_ShellView.RaiseEscapeEvent(); if (View != null) { IsSearchVisible = true; FocusHelper.Focus(View.SearchBox); View.SearchBox.SelectAll(); } }, () => View != null //&& View.SearchBox.Visibility == Visibility.Visible && View.SearchBox.IsEnabled, null, //Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Nav_TOCFindNext) ); CommandFindNextPage = new RichDelegateCommand( @"PAGES CommandFindNext DUMMY TXT", //UserInterfaceStrings.PageFindNext, @"PAGES CommandFindNext DUMMY TXT", //UserInterfaceStrings.PageFindNext_, null, // KeyGesture set only for the top-level CompositeCommand null, () => { m_ShellView.RaiseEscapeEvent(); PagesNavigator.FindNext(true); }, () => PagesNavigator != null && !string.IsNullOrEmpty(PagesNavigator.SearchTerm), null, //Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Nav_PageFindNext) ); CommandFindPrevPage = new RichDelegateCommand( @"PAGES CommandFindPrevious DUMMY TXT", //UserInterfaceStrings.PageFindPrev, @"PAGES CommandFindPrevious DUMMY TXT", //UserInterfaceStrings.PageFindPrev_, null, // KeyGesture set only for the top-level CompositeCommand null, () => { m_ShellView.RaiseEscapeEvent(); PagesNavigator.FindPrevious(true); }, () => PagesNavigator != null && !string.IsNullOrEmpty(PagesNavigator.SearchTerm), null, //Settings_KeyGestures.Default, null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Nav_PageFindPrev) ); m_EventAggregator.GetEvent <ProjectLoadedEvent>().Subscribe(onProjectLoaded, ProjectLoadedEvent.THREAD_OPTION); m_EventAggregator.GetEvent <ProjectUnLoadedEvent>().Subscribe(onProjectUnLoaded, ProjectUnLoadedEvent.THREAD_OPTION); m_EventAggregator.GetEvent <PageFoundByFlowDocumentParserEvent>().Subscribe(onPageFoundByFlowDocumentParser, PageFoundByFlowDocumentParserEvent.THREAD_OPTION); m_EventAggregator.GetEvent <TreeNodeSelectionChangedEvent>().Subscribe(OnTreeNodeSelectionChanged, TreeNodeSelectionChangedEvent.THREAD_OPTION); }
private string askUserId(IShellView shellView, string title, string message, string info) { m_Logger.Log("Bootstrapper.askUserId", Category.Debug, Priority.Medium); var label = new TextBlock // TextBoxReadOnlyCaretVisible { //FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], //BorderThickness = new Thickness(1), //Padding = new Thickness(6), //TextReadOnly = message, Text = message, FontWeight = FontWeights.Bold, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var input = new TextBox() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Text = "" }; //var iconProvider = new ScalableGreyableImageProvider( // m_ShellView.LoadTangoIcon("help-browser"), // m_ShellView.MagnificationLevel); var panel = new StackPanel { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, }; //panel.Margin = new Thickness(8, 8, 8, 0); //panel.Children.Add(iconProvider.IconLarge); panel.Children.Add(label); panel.Children.Add(input); var checkBox = new CheckBox { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], IsThreeState = false, IsChecked = Settings.Default.UserId_DoNotAskAgain, VerticalAlignment = VerticalAlignment.Center, Content = Tobi_Common_Lang.DoNotShowMessageAgain, Margin = new Thickness(0, 16, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, }; panel.Children.Add(checkBox); var details = new TextBoxReadOnlyCaretVisible { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], BorderThickness = new Thickness(1), Padding = new Thickness(6), TextReadOnly = info }; var windowPopup = new PopupModalWindow(shellView, // m_ShellView title, panel, PopupModalWindow.DialogButtonsSet.OkCancel, // PopupModalWindow.DialogButtonsSet.YesNo PopupModalWindow.DialogButton.Ok, //PopupModalWindow.DialogButton.Yes true, 425, 190, details, 70, null); windowPopup.ShowModal(); Settings.Default.UserId_DoNotAskAgain = checkBox.IsChecked.Value; if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { return(input.Text); } return(null); }
private void InitializeXukSpines() { ShowXukSpineCommand = new RichDelegateCommand( Tobi_Plugin_Urakawa_Lang.CmdShowXukSpine_ShortDesc, Tobi_Plugin_Urakawa_Lang.CmdShowXukSpine_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon(@"preferences-desktop-locale"), () => { m_Logger.Log("UrakawaSession.ShowXukSpineCommand", Category.Debug, Priority.Medium); var view = m_Container.Resolve <XukSpineView>(); var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic( Tobi_Plugin_Urakawa_Lang.CmdShowXukSpine_ShortDesc //Tobi_Plugin_Urakawa_Lang.CmdOpenRecent_ShortDesc ), view, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 400, 600, null, 0, null); //view.OwnerWindow = windowPopup; windowPopup.EnableEnterKeyDefault = true; windowPopup.ShowModal(); if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Ok) { if (view.XukSpineItemsList.SelectedItem != null) { var item = (XukSpineItemWrapper)view.XukSpineItemsList.SelectedItem; string str = item.Data.Uri.IsFile ? item.Data.Uri.LocalPath : item.Data.Uri.ToString(); if (view.check.IsChecked.GetValueOrDefault() && item.SplitMerged) { string parentDir = Path.GetDirectoryName(str); string fileNameWithoutExtn = Path.GetFileNameWithoutExtension(str); string mergedDirName = MERGE_PREFIX + @"_" + fileNameWithoutExtn; string mergedDir = Path.Combine(parentDir, mergedDirName); str = Path.Combine(mergedDir, Path.GetFileName(str)); } try { OpenFile(str); } catch (Exception ex) { ExceptionHandler.Handle(ex, false, m_ShellView); } } } else if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Apply) { // IsXukSpine ? DocumentFilePath : XukSpineProjectPath bool opened = true; if (!IsXukSpine) { opened = false; try { opened = OpenFile(XukSpineProjectPath, false); } catch (Exception ex) { ExceptionHandler.Handle(ex, false, m_ShellView); } } if (opened) { ExportCommand.Execute(); } } else if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Close) { // IsXukSpine ? DocumentFilePath : XukSpineProjectPath bool opened = true; if (!IsXukSpine) { opened = false; try { opened = OpenFile(XukSpineProjectPath, false); } catch (Exception ex) { ExceptionHandler.Handle(ex, false, m_ShellView); } } if (opened) { MergeProjectCommand.Execute(); } } else if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.No) { // IsXukSpine ? DocumentFilePath : XukSpineProjectPath bool opened = true; if (!IsXukSpine) { opened = false; try { opened = OpenFile(XukSpineProjectPath, true); } catch (Exception ex) { ExceptionHandler.Handle(ex, false, m_ShellView); } } //if (opened) //{ // ShowXukSpineCommand.Execute(); //} } }, () => HasXukSpine && !isAudioRecording, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowXukSpine) ); m_ShellView.RegisterRichCommand(ShowXukSpineCommand); }
//private readonly List<Uri> m_RecentFiles = new List<Uri>(); //public IEnumerable<Uri> RecentFiles //{ // get // { // foreach (var fileUrl in m_RecentFiles) // { // yield return fileUrl; // } // } //} private void InitializeRecentFiles() { OpenRecentCommand = new RichDelegateCommand( Tobi_Plugin_Urakawa_Lang.CmdOpenRecent_ShortDesc, Tobi_Plugin_Urakawa_Lang.CmdOpenRecent_LongDesc, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon(@"folder-saved-search"), () => { m_Logger.Log("UrakawaSession.OpenRecentCommand", Category.Debug, Priority.Medium); var view = m_Container.Resolve <RecentFilesView>(); var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic( Tobi_Plugin_Urakawa_Lang.Menu_OpenRecent //Tobi_Plugin_Urakawa_Lang.CmdOpenRecent_ShortDesc ), view, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 800, 500, null, 0, null); //view.OwnerWindow = windowPopup; windowPopup.EnableEnterKeyDefault = true; windowPopup.ShowModal(); if (windowPopup.ClickedDialogButton == PopupModalWindow.DialogButton.Ok) { if (view.RecentFilesList.SelectedItem != null) { try { OpenFile(((RecentFileWrapper)view.RecentFilesList.SelectedItem).Uri.ToString()); } catch (Exception ex) { ExceptionHandler.Handle(ex, false, m_ShellView); } } } }, () => !isAudioRecording, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_OpenRecent)); m_ShellView.RegisterRichCommand(OpenRecentCommand); // ClearRecentFilesCommand = new RichDelegateCommand(Tobi_Plugin_Urakawa_Lang.CmdMenuClearRecentFiles_ShortDesc, Tobi_Plugin_Urakawa_Lang.CmdMenuClearRecentFiles_LongDesc, null, m_ShellView.LoadGnomeNeuIcon(@"Neu_view-refresh"), ClearRecentFiles, () => !isAudioRecording, null, null); m_ShellView.RegisterRichCommand(ClearRecentFilesCommand); // RecentFiles = new ObservableCollection <Uri>(); if (!File.Exists(m_RecentFiles_FilePath)) { return; } StreamReader streamReader = new StreamReader(m_RecentFiles_FilePath, Encoding.UTF8); try { string recentFileUriString; while ((recentFileUriString = streamReader.ReadLine()) != null) { Uri recentFileUri; Uri.TryCreate(recentFileUriString, UriKind.Absolute, out recentFileUri); if (recentFileUri == null //|| //TODO: should we filter the URI scheme at this stage? //recentFileUri.Scheme.ToLower() != "file" //&& recentFileUri.Scheme.ToLower() != "http" ) { continue; } if (!RecentFiles.Contains(recentFileUri)) { RecentFiles.Add(recentFileUri); } } } finally { streamReader.Close(); } }
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); }
private bool showMetadataAttributeEditorPopupDialog(string label1, string label2, MetadataAttribute metadataAttr, out string newName, out string newValue, bool isAltContentMetadata, bool isOptionalAttributes, bool invalidSyntax) { m_Logger.Log("Descriptions.MetadataAttributeEditor", Category.Debug, Priority.Medium); var label_Name = new TextBlock { Text = label1 + ": ", Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var label_Value = new TextBlock { Text = label2 + ": ", Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; //var editBox_Name = new TextBox //{ // Text = metadataAttr.Name, // TextWrapping = TextWrapping.WrapWithOverflow //}; var editBoxCombo_Name = new ComboBox //WithAutomationPeer { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], Text = metadataAttr.Name, IsEditable = true, IsTextSearchEnabled = true, #if NET40 IsTextSearchCaseSensitive = false #endif //NET40 }; //var binding = new Binding //{ // Mode = BindingMode.OneWay, // Source = new RelativeSource(RelativeSourceMode.Self), // Path = new PropertyPath("SelectedItem") //}; ////var expr = editBoxCombo_Name.SetBinding(AutomationProperties.NameProperty, binding); //editBoxCombo_Name.SetValue(AutomationProperties.NameProperty, "daniel"); //editBoxCombo_Name.SelectionChanged += new SelectionChangedEventHandler( // (object sender, SelectionChangedEventArgs e) => // { // //var expr = editBoxCombo_Name.GetBindingExpression(AutomationProperties.NameProperty); // //expr.UpdateTarget(); // //editBoxCombo_Name.NotifyScreenReaderAutomationIfKeyboardFocused(); // //var txt = editBoxCombo_Name.Text; // //editBoxCombo_Name.Text = "mike"; // //editBoxCombo_Name.Text = txt; // editBoxCombo_Name.NotifyScreenReaderAutomation(); // m_Logger.Log("UP TRAGET", Category.Debug, Priority.High); // } // ); var list = new List <String>(); if (isAltContentMetadata) { list.AddRange(DiagramContentModelHelper.DIAGRAM_ElementAttributes); #if true || SUPPORT_ANNOTATION_ELEMENT list.Add(DiagramContentModelHelper.Ref); list.Add(DiagramContentModelHelper.Role); list.Add(DiagramContentModelHelper.By); #endif //SUPPORT_ANNOTATION_ELEMENT } else { if (isOptionalAttributes) { list.AddRange(DiagramContentModelHelper.DIAGRAM_MetadataAdditionalAttributeNames); } else { list.AddRange(DiagramContentModelHelper.DIAGRAM_MetadataProperties); list.Add(DiagramContentModelHelper.NA); } } editBoxCombo_Name.ItemsSource = list; // col = new ObservableCollection<string> { "Eric", "Phillip" }; //combo.SetBinding(ItemsControl.ItemsSourceProperty, new Binding { Source = col }); var editBox_Value = new TextBoxReadOnlyCaretVisible { //Watermark = TEXTFIELD_WATERMARK, Text = metadataAttr.Value, TextWrapping = TextWrapping.WrapWithOverflow }; var panel = new StackPanel { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, }; var panelName = new DockPanel { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, LastChildFill = true }; panelName.Margin = new Thickness(0, 0, 0, 8); label_Name.SetValue(DockPanel.DockProperty, Dock.Left); panelName.Children.Add(label_Name); panelName.Children.Add(editBoxCombo_Name); var panelValue = new DockPanel { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, }; label_Value.SetValue(DockPanel.DockProperty, Dock.Left); panelValue.Children.Add(label_Value); panelValue.Children.Add(editBox_Value); panel.Children.Add(panelName); panel.Children.Add(panelValue); if (invalidSyntax) { var msg = new TextBlock(new Run("(invalid syntax)")) { Margin = new Thickness(0, 6, 0, 0), Focusable = true, FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], }; panel.Children.Add(msg); } //var details = new TextBoxReadOnlyCaretVisible // { // TextReadOnly = Tobi_Lang.ExitConfirm //}; var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic("Edit attribute"), panel, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 310, 200, null, 40, m_DescriptionPopupModalWindow); windowPopup.EnableEnterKeyDefault = true; editBoxCombo_Name.Loaded += new RoutedEventHandler((sender, ev) => { var textBox = ComboBoxWithAutomationPeer.GetTextBox(editBoxCombo_Name); if (textBox != null) { textBox.FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"]; textBox.SelectAll(); } FocusHelper.FocusBeginInvoke(editBoxCombo_Name); }); editBox_Value.Loaded += new RoutedEventHandler((sender, ev) => { editBox_Value.SelectAll(); //FocusHelper.FocusBeginInvoke(editBox_Name); }); WatermarkComboBoxBehavior.SetEnableWatermark(editBoxCombo_Name, true); WatermarkComboBoxBehavior.SetLabel(editBoxCombo_Name, TEXTFIELD_WATERMARK); Style style = (Style)Application.Current.Resources[@"WatermarkTextBoxStyle"]; WatermarkComboBoxBehavior.SetLabelStyle(editBoxCombo_Name, style); WatermarkTextBoxBehavior.SetEnableWatermark(editBox_Value, true); WatermarkTextBoxBehavior.SetLabel(editBox_Value, TEXTFIELD_WATERMARK); //Style style = (Style)Application.Current.Resources[@"WatermarkTextBoxStyle"]; WatermarkTextBoxBehavior.SetLabelStyle(editBox_Value, style); windowPopup.ShowModal(); WatermarkComboBoxBehavior.SetEnableWatermark(editBoxCombo_Name, false); WatermarkTextBoxBehavior.SetEnableWatermark(editBox_Value, false); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { newName = editBoxCombo_Name.Text.Trim(); newValue = editBox_Value.Text.Trim(); return(true); } newName = null; newValue = null; return(false); }
public void ImportMetadata() { //m_ShellView.ExecuteShellProcess(MetadataPaneViewModel.METADATA_IMPORT_DIRECTORY); string text; List <Tuple <string, string> > metadatas = readMetadataImport(out text); var editBox = new TextBoxReadOnlyCaretVisible { Text = text, AcceptsReturn = true, TextWrapping = TextWrapping.WrapWithOverflow }; var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_MetadataPane_Lang.Import), new ScrollViewer { Content = editBox }, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 500, 600, null, 40, null); windowPopup.EnableEnterKeyDefault = false; editBox.Loaded += new RoutedEventHandler((sender, ev) => { //editBox.SelectAll(); FocusHelper.FocusBeginInvoke(editBox); }); windowPopup.ShowModal(); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { if (!string.IsNullOrEmpty(editBox.Text)) { StreamWriter streamWriter = new StreamWriter(METADATA_IMPORT_FILE, false, Encoding.UTF8); try { streamWriter.Write(editBox.Text); } finally { streamWriter.Close(); } string newText; metadatas = readMetadataImport(out newText); //DebugFix.assert(newText.Equals(editBox.Text, StringComparison.Ordinal)); Presentation presentation = m_UrakawaSession.DocumentProject.Presentations.Get(0); foreach (Tuple <string, string> md in metadatas) { List <NotifyingMetadataItem> toRemove = new List <NotifyingMetadataItem>(); foreach (NotifyingMetadataItem m in this.MetadataCollection.Metadatas) { if (m.Name.Equals(md.Item1, StringComparison.Ordinal)) { if (!m.Definition.IsRepeatable) { if (!toRemove.Contains(m)) { toRemove.Add(m); } } } } foreach (var m in toRemove) { RemoveMetadata(m); } Metadata metadata = presentation.MetadataFactory.CreateMetadata(); metadata.NameContentAttribute = new MetadataAttribute { Name = md.Item1, NamespaceUri = "", Value = md.Item2 }; MetadataAddCommand cmd = presentation.CommandFactory.CreateMetadataAddCommand (metadata); presentation.UndoRedoManager.Execute(cmd); } } } }
public void messageBoxText(string title, string text, string info) { m_Logger.Log(@"UrakawaSession_Save.messageBoxText", Category.Debug, Priority.Medium); if (String.IsNullOrEmpty(info)) { info = ""; } var label = new TextBlock { Text = text, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap, FontWeight = FontWeights.Bold, }; var textArea = new TextBoxReadOnlyCaretVisible() { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], IsReadOnly = true, TextReadOnly = info, BorderThickness = new Thickness(1), Padding = new Thickness(6), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Focusable = true, TextWrapping = TextWrapping.Wrap }; var scroll = new ScrollViewer { Content = textArea, Margin = new Thickness(6), VerticalScrollBarVisibility = ScrollBarVisibility.Visible, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }; var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, }; panel.Children.Add(label); //panel.Margin = new Thickness(8, 8, 8, 0); if (String.IsNullOrEmpty(info)) { scroll = null; } var windowPopup = new PopupModalWindow(m_ShellView, title, panel, PopupModalWindow.DialogButtonsSet.Ok, PopupModalWindow.DialogButton.Ok, true, 500, 160, scroll, 300, null); windowPopup.ShowModal(); }
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 string showLineEditorPopupDialog(string editedText, string dialogTitle, List <string> predefinedCandidates, bool invalidSyntax) { m_Logger.Log("showTextEditorPopupDialog", Category.Debug, Priority.Medium); if (predefinedCandidates == null) { var editBox = new TextBoxReadOnlyCaretVisible { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], //Watermark = TEXTFIELD_WATERMARK, Text = editedText, TextWrapping = TextWrapping.NoWrap, AcceptsReturn = false }; var panel = new StackPanel(); panel.SetValue(StackPanel.OrientationProperty, Orientation.Vertical); panel.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center); editBox.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center); panel.Children.Add(editBox); if (invalidSyntax) { var msg = new TextBlock(new Run("(invalid syntax)")) { Margin = new Thickness(0, 6, 0, 0), Focusable = true, FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], }; panel.Children.Add(msg); } var windowPopup = new PopupModalWindow(m_ShellView, dialogTitle, panel, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 300, 160, null, 40, m_DescriptionPopupModalWindow); windowPopup.EnableEnterKeyDefault = true; editBox.SetValue(AutomationProperties.NameProperty, dialogTitle); editBox.Loaded += new RoutedEventHandler((sender, ev) => { editBox.SelectAll(); FocusHelper.FocusBeginInvoke(editBox); }); WatermarkTextBoxBehavior.SetEnableWatermark(editBox, true); WatermarkTextBoxBehavior.SetLabel(editBox, TEXTFIELD_WATERMARK); Style style = (Style)Application.Current.Resources[@"WatermarkTextBoxStyle"]; WatermarkTextBoxBehavior.SetLabelStyle(editBox, style); windowPopup.ShowModal(); WatermarkTextBoxBehavior.SetEnableWatermark(editBox, false); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { string str = editBox.Text == null ? "" : editBox.Text.Trim(); //if (string.IsNullOrEmpty(str)) //{ // return ""; //} return(str); } return(null); } else { var editBoxCombo_Name = new ComboBox //WithAutomationPeer { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], Text = editedText, IsEditable = true, IsTextSearchEnabled = true, #if NET40 IsTextSearchCaseSensitive = false #endif //NET40 }; editBoxCombo_Name.ItemsSource = predefinedCandidates; var panel = new StackPanel(); panel.SetValue(StackPanel.OrientationProperty, Orientation.Vertical); panel.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center); editBoxCombo_Name.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center); panel.Children.Add(editBoxCombo_Name); if (invalidSyntax) { var msg = new TextBlock(new Run("(invalid syntax)")) { Margin = new Thickness(0, 6, 0, 0), Focusable = true, FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], }; panel.Children.Add(msg); } var windowPopup = new PopupModalWindow(m_ShellView, dialogTitle, panel, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 300, 160, null, 40, m_DescriptionPopupModalWindow); windowPopup.EnableEnterKeyDefault = true; editBoxCombo_Name.Loaded += new RoutedEventHandler((sender, ev) => { var textBox = ComboBoxWithAutomationPeer.GetTextBox(editBoxCombo_Name); if (textBox != null) { textBox.FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"]; textBox.SelectAll(); } FocusHelper.FocusBeginInvoke(editBoxCombo_Name); }); WatermarkComboBoxBehavior.SetEnableWatermark(editBoxCombo_Name, true); WatermarkComboBoxBehavior.SetLabel(editBoxCombo_Name, TEXTFIELD_WATERMARK); Style style = (Style)Application.Current.Resources[@"WatermarkTextBoxStyle"]; WatermarkComboBoxBehavior.SetLabelStyle(editBoxCombo_Name, style); windowPopup.ShowModal(); WatermarkComboBoxBehavior.SetEnableWatermark(editBoxCombo_Name, false); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { string str = editBoxCombo_Name.Text == null ? "" : editBoxCombo_Name.Text.Trim(); //if (string.IsNullOrEmpty(str)) //{ // return ""; //} return(str); } return(null); } }
private void OnClick_ButtonExport(object sender, RoutedEventArgs e) { m_Logger.Log("DescriptionView.OnClick_ButtonExport", Category.Debug, Priority.Medium); Tuple <TreeNode, TreeNode> selection = m_Session.GetTreeNodeSelection(); TreeNode node = selection.Item2 ?? selection.Item1; if (node == null || node.GetAlternateContentProperty() == null || node.GetImageMedia() == null || !(node.GetImageMedia() is ManagedImageMedia)) { return; } SampleRate sampleRate = SampleRate.Hz22050; sampleRate = Urakawa.Settings.Default.AudioExportSampleRate; bool encodeToMp3 = true; encodeToMp3 = Urakawa.Settings.Default.AudioExportEncodeToMp3; var combo = new ComboBox { Margin = new Thickness(0, 0, 0, 12) }; ComboBoxItem item1 = new ComboBoxItem(); item1.Content = AudioLib.SampleRate.Hz11025.ToString(); combo.Items.Add(item1); ComboBoxItem item2 = new ComboBoxItem(); item2.Content = AudioLib.SampleRate.Hz22050.ToString(); combo.Items.Add(item2); ComboBoxItem item3 = new ComboBoxItem(); item3.Content = AudioLib.SampleRate.Hz44100.ToString(); combo.Items.Add(item3); switch (sampleRate) { case AudioLib.SampleRate.Hz11025: { combo.SelectedItem = item1; combo.Text = item1.Content.ToString(); break; } case AudioLib.SampleRate.Hz22050: { combo.SelectedItem = item2; combo.Text = item2.Content.ToString(); break; } case AudioLib.SampleRate.Hz44100: { combo.SelectedItem = item3; combo.Text = item3.Content.ToString(); break; } } var checkBox = new CheckBox { IsThreeState = false, IsChecked = encodeToMp3, HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, }; var label_ = new TextBlock { Text = Tobi_Plugin_Urakawa_Lang.ExportEncodeMp3, Margin = new Thickness(8, 0, 8, 0), HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var panel__ = new StackPanel { Orientation = System.Windows.Controls.Orientation.Horizontal, HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, }; panel__.Children.Add(label_); panel__.Children.Add(checkBox); var panel_ = new StackPanel { Orientation = System.Windows.Controls.Orientation.Vertical, HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, }; panel_.Children.Add(combo); panel_.Children.Add(panel__); var windowPopup_ = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_Urakawa_Lang.ExportSettings), panel_, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, false, 300, 180, null, 40, m_DescriptionPopupModalWindow); windowPopup_.EnableEnterKeyDefault = true; windowPopup_.ShowModal(); if (!PopupModalWindow.IsButtonOkYesApply(windowPopup_.ClickedDialogButton)) { return; } encodeToMp3 = checkBox.IsChecked.Value; Urakawa.Settings.Default.AudioExportEncodeToMp3 = checkBox.IsChecked.Value; if (combo.SelectedItem == item1) { sampleRate = SampleRate.Hz11025; Urakawa.Settings.Default.AudioExportSampleRate = sampleRate; } else if (combo.SelectedItem == item2) { sampleRate = SampleRate.Hz22050; Urakawa.Settings.Default.AudioExportSampleRate = sampleRate; } else if (combo.SelectedItem == item3) { sampleRate = SampleRate.Hz44100; Urakawa.Settings.Default.AudioExportSampleRate = sampleRate; } string rootFolder = Path.GetDirectoryName(m_Session.DocumentFilePath); var dlg = new FolderBrowserDialog { RootFolder = Environment.SpecialFolder.MyComputer, SelectedPath = rootFolder, ShowNewFolderButton = true, Description = @"Tobi: " + UserInterfaceStrings.EscapeMnemonic("Export DIAGRAM XML") }; DialogResult result = DialogResult.Abort; m_ShellView.DimBackgroundWhile(() => { result = dlg.ShowDialog(); }); if (result != DialogResult.OK && result != DialogResult.Yes) { return; } if (!Directory.Exists(dlg.SelectedPath)) { return; } ManagedImageMedia managedImage = (ManagedImageMedia)node.GetImageMedia(); string exportImageName = //Path.GetFileName FileDataProvider.EliminateForbiddenFileNameCharacters (managedImage.ImageMediaData.OriginalRelativePath) ; string imageDescriptionDirectoryPath = Daisy3_Export.GetAndCreateImageDescriptionDirectoryPath(false, exportImageName, dlg.SelectedPath); if (Directory.Exists(imageDescriptionDirectoryPath)) { if (!m_Session.askUserConfirmOverwriteFileFolder(imageDescriptionDirectoryPath, true, m_DescriptionPopupModalWindow)) { return; } FileDataProvider.TryDeleteDirectory(imageDescriptionDirectoryPath, true); } FileDataProvider.CreateDirectory(imageDescriptionDirectoryPath); PCMFormatInfo audioFormat = node.Presentation.MediaDataManager.DefaultPCMFormat; AudioLibPCMFormat pcmFormat = audioFormat.Data; if ((ushort)sampleRate != pcmFormat.SampleRate) { pcmFormat.SampleRate = (ushort)sampleRate; } Application.Current.MainWindow.Cursor = Cursors.Wait; this.Cursor = Cursors.Wait; //m_ShellView try { string descriptionFile = Daisy3_Export.CreateImageDescription( Urakawa.Settings.Default.AudioCodecDisableACM, pcmFormat, encodeToMp3, 0, imageDescriptionDirectoryPath, exportImageName, node.GetAlternateContentProperty(), null, null, null); } finally { Application.Current.MainWindow.Cursor = Cursors.Arrow; this.Cursor = Cursors.Arrow; //m_ShellView } m_ShellView.ExecuteShellProcess(imageDescriptionDirectoryPath); }
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(); } }
/// <summary> /// モーダルウインドウを表示させる /// </summary> private void PopupModalWindow() { var win = new PopupModalWindow(); win.ShowDialog(); // モーダルとして表示する }
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 bool doImport() { m_Logger.Log(String.Format(@"UrakawaSession.doImport() [{0}]", DocumentFilePath), Category.Debug, Priority.Medium); string ext = Path.GetExtension(DocumentFilePath); if (".opf".Equals(ext, StringComparison.OrdinalIgnoreCase)) { int levelsUp = 0; string parentDir = Path.GetDirectoryName(DocumentFilePath); DirectoryInfo parentDirInfo = new DirectoryInfo(parentDir); tryAgain: levelsUp++; #if NET40 IEnumerable <DirectoryInfo> metaInfDirs = parentDirInfo.EnumerateDirectories("META-INF", SearchOption.TopDirectoryOnly); #else DirectoryInfo[] metaInfDirs = parentDirInfo.GetDirectories("META-INF", SearchOption.TopDirectoryOnly); #endif bool found = false; foreach (DirectoryInfo dirInfo in metaInfDirs) { string containerXml = Path.Combine(dirInfo.FullName, "container.xml"); if (File.Exists(containerXml)) { DocumentFilePath = containerXml; ext = Path.GetExtension(DocumentFilePath); found = true; break; } } if (!found && levelsUp <= 2 && parentDirInfo.Parent != null) { parentDirInfo = parentDirInfo.Parent; goto tryAgain; } } if (DataProviderFactory.EPUB_EXTENSION.Equals(ext, StringComparison.OrdinalIgnoreCase)) { checkEpub(DocumentFilePath, null); } else if (DataProviderFactory.XML_EXTENSION.Equals(ext, StringComparison.OrdinalIgnoreCase) && FileDataProvider.NormaliseFullFilePath(DocumentFilePath).IndexOf( @"META-INF" //+ Path.DirectorySeparatorChar + '/' + @"container.xml" , StringComparison.OrdinalIgnoreCase) >= 0 //DocumentFilePath.IndexOf("container.xml", StringComparison.OrdinalIgnoreCase) >= 0 ) { string parentDir = Path.GetDirectoryName(DocumentFilePath); DirectoryInfo dirInfo = new DirectoryInfo(parentDir); if (dirInfo.Parent != null) { string checkEpubPath = dirInfo.Parent.FullName; checkEpub(checkEpubPath, "exp"); } } else if (".opf".Equals(ext, StringComparison.OrdinalIgnoreCase)) { if (!checkDAISY(DocumentFilePath)) { //checkEpub(DocumentFilePath, "opf"); assume container.xml was found (see above) } } else if (DataProviderFactory.HTML_EXTENSION.Equals(ext, StringComparison.OrdinalIgnoreCase) || DataProviderFactory.XHTML_EXTENSION.Equals(ext, StringComparison.OrdinalIgnoreCase)) { //MessageBox.Show messageBoxAlert("WARNING: single HTML import is an experimental and incomplete EPUB feature!", null); checkEpub(DocumentFilePath, "xhtml"); } else if (DataProviderFactory.XML_EXTENSION.Equals(ext, StringComparison.OrdinalIgnoreCase)) { //checkDAISY(DocumentFilePath); if (false && // TODO: Pipeline 2 with better support for DTBOOK validation (currently skips metadata values) askUser("DAISY Check?", DocumentFilePath)) { string pipeline_ExePath = obtainPipelineExe(); if (!string.IsNullOrEmpty(pipeline_ExePath)) { string outDir = Path.GetDirectoryName(DocumentFilePath); outDir = Path.Combine(outDir, Path.GetFileName(DocumentFilePath) + "_PIPEVAL"); bool success = false; Func <String, String> checkErrorsOrWarning = (string report) => { if (report.IndexOf("[DP2] DONE", StringComparison.Ordinal) < 0) { return("Pipeline job doesn't appear to have completed?"); } string reportFile = Path.Combine(outDir, "report.xhtml"); if (File.Exists(reportFile)) { string reportXmlSource = File.ReadAllText(reportFile); if (!string.IsNullOrEmpty(reportXmlSource)) { string xmlInfo = ""; XmlDocument xmlDoc = XmlReaderWriterHelper.ParseXmlDocumentFromString(reportXmlSource, false, false); IEnumerable <XmlNode> lis = XmlDocumentHelper.GetChildrenElementsOrSelfWithName( xmlDoc.DocumentElement, true, "li", null, false); foreach (XmlNode li in lis) { if (li.Attributes == null) { continue; } XmlNode classAttr = li.Attributes.GetNamedItem("class"); if (classAttr == null || classAttr.Value != "error") { continue; } xmlInfo += li.InnerText; xmlInfo += Environment.NewLine; } if (string.IsNullOrEmpty(xmlInfo)) { success = true; return(null); } return(xmlInfo); } } success = true; return(null); }; try { string workingDir = Path.GetDirectoryName(pipeline_ExePath); //Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); executeProcess( workingDir, "DAISY Pipeline (validation)", //"\"" + pipeline_ExePath //+ "\"" , "dtbook-validator " + "--i-source \"" + DocumentFilePath + "\" " + "--x-output-dir \"" + outDir + "\" ", checkErrorsOrWarning); } catch (Exception ex) { messageBoxText("Oops :(", "Problem running DAISY Pipeline (validation)!", ex.Message + Environment.NewLine + ex.StackTrace); } if (Directory.Exists(outDir)) { //m_ShellView.ExecuteShellProcess(outDir); FileDataProvider.TryDeleteDirectory(outDir, false); } } } } string outputDirectory = Path.Combine( Path.GetDirectoryName(DocumentFilePath), Daisy3_Import.GetXukDirectory(DocumentFilePath)); //string xukPath = Daisy3_Import.GetXukFilePath(outputDirectory, DocumentFilePath); //if (File.Exists(xukPath)) if (Directory.Exists(outputDirectory)) { if (!askUserConfirmOverwriteFileFolder(outputDirectory, true, null)) { return(false); } FileDataProvider.TryDeleteDirectory(outputDirectory, true); } var combo = new ComboBox { Margin = new Thickness(0, 0, 0, 0), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, }; ComboBoxItem item1 = new ComboBoxItem(); item1.Content = AudioLib.SampleRate.Hz11025.ToString(); combo.Items.Add(item1); ComboBoxItem item2 = new ComboBoxItem(); item2.Content = AudioLib.SampleRate.Hz22050.ToString(); combo.Items.Add(item2); ComboBoxItem item3 = new ComboBoxItem(); item3.Content = AudioLib.SampleRate.Hz44100.ToString(); combo.Items.Add(item3); switch (Settings.Default.AudioProjectSampleRate) { case AudioLib.SampleRate.Hz11025: { combo.SelectedItem = item1; combo.Text = item1.Content.ToString(); break; } case AudioLib.SampleRate.Hz22050: { combo.SelectedItem = item2; combo.Text = item2.Content.ToString(); break; } case AudioLib.SampleRate.Hz44100: { combo.SelectedItem = item3; combo.Text = item3.Content.ToString(); break; } } var label_ = new TextBlock { Text = Tobi_Plugin_Urakawa_Lang.Stereo, Margin = new Thickness(0, 0, 8, 0), HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var checkBox = new CheckBox { IsThreeState = false, IsChecked = Settings.Default.AudioProjectStereo, HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, }; var panel__ = new StackPanel { Orientation = System.Windows.Controls.Orientation.Horizontal, HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 8, 0, 22), }; panel__.Children.Add(label_); panel__.Children.Add(checkBox); var label = new TextBlock { Text = Tobi_Plugin_Urakawa_Lang.UseSourceAudioFormat, Margin = new Thickness(0, 0, 8, 0), HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap }; var checkAuto = new CheckBox { IsThreeState = false, IsChecked = false, HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, }; var panel_ = new StackPanel { Orientation = System.Windows.Controls.Orientation.Horizontal, HorizontalAlignment = System.Windows.HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 0, 12), }; panel_.Children.Add(label); panel_.Children.Add(checkAuto); var panel = new StackPanel { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, }; panel.Children.Add(combo); panel.Children.Add(panel__); panel.Children.Add(panel_); //var line = new Separator() //{ // Margin = new Thickness(0, 8, 0, 8), //}; //line.HorizontalAlignment = HorizontalAlignment.Stretch; //line.VerticalAlignment = VerticalAlignment.Center; //panel.Children.Add(line); var details = new TextBoxReadOnlyCaretVisible { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], BorderThickness = new Thickness(1), Padding = new Thickness(6), TextReadOnly = Tobi_Plugin_Urakawa_Lang.UseSourceAudioFormatTip }; var windowPopup = new PopupModalWindow(m_ShellView, UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_Urakawa_Lang.ProjectAudioFormat), panel, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, false, 320, 200, details, 40, null); windowPopup.EnableEnterKeyDefault = true; windowPopup.ShowModal(); if (!PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { return(false); } Settings.Default.AudioProjectStereo = checkBox.IsChecked.Value; if (combo.SelectedItem == item1) { Settings.Default.AudioProjectSampleRate = SampleRate.Hz11025; } else if (combo.SelectedItem == item2) { Settings.Default.AudioProjectSampleRate = SampleRate.Hz22050; } else if (combo.SelectedItem == item3) { Settings.Default.AudioProjectSampleRate = SampleRate.Hz44100; } var converter = new Daisy3_Import(DocumentFilePath, outputDirectory, IsAcmCodecsDisabled, Settings.Default.AudioProjectSampleRate, Settings.Default.AudioProjectStereo, checkAuto.IsChecked.Value, Settings.Default.XUK_PrettyFormat ); //Directory.GetParent(bookfile).FullName //converter.VerifyHtml5OutliningAlgorithmUsingPipelineTestSuite(); bool cancelled = false; bool error = m_ShellView.RunModalCancellableProgressTask(true, Tobi_Plugin_Urakawa_Lang.Importing, converter, () => { cancelled = true; DocumentFilePath = null; DocumentProject = null; }, () => { cancelled = false; if (string.IsNullOrEmpty(converter.XukPath)) { return; } //DocumentFilePath = converter.XukPath; //DocumentProject = converter.Project; //AddRecentFile(new Uri(DocumentFilePath, UriKind.Absolute)); }); if (!cancelled) { //DebugFix.Assert(!report); string xukPath = converter.XukPath; if (string.IsNullOrEmpty(xukPath)) { return(false); } string projectDir = Path.GetDirectoryName(xukPath); DebugFix.Assert(outputDirectory == projectDir); string title = converter.GetTitle(); if (!string.IsNullOrEmpty(title)) { string fileName = Daisy3_Import.GetXukFilePath(projectDir, DocumentFilePath, title, false); fileName = Path.GetFileNameWithoutExtension(fileName); string parent = Path.GetDirectoryName(projectDir); //string fileName = Path.GetFileNameWithoutExtension(xukPath); ////while (fileName.StartsWith("_")) ////{ //// fileName = fileName.Substring(1, fileName.Length - 1); ////} //char[] chars = new char[] { '_' }; //fileName = fileName.TrimStart(chars); string newProjectDir = Path.Combine(parent, fileName); // + Daisy3_Import.XUK_DIR if (newProjectDir != projectDir) { bool okay = true; if (Directory.Exists(newProjectDir)) { if (askUserConfirmOverwriteFileFolder(newProjectDir, true, null)) { try { FileDataProvider.TryDeleteDirectory(newProjectDir, false); } catch (Exception ex) { #if DEBUG Debugger.Break(); #endif // DEBUG Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); okay = false; } } else { okay = false; } } if (okay) { Directory.Move(projectDir, newProjectDir); xukPath = Path.Combine(newProjectDir, Path.GetFileName(xukPath)); } } } DocumentFilePath = null; DocumentProject = null; try { OpenFile(xukPath); } catch (Exception ex) { ExceptionHandler.Handle(ex, false, m_ShellView); return(false); } } return(!cancelled); }
public string messageBoxFilePick(string title, string exeOrBat) { m_Logger.Log(@"UrakawaSession_Save.messageBoxFilePick", Category.Debug, Priority.Medium); string ext = Path.GetExtension(exeOrBat); PopupModalWindow windowPopup = null; //var textArea = new TextBoxReadOnlyCaretVisible() //{ // FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], // TextReadOnly = info, // BorderThickness = new Thickness(1), // Padding = new Thickness(6), // HorizontalAlignment = HorizontalAlignment.Stretch, // VerticalAlignment = VerticalAlignment.Stretch, // Focusable = true, // TextWrapping = TextWrapping.Wrap //}; //var scroll = new ScrollViewer //{ // Content = textArea, // Margin = new Thickness(6), // VerticalScrollBarVisibility = ScrollBarVisibility.Visible, // HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled //}; var fileText = new TextBoxReadOnlyCaretVisible { FocusVisualStyle = (Style)Application.Current.Resources["MyFocusVisualStyle"], BorderThickness = new Thickness(1), BorderBrush = SystemColors.ControlDarkDarkBrush, //Padding = new Thickness(6), TextReadOnly = " ", //IsReadOnly = true, Width = 300, Margin = new Thickness(0, 8, 0, 0), Padding = new Thickness(4), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Focusable = true, TextWrapping = TextWrapping.Wrap }; //fileText.SetValue(KeyboardNavigation.TabIndexProperty, 12); KeyboardNavigation.SetTabIndex(fileText, 12); var label = new TextBlock { Text = "Please locate [" + exeOrBat + "]", Margin = new Thickness(0, 0, 8, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, Focusable = true, TextWrapping = TextWrapping.Wrap, FontWeight = FontWeights.Bold, }; //label.SetValue(KeyboardNavigation.TabIndexProperty, 10); KeyboardNavigation.SetTabIndex(label, 10); var fileButton = new Button() { Content = "Browse...", Margin = new Thickness(0, 0, 0, 0), Padding = new Thickness(8, 0, 8, 0), }; //fileButton.SetValue(KeyboardNavigation.TabIndexProperty, 11); KeyboardNavigation.SetTabIndex(fileButton, 11); fileButton.Click += (sender, e) => { var dlg_ = new Microsoft.Win32.OpenFileDialog { FileName = exeOrBat, DefaultExt = ext, Filter = @"Executable (*" + ext + ")|*" + ext + "", CheckFileExists = false, CheckPathExists = false, AddExtension = true, DereferenceLinks = true, Title = @"Tobi: " + "Pipeline2 (" + exeOrBat + ")" }; bool?result_ = false; m_ShellView.DimBackgroundWhile( () => { result_ = dlg_.ShowDialog(); } , windowPopup ); if (result_ == true) { fileText.TextReadOnly = dlg_.FileName; } }; var filePanel = new DockPanel { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, LastChildFill = true }; //fileButton.SetValue(DockPanel.DockProperty, Dock.Right); DockPanel.SetDock(fileButton, Dock.Right); filePanel.Children.Add(fileButton); filePanel.Children.Add(label); var panel = new StackPanel { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; panel.Children.Add(filePanel); panel.Children.Add(fileText); //panel.Margin = new Thickness(8, 8, 8, 0); windowPopup = new PopupModalWindow(m_ShellView, title, panel, PopupModalWindow.DialogButtonsSet.OkCancel, PopupModalWindow.DialogButton.Ok, true, 380, 200, null, //scroll, 300, null); windowPopup.ShowModal(); if (PopupModalWindow.IsButtonOkYesApply(windowPopup.ClickedDialogButton)) { return(fileText.TextReadOnly); } return(null); }
private void DisplayPreviewIconsDebugCommand_Executed() { m_Logger.Log("ShellView.DisplayPreviewIconsDebugCommand_Executed", Category.Debug, Priority.Medium); var resourceKeys = new[] { "accessories-calculator", "accessories-character-map", "accessories-text-editor", "address-book-new", "application-certificate", "application-x-executable", "applications-accessories", "applications-development", "applications-games", "applications-graphics", "applications-internet", "applications-multimedia", "applications-office", "applications-other", "applications-system", "appointment-new", "audio-card", "audio-input-microphone", "audio-volume-high", "audio-volume-low", "audio-volume-medium", "audio-volume-muted", "audio-x-generic", "battery-caution", "battery", "bookmark-new", "camera-photo", "camera-video", "computer", "contact-new", "dialog-error", "dialog-information", "dialog-warning", "document-new", "document-open", "document-print-preview", "document-print", "document-properties", "document-save-as", "document-save", "drive-harddisk", "drive-optical", "drive-removable-media", "edit-clear", "edit-copy", "edit-cut", "edit-delete", "edit-delete_", "edit-find-replace", "edit-find", "edit-paste", "edit-redo", "edit-select-all", "edit-undo", "emblem-favorite", "emblem-important", "emblem-photos", "emblem-readonly", "emblem-symbolic-link", "emblem-system", "emblem-unreadable", "face-angel", "face-crying", "face-devilish", "face-glasses", "face-grin", "face-kiss", "face-monkey", "face-plain", "face-sad", "face-smile-big", "face-smile", "face-surprise", "face-wink", "folder-drag-accept", "folder-new", "folder-open", "folder-remote", "folder-saved-search", "folder-visiting", "folder", "font-x-generic", "format-indent-less", "format-indent-more", "format-justify-center", "format-justify-fill", "format-justify-left", "format-justify-right", "format-text-bold", "format-text-italic", "format-text-strikethrough", "format-text-underline", "go-bottom", "go-down", "go-first", "go-home", "go-jump", "go-last", "go-next", "go-previous", "go-top", "go-up", "help-browser", "image-loading", "image-missing", "image-x-generic", "input-gaming", "input-keyboard", "input-mouse", "internet-group-chat", "internet-mail", "internet-news-reader", "internet-web-browser", "list-add", "list-remove", "mail-attachment", "mail-forward", "mail-mark-junk", "mail-mark-not-junk", "mail-message-new", "mail-reply-all", "mail-reply-sender", "mail-send-receive", "media-eject", "media-flash", "media-floppy", "media-optical", "media-playback-pause", "media-playback-start", "media-playback-stop", "media-record", "media-seek-backward", "media-seek-forward", "media-skip-backward", "media-skip-forward", "multimedia-player", "network-error", "network-idle", "network-offline", "network-receive", "network-server", "network-transmit-receive", "network-transmit", "network-wired", "network-wireless-encrypted", "network-wireless", "network-workgroup", "office-calendar", "package-x-generic", "preferences-desktop-accessibility", "preferences-desktop-assistive-technology", "preferences-desktop-font", "preferences-desktop-keyboard-shortcuts", "preferences-desktop-locale", "preferences-desktop-multimedia", "preferences-desktop-peripherals", "preferences-desktop-remote-desktop", "preferences-desktop-screensaver", "preferences-desktop-theme", "preferences-desktop-wallpaper", "preferences-desktop", "preferences-system-network-proxy", "preferences-system-session", "preferences-system-windows", "preferences-system", "printer-error", "printer", "process-stop", "software-update-available", "software-update-urgent", "start-here", "system-file-manager", "system-installer", "system-lock-screen", "system-log-out", "system-search", "system-shutdown", "system-software-update", "system-users", "tab-new", "text-html", "text-x-generic-template", "text-x-generic", "text-x-script", "user-desktop", "user-home", "user-trash-full", "user-trash", "utilities-system-monitor", "utilities-terminal", "video-display", "video-x-generic", "view-fullscreen", "view-refresh", "weather-clear-night", "weather-clear", "weather-few-clouds-night", "weather-few-clouds", "weather-overcast", "weather-severe-alert", "weather-showers-scattered", "weather-showers", "weather-snow", "weather-storm", "window-new", "x-office-address-book", "x-office-calendar", "x-office-document-template", "x-office-document", "x-office-drawing-template", "x-office-drawing", "x-office-presentation-template", "x-office-presentation", "x-office-spreadsheet-template", "x-office-spreadsheet" }; var resourceKeys2 = new[] { "Neu_accessories-archiver", "Neu_accessories-character-map", "Neu_accessories-text-editor", "Neu_address-book-new", "Neu_application-certificate", "Neu_application-x-executable", "Neu_applications-accessories", "Neu_applications-development", "Neu_applications-games", "Neu_applications-graphics", "Neu_applications-internet", "Neu_applications-multimedia", "Neu_applications-office", "Neu_applications-other", "Neu_applications-system", "Neu_appointment-new", "Neu_audio-volume-high", "Neu_audio-volume-low", "Neu_audio-volume-medium", "Neu_audio-volume-muted", "Neu_audio-volume-zero", "Neu_audio-x-generic", "Neu_battery-caution", "Neu_battery", "Neu_bookmark-new", "Neu_computer", "Neu_contact-new", "Neu_dialog-cancel", "Neu_dialog-close", "Neu_dialog-error", "Neu_dialog-information", "Neu_dialog-ok", "Neu_dialog-password", "Neu_dialog-question", "Neu_dialog-warning", "Neu_document-new", "Neu_document-open", "Neu_document-print-preview", "Neu_document-print", "Neu_document-properties", "Neu_document-save-as", "Neu_document-save", "Neu_drive-cdrom", "Neu_drive-harddisk", "Neu_drive-removable-media", "Neu_edit-clear", "Neu_edit-copy", "Neu_edit-cut", "Neu_edit-delete", "Neu_edit-find-replace", "Neu_edit-find", "Neu_edit-paste", "Neu_edit-redo", "Neu_edit-select-all", "Neu_edit-undo", "Neu_emblem-important", "Neu_emblem-pictures", "Neu_emblem-readonly", "Neu_emblem-symbolic-link", "Neu_emblem-system", "Neu_emblem-unreadable", "Neu_emblem-web", "Neu_empty", "Neu_epiphany-bookmarks", "Neu_evolution", "Neu_folder-drag-accept", "Neu_folder-new", "Neu_folder-open", "Neu_folder-remote", "Neu_folder-saved-search", "Neu_folder-visiting", "Neu_folder", "Neu_font-x-generic", "Neu_format-indent-less", "Neu_format-indent-more", "Neu_format-justify-center", "Neu_format-justify-fill", "Neu_format-justify-left", "Neu_format-justify-right", "Neu_format-text-bold", "Neu_format-text-italic", "Neu_format-text-underline", "Neu_gaim", "Neu_gimp", "Neu_go-bottom", "Neu_go-down", "Neu_go-first", "Neu_go-home", "Neu_go-jump", "Neu_go-last", "Neu_go-next", "Neu_go-previous", "Neu_go-top", "Neu_go-up", "Neu_graphics-image-editor", "Neu_graphics-image-viewer", "Neu_graphics-svg-editor", "Neu_help-about", "Neu_help-browser", "Neu_image-loading", "Neu_image-missing", "Neu_image-x-generic", "Neu_input-keyboard", "Neu_input-mouse", "Neu_internet-ftp-client", "Neu_internet-group-chat", "Neu_internet-mail", "Neu_internet-web-browser", "Neu_list-add", "Neu_list-remove", "Neu_mail-forward", "Neu_mail-message-new", "Neu_mail-reply-all", "Neu_mail-reply-sender", "Neu_mail-send-receive", "Neu_media-cdrom-audio", "Neu_media-cdrom", "Neu_media-cdrw", "Neu_media-dvd", "Neu_media-dvdrw", "Neu_media-floppy", "Neu_misc-cd-image", "Neu_multimedia-volume-control", "Neu_network-error", "Neu_network-idle", "Neu_network-offline", "Neu_network-receive", "Neu_network-server", "Neu_network-transmit-receive", "Neu_network-transmit", "Neu_network-workgroup", "Neu_package-x-generic", "Neu_preferences-desktop-accessibility", "Neu_preferences-desktop-assistive-technology", "Neu_preferences-desktop-font", "Neu_preferences-desktop-peripherals", "Neu_preferences-desktop-remote-desktop", "Neu_preferences-desktop-screensaver", "Neu_preferences-desktop-wallpaper", "Neu_preferences-desktop", "Neu_preferences-system-network-proxy", "Neu_preferences-system-session", "Neu_preferences-system-windows", "Neu_preferences-system", "Neu_preferences-user-information", "Neu_printer-error", "Neu_printer", "Neu_process-stop", "Neu_sound-juicer", "Neu_start-here", "Neu_system-file-manager", "Neu_system-installer", "Neu_system-lock-screen", "Neu_system-log-out", "Neu_system-search", "Neu_system-shutdown", "Neu_system-software-update", "Neu_system-users", "Neu_text-html", "Neu_text-x-generic", "Neu_text-x-script", "Neu_text-x-source", "Neu_user-desktop", "Neu_user-home", "Neu_user-trash-full", "Neu_user-trash", "Neu_utilities-system-monitor", "Neu_utilities-terminal", "Neu_video-display", "Neu_video-x-generic", "Neu_view-refresh", "Neu_window-new", "Neu_x-office-address-book", "Neu_x-office-document", "Neu_x-office-spreadsheet" }; var resourceKeys3 = new[] { "Gion_accessories-archiver", "Gion_application-certificate", "Gion_applications-internet", "Gion_audio-x-generic", "Gion_bookmark-new", "Gion_computer", "Gion_document-open", "Gion_drive-harddisk", "Gion_drive-removable-media", "Gion_evolution", "Gion_folder-drag-accept", "Gion_folder-open", "Gion_folder-remote", "Gion_folder-saved-search", "Gion_folder-visiting", "Gion_folder", "Gion_go-down", "Gion_go-next", "Gion_go-previous", "Gion_go-up", "Gion_image-x-generic", "Gion_internet-mail", "Gion_internet-web-browser", "Gion_media-cdrom-audio", "Gion_media-cdrom", "Gion_media-cdrw", "Gion_media-dvd", "Gion_media-dvdrw", "Gion_music-player", "Gion_package-x-generic", "Gion_process-stop", "Gion_text-html", "Gion_text-x-authors", "Gion_text-x-changelog", "Gion_text-x-copying", "Gion_text-x-generic", "Gion_text-x-install", "Gion_text-x-readme", "Gion_text-x-script", "Gion_text-x-source", "Gion_user-desktop", "Gion_user-home", "Gion_user-trash-full", "Gion_user-trash", "Gion_utilities-terminal", "Gion_view-refresh", "Gion_x-office-document", "Gion_x-office-spreadsheet" }; var resourceKeys4 = new[] { "Foxtrot_computer", "Foxtrot_document-open", "Foxtrot_folder-accept", "Foxtrot_folder-drag-accept", "Foxtrot_folder-new", "Foxtrot_folder-open", "Foxtrot_folder-remote", "Foxtrot_folder", "Foxtrot_gnome-fs-accept", "Foxtrot_gnome-fs-desktop", "Foxtrot_gnome-fs-trash-full", "Foxtrot_go-bottom", "Foxtrot_go-down", "Foxtrot_go-first", "Foxtrot_go-home", "Foxtrot_go-last", "Foxtrot_go-next", "Foxtrot_go-previous", "Foxtrot_go-top", "Foxtrot_go-up", "Foxtrot_list-add", "Foxtrot_list-remove", "Foxtrot_network-workgroup", "Foxtrot_preferences-system", "Foxtrot_system-search", "Foxtrot_user-desktop", "Foxtrot_user-home-folder", "Foxtrot_user-home", "Foxtrot_user-trash-full", "Foxtrot_user-trash", "Foxtrot_video-display", "Foxtrot_view-refresh", "Foxtrot_x-directory-drag-accept", "Foxtrot_x-directory-normal-accept", "Foxtrot_x-directory-normal-open", "Foxtrot_x-directory-normal", "Foxtrot_x-directory-remote" }; if (m_listOfIconRichCommands.Count == 0) { foreach (string resourceKey in resourceKeys) { var command = new RichDelegateCommand(resourceKey, resourceKey, null, LoadTangoIcon(resourceKey), null, () => true); m_listOfIconRichCommands.Add(command); command.SetIconProviderDrawScale(Settings.Default.WindowMagnificationLevel); } } if (m_listOfIconRichCommands2.Count == 0) { foreach (string resourceKey2 in resourceKeys2) { var command = new RichDelegateCommand(resourceKey2, resourceKey2, null, LoadGnomeNeuIcon(resourceKey2), null, () => true); m_listOfIconRichCommands2.Add(command); command.SetIconProviderDrawScale(Settings.Default.WindowMagnificationLevel); } } if (m_listOfIconRichCommands3.Count == 0) { foreach (string resourceKey3 in resourceKeys3) { var command = new RichDelegateCommand(resourceKey3, resourceKey3, null, LoadGnomeGionIcon(resourceKey3), null, () => true); m_listOfIconRichCommands3.Add(command); command.SetIconProviderDrawScale(Settings.Default.WindowMagnificationLevel); } } if (m_listOfIconRichCommands4.Count == 0) { foreach (string resourceKey4 in resourceKeys4) { var command = new RichDelegateCommand(resourceKey4, resourceKey4, null, LoadGnomeFoxtrotIcon(resourceKey4), null, () => true); m_listOfIconRichCommands4.Add(command); command.SetIconProviderDrawScale(Settings.Default.WindowMagnificationLevel); } } var windowPopup = new PopupModalWindow(this, UserInterfaceStrings.IconsDebug, new IconsPreviewDebug(this), PopupModalWindow.DialogButtonsSet.Ok, PopupModalWindow.DialogButton.Ok, true, 500, 600); windowPopup.ShowFloating(() => { m_listOfIconRichCommands.Clear(); m_listOfIconRichCommands2.Clear(); m_listOfIconRichCommands3.Clear(); m_listOfIconRichCommands4.Clear(); }); }
//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); }
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); }