Example #1
0
        public Highlighting(IHighlightsHelper highlightHelper, IExpressionBuilderWindow expressionBuilder)
        {
            InitializeComponent();

            ExpressionBuilder                    = expressionBuilder;
            this.HighlightHelper                 = highlightHelper;
            this.Patterns                        = highlightHelper.Patterns;
            this.buttonColour.SelectedColour     = ((SolidColorBrush)this.textBoxPattern.Foreground).Color;
            this.buttonBackColour.SelectedColour = ((SolidColorBrush)this.textBoxPattern.Background).Color;
        }
Example #2
0
        public Highlighting(IHighlightsHelper highlightHelper, IExpressionBuilderWindow expressionBuilder)
        {
            InitializeComponent();

            ExpressionBuilder = expressionBuilder;
            this.HighlightHelper = highlightHelper;
            this.Patterns = highlightHelper.Patterns;
            this.buttonColour.SelectedColour = ((SolidColorBrush)this.textBoxPattern.Foreground).Color;
            this.buttonBackColour.SelectedColour = ((SolidColorBrush)this.textBoxPattern.Background).Color;
        }
        /// <summary>
        /// Creates an OxTailFileViewer instance and starts viewing the specified filename.
        /// </summary>
        /// <param name="filename">The full file path of the file to view.</param>
        public FileWatcherTabItem(string filename, IHighlightsHelper hightlightsHelper, IFileWatcher fileWatcher)
            : this()
        {
            this.FileWatcher = fileWatcher;

            this.gridContent.Children.Add((UIElement)this.FileWatcher);

            this.Header = Path.GetFileName(filename);
            this.ToolTip = filename;
            this.Uid = filename;
            this.Visibility = System.Windows.Visibility.Visible;
            this.HighlightsHelper = hightlightsHelper;
            this.FileWatcher.Patterns = this.HighlightsHelper.Patterns;
            this.GotFocus += new RoutedEventHandler(OxTailFileViewer_GotFocus);
            this.FileWatcher.FindFinished += new EventHandler<EventArgs>(fileWatcher_FindFinished);
        }
        /// <summary>
        /// Creates an OxTailFileViewer instance and starts viewing the specified filename.
        /// </summary>
        /// <param name="filename">The full file path of the file to view.</param>
        public FileWatcherTabItem(string filename, IHighlightsHelper hightlightsHelper, IFileWatcher fileWatcher)
            : this()
        {
            this.FileWatcher = fileWatcher;

            this.gridContent.Children.Add((UIElement)this.FileWatcher);

            this.Header                    = Path.GetFileName(filename);
            this.ToolTip                   = filename;
            this.Uid                       = filename;
            this.Visibility                = System.Windows.Visibility.Visible;
            this.HighlightsHelper          = hightlightsHelper;
            this.FileWatcher.Patterns      = this.HighlightsHelper.Patterns;
            this.GotFocus                 += new RoutedEventHandler(OxTailFileViewer_GotFocus);
            this.FileWatcher.FindFinished += new EventHandler <EventArgs>(fileWatcher_FindFinished);
        }
Example #5
0
        public Controls.ITabItem CreateTabItem(string filename, IHighlightsHelper hightlightsHelper)
        {
            IRequest req = Kernel.CreateRequest(typeof(ITabItem), null, new IParameter[] { new Parameter("filename", filename, false), new Parameter("hightlightsHelper", hightlightsHelper, false) }, false, false);

            if (!Kernel.CanResolve(req))
            {
                Kernel.Bind<ITabItem>()
                    .To<FileWatcherTabItem>()
                    .WithConstructorArgument("filename", filename)
                    .WithConstructorArgument("hightlightsHelper", hightlightsHelper);
            }

            ITabItem tab = Kernel.Get<ITabItem>();
            Kernel.Unbind<ITabItem>();

            return tab;
        }
Example #6
0
        public Controls.ITabItem CreateTabItem(string filename, IHighlightsHelper hightlightsHelper)
        {
            IRequest req = Kernel.CreateRequest(typeof(ITabItem), null, new IParameter[] { new Parameter("filename", filename, false), new Parameter("hightlightsHelper", hightlightsHelper, false) }, false, false);

            if (!Kernel.CanResolve(req))
            {
                Kernel.Bind <ITabItem>()
                .To <FileWatcherTabItem>()
                .WithConstructorArgument("filename", filename)
                .WithConstructorArgument("hightlightsHelper", hightlightsHelper);
            }

            ITabItem tab = Kernel.Get <ITabItem>();

            Kernel.Unbind <ITabItem>();

            return(tab);
        }
Example #7
0
        // If DI is about removing all "new" operators from your logic to enable a plugin architecture where
        // every component can be changed in one place and that we must rely on abstraction rather than concretions
        // then everything must implement an interface and be passed in on the constructor (even other windows)
        // Thiscould be useful as for instance: if you wanted to replace the Expression builder then we change it
        // when we load our Ninject Kernel in App.xaml (Via IExpressionBuilderWindowFactory). Then if we called
        // that screen from other windows (such as we do in Find) later on in the stack the change is only in one place
        // I fully intend to remove all "new" operators from this code file as a test to see how plausible it is to do!
        // I have left += new event handlers and any temporary news like StringBuilder
        public MainWindow(RecentFileList recentFileList, ILastOpenFilesData lastOpenFilesData,
                          IHighlightItemData highlightItemData, IWindowFactory windowFactory, IFindWindowFactory findWindowFactory, ISystemTray systemTray,
                          System.Windows.Forms.NotifyIcon notifyIcon, ISaveExpressionMessageWindowFactory saveExpressionMessageWindowFactory,
                          IExpressionBuilderWindowFactory expressionBuilderWindowFactory, IFileFactory fileFactory, ITabItemFactory tabItemFactory, ISettingsHelper settingsHelper,
                          IHighlightWindowFactory highlightWindowFactory, IHighlightsHelper highlightsHelper)
        {
            this.SettingsHelper    = settingsHelper;
            this.LastOpenFilesData = lastOpenFilesData;
            this.recentFileList    = recentFileList;
            this.WindowFactory     = windowFactory;
            this.FindWindowFactory = findWindowFactory;
            this.HighlightItemData = highlightItemData;
            this.SaveExpressionMessageWindowFactory = saveExpressionMessageWindowFactory;
            this.ExpressionBuilderWindowFactory     = expressionBuilderWindowFactory;
            this.SystemTray             = systemTray;
            this.FileFactory            = fileFactory;
            this.TabItemFactory         = tabItemFactory;
            this.HighlightWindowFactory = highlightWindowFactory;
            this.HighlightHelper        = highlightsHelper;

            InitializeComponent();

            this.recentFileList.SubMenuClick += new EventHandler <EventArgs>(recentFileList_SubMenuClick);
            this.MenuItemFile.Items.Insert(2, this.recentFileList);

            // Null Object pattern (http://en.wikipedia.org/wiki/Null_Object_pattern)
            this.OpenWindows   = new List <IWindow>(0);
            this.LastOpenFiles = new List <IFile>(0);

            this.Notify              = notifyIcon;
            this.Notify.Icon         = this.SystemTray.Icon;
            this.Notify.DoubleClick += new EventHandler(Notify_DoubleClick);
            this.Notify.ContextMenu  = this.SystemTray.ContextMenu;

            this.Notify.ContextMenu.MenuItems[0].Click += new EventHandler(disableSoundsMenuItem_Click);
            this.Notify.ContextMenu.MenuItems[1].Click += new EventHandler(minimuseToTrayItem_Click);
            this.Notify.ContextMenu.MenuItems[3].Click += new EventHandler(exitItem_Click);

            this.Notify.Visible = true;
        }
Example #8
0
        // If DI is about removing all "new" operators from your logic to enable a plugin architecture where
        // every component can be changed in one place and that we must rely on abstraction rather than concretions
        // then everything must implement an interface and be passed in on the constructor (even other windows)
        // Thiscould be useful as for instance: if you wanted to replace the Expression builder then we change it
        // when we load our Ninject Kernel in App.xaml (Via IExpressionBuilderWindowFactory). Then if we called
        // that screen from other windows (such as we do in Find) later on in the stack the change is only in one place
        // I fully intend to remove all "new" operators from this code file as a test to see how plausible it is to do!
        // I have left += new event handlers and any temporary news like StringBuilder
        public MainWindow(RecentFileList recentFileList, ILastOpenFilesData lastOpenFilesData,
            IHighlightItemData highlightItemData, IWindowFactory windowFactory, IFindWindowFactory findWindowFactory, ISystemTray systemTray,
            System.Windows.Forms.NotifyIcon notifyIcon, ISaveExpressionMessageWindowFactory saveExpressionMessageWindowFactory,
            IExpressionBuilderWindowFactory expressionBuilderWindowFactory, IFileFactory fileFactory, ITabItemFactory tabItemFactory, ISettingsHelper settingsHelper,
            IHighlightWindowFactory highlightWindowFactory, IHighlightsHelper highlightsHelper)
        {
            this.SettingsHelper = settingsHelper;
            this.LastOpenFilesData = lastOpenFilesData;
            this.recentFileList = recentFileList;
            this.WindowFactory = windowFactory;
            this.FindWindowFactory = findWindowFactory;
            this.HighlightItemData = highlightItemData;
            this.SaveExpressionMessageWindowFactory = saveExpressionMessageWindowFactory;
            this.ExpressionBuilderWindowFactory = expressionBuilderWindowFactory;
            this.SystemTray = systemTray;
            this.FileFactory = fileFactory;
            this.TabItemFactory = tabItemFactory;
            this.HighlightWindowFactory = highlightWindowFactory;
            this.HighlightHelper = highlightsHelper;

            InitializeComponent();

            this.recentFileList.SubMenuClick +=new EventHandler<EventArgs>(recentFileList_SubMenuClick);
            this.MenuItemFile.Items.Insert(2, this.recentFileList);

            // Null Object pattern (http://en.wikipedia.org/wiki/Null_Object_pattern)
            this.OpenWindows = new List<IWindow>(0);
            this.LastOpenFiles = new List<IFile>(0);

            this.Notify = notifyIcon;
            this.Notify.Icon = this.SystemTray.Icon;
            this.Notify.DoubleClick += new EventHandler(Notify_DoubleClick);
            this.Notify.ContextMenu = this.SystemTray.ContextMenu;

            this.Notify.ContextMenu.MenuItems[0].Click += new EventHandler(disableSoundsMenuItem_Click);
            this.Notify.ContextMenu.MenuItems[1].Click += new EventHandler(minimuseToTrayItem_Click);
            this.Notify.ContextMenu.MenuItems[3].Click += new EventHandler(exitItem_Click);

            this.Notify.Visible = true;
        }