private Inline GetInlineWithStyling( string line, System.Drawing.FontStyle style )
        {
            Inline styledText = new Run( line );
            if ( style.HasFlag( System.Drawing.FontStyle.Bold ) )
                styledText = new Bold( styledText );

            if ( style.HasFlag( System.Drawing.FontStyle.Italic ) )
                styledText = new Italic( styledText );

            if ( style.HasFlag( System.Drawing.FontStyle.Underline ) )
                styledText = new Underline( styledText );

            return styledText;
        }
        protected override bool ProcessDialogKey( System.Windows.Forms.Keys keyData ) {
            if ( keyData.HasFlag( Keys.O ) && keyData.HasFlag( Keys.Control ) ) {
                var fileToOpen = FindFileDialog();
                if ( fileToOpen != null && File.Exists( fileToOpen ) ) {
                    string loadedString = File.ReadAllText( fileToOpen );
                    SetDocumentTo( loadedString );
                }
                return true;
            }

            if ( keyData.HasFlag( Keys.S ) && keyData.HasFlag( Keys.Control ) ) {
                var fileSavior = _browser.StringByEvaluatingJavaScriptFromString("");
            }
            return base.ProcessDialogKey( keyData );
        }
Beispiel #3
0
        internal static new IFileSystemInformation Create(string path, System.IO.FileAttributes attributes, IFileService fileService)
        {
            if (!attributes.HasFlag(System.IO.FileAttributes.Directory)) throw new ArgumentOutOfRangeException(nameof(attributes));

            var info = new DirectoryInformation(fileService);
            info.PopulateData(path, attributes);
            info.fromAttributes = true;

            return info;
        }
 protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
 {
     //The problem addressed here had to do with tab wonkiness with MDI forms.
     //When you tabbed forward through the inner WPF control to the end, the tab focus would jump out of the
     //form and into the next control or MDI child window under the MDI form.
     //As best I could tell, the tab logic was being confused by MDI.
     //The solution used here is to reflect out methods on the KeyboardNavigation class
     //to determine what the next/previous item would be in the tab order.
     //(The exact parameters were gleaned by disassembling the private
     //bool Navigate(DependencyObject currentElement, TraversalRequest request, ModifierKeys modifierKeys, DependencyObject firstElement)
     //method on the KeyboardNavigation class.
     //If the destination element is null, then the end of the tab order had been reached.
     //Instead of relying on the base ProcessCmdKey, specifically tell the IKeyboardInputSink HwndSource
     //to move to the beginning or end of the embedded WPF tab order.
     if (keyData == Keys.Tab)
     {
         var FocusedElement = Keyboard.FocusedElement as UIElement;
         if (FocusedElement != null)
         {
             DependencyObject DestinationElement = null;
             FocusNavigationDirection Direction;
             if (keyData.HasFlag(Keys.Shift))
             {
                 Direction = FocusNavigationDirection.Last;
                 DestinationElement = GetPrevTab(FocusedElement, null, false);
             }
             else
             {
                 Direction = FocusNavigationDirection.First;
                 DestinationElement = GetNextTab(FocusedElement, GetGroupParent(FocusedElement, true), false);
             }
             if (DestinationElement == null)
                 return this.Sink.TabInto(new TraversalRequest(Direction));
         }
     }
     return base.ProcessCmdKey(ref msg, keyData);
 }
Beispiel #5
0
 internal static IFileSystemInformation Create(string path, System.IO.FileAttributes attributes, IFileService fileService)
 {
     if (attributes.HasFlag(System.IO.FileAttributes.Directory))
     {
         return DirectoryInformation.Create(path, attributes, fileService);
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
 protected override bool ProcessDialogKey(System.Windows.Forms.Keys keyData)
 {
     if (keyData == Keys.Tab)
     {
         var FocusedElement = Keyboard.FocusedElement as UIElement;
         if (FocusedElement != null)
         {
             DependencyObject DestinationElement = null;
             FocusNavigationDirection Direction;
             if (keyData.HasFlag(Keys.Shift))
             {
                 Direction = FocusNavigationDirection.Last;
                 DestinationElement = GetPrevTab(FocusedElement, null, false);
             }
             else
             {
                 Direction = FocusNavigationDirection.First;
                 DestinationElement = GetNextTab(FocusedElement, GetGroupParent(FocusedElement, true), false);
             }
             if (DestinationElement == null)
             {
                 return this.Sink.TabInto(new TraversalRequest(Direction));
             }
         }
     }
     return base.ProcessDialogKey(keyData);
 }