public MessageForm( [NotNull] IServiceProvider provider, MessageFormMode mode, MessageInfo message) { if (provider == null) { throw new ArgumentNullException("provider"); } _serviceManager = new ServiceManager(provider); InitializeComponent(); _formMode = mode; _messageInfo = message ?? new MessageInfo(); _previewSourceNum = OutboxManager.RegisterPreviewSource(this); _serviceManager.Publish <IMessageEditorService>( new MessageEditorService(this)); CustomInitializeComponent(); _menuGenerator = new StripMenuGenerator(_serviceManager, _menuStrip, "MessageEditor.Menu"); _toolbarGenerator = new StripMenuGenerator(_serviceManager, _toolStrip, "MessageEditor.Toolbar"); _tagsbarGenerator = new SmilesToolbarGenerator(_serviceManager, "Forum.MessageEditor.TagsBar", _tagsBar); _syntaxExtSvc = provider.GetRequiredService <IEditorSyntaxExtensibilityService>(); }
public TagLineListForm(IServiceProvider provider, IEnumerable <TagLineInfo> tagLines) { if (provider == null) { throw new ArgumentNullException("provider"); } if (tagLines == null) { throw new ArgumentNullException("tagLines"); } _serviceManager = new ServiceManager(provider); _tagLines = new ObservableList <TagLineInfo>(tagLines); InitializeComponent(); _serviceManager.Publish <ITagLineListFormService>(new TagLineListFormService(this)); _serviceManager.Publish <IDefaultCommandService>(new DefaultCommandService("Janus.Forum.TagLine.Edit")); _toolbarGenerator = new StripMenuGenerator(_serviceManager, _toolStrip, "Forum.TagLine.Toolbar"); _contextMenuGenerator = new StripMenuGenerator(_serviceManager, _contextMenuStrip, "Forum.TagLine.ContextMenu"); _listImages.Images.Add( _serviceManager.GetRequiredService <IStyleImageManager>() .GetImage(@"MessageTree\Msg", StyleImageType.ConstSize)); UpdateData(); _tagLines.Changed += (sender, e) => UpdateData(); }
public LogForm([NotNull] IServiceProvider serviceProvider) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } _serviceProvider = serviceProvider; InitializeComponent(); var styleImageManager = _serviceProvider.GetService <IStyleImageManager>(); if (styleImageManager != null) { Icon = styleImageManager.GetImage("log", StyleImageType.Small).ToIcon(); } _stripMenuGenerator = new StripMenuGenerator(_serviceProvider, _toolStrip, "Janus.Log.Toolbar"); ApplicationManager.Instance.Logger.OnLog += _logComboBox.AddItem; StyleConfig.StyleChange += StyleConfig_StyleChange; UpdateStyle(); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { if (Config.Instance.TickerConfig.ShowTicker) { Ticker.HideTicker(); } if (disposing) { _navigationComboBoxGenerator.Dispose(); if (_mainMenuGenerator != null) { _mainMenuGenerator.Dispose(); _mainMenuGenerator = null; } if (_toolBarGenerator != null) { _toolBarGenerator.Dispose(); _toolBarGenerator = null; } StyleConfig.StyleChange -= OnStyleChanged; if (components != null) { components.Dispose(); } } base.Dispose(disposing); Config.Save(); }
protected override void OnLoad(EventArgs e) { SetSetings(); _splitter.SplitPosition = Config.Instance.ForumSplitterPosition; _menuGenerator = new StripMenuGenerator(_serviceManager, _contextMenuStrip, "ForumMessage.ContextMenu"); base.OnLoad(e); }
private FavoritesDummyForm(IServiceProvider provider) { _serviceManager = new ServiceManager(provider); _favManager = provider.GetRequiredService <IFavoritesManager>(); InitializeComponent(); FillImages(); CustomInitializeComponent(); _serviceManager.Publish <IFavoritesDummyFormService>(new FavoritesDummyFormService(this)); _contextMenuGenerator = new StripMenuGenerator(_serviceManager, _contextMenuStrip, "Favorites.ContextMenu"); }
public ConsoleForm([NotNull] IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } _provider = provider; _commandService = _provider.GetRequiredService <ICommandService>(); _commandHandlerService = _provider.GetRequiredService <ICommandHandlerService>(); _history = new List <string>(); InitializeComponent(); var styleImageManager = _provider.GetService <IStyleImageManager>(); if (styleImageManager != null) { Icon = styleImageManager.TryGetImage("console", StyleImageType.Small).ToIcon(); } _toolbarGenerator = new StripMenuGenerator(_provider, _toolStrip, "Janus.Console.Toolbar"); var font = new Font("Courier New", 10F); _consoleEditor.Font = font; _defaultStyle = new TextStyle( "Default", 0, font, Color.Black, Color.White, false, CaseMode.Mixed, true, false, PredefinedStyle.None); _commandNameStyle = new TextStyle( "CommandName", 1, font, Color.Brown, Color.White, false, CaseMode.Mixed, true, false, PredefinedStyle.None); _parameterNameStyle = new TextStyle( "ParameterName", 2, font, Color.Red, Color.White, false, CaseMode.Mixed, true, false, PredefinedStyle.None); _parameterValueStyle = new TextStyle( "ParameterValue", 3, font, Color.Blue, Color.White, false, CaseMode.Mixed, true, false, PredefinedStyle.None); _consoleEditor.TextStyles.AddRange( new[] { _defaultStyle, _commandNameStyle, _parameterNameStyle, _parameterValueStyle }); Prompt(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); SystemMenuHelper.AddItemToMenu( Handle.ToInt32(), _idSyncSysMenu, SR.MainForm.SystemMenuHelper.SyncItemCaption, true); _navigationComboBoxGenerator = new NavigationComboBoxGenerator(_serviceProvider, _navigationBox); _mainMenuGenerator = new StripMenuGenerator(_serviceProvider, _menuStrip, "MainForm.Menu"); _toolBarGenerator = new StripMenuGenerator(_serviceProvider, _toolStrip, "MainForm.Toolbar"); }
public WebBrowserForm(IServiceProvider serviceProvider) { _serviceManager = new ServiceManager(serviceProvider); _asyncOp = AsyncHelper.CreateOperation(); InitializeComponent(); _serviceManager.Publish <IBrowserFormService>(new JBrowserFormService(this)); _serviceManager.Publish <IActiveMessagesService>( new JBrowserActiveMessageService(_serviceManager)); //Восстановление размера и положеня формы Bounds = Config.Instance.WebBrowserFormBounds.Bounds; if (Config.Instance.WebBrowserFormBounds.Maximized) { WindowState = FormWindowState.Maximized; } _menuGenerator = new StripMenuGenerator(_serviceManager, _menuStrip, "JBrowser.Menu"); _toolbarGenerator = new StripMenuGenerator(_serviceManager, _toolStrip, "JBrowser.Toolbar"); _webBrowser.BackColor = Color.White; //Большинство событий браузера в дизайнере не видно, поэтому добавляем вручную _webBrowser.ProgressChanged += WebBrowserProgressChanged; _webBrowser.Navigated += WebBrowserNavigated; _webBrowser.StatusTextChanged += WebBrowserStatusTextChanged; _webBrowser.DocumentTitleChanged += WebBrowserDocumentTitleChanged; _webBrowser.CanGoBackChanged += WebBrowserCanGoBackChanged; _webBrowser.CanGoForwardChanged += WebBrowserCanGoForwardChanged; _webBrowser.DocumentCompleted += WebBrowserDocCompleted; var styleImageManager = _serviceManager.GetService <IStyleImageManager>(); if (styleImageManager != null) { var image = styleImageManager.TryGetImage("jbrowser", StyleImageType.Large); if (image != null) { Icon = image.ToIcon(); } } #if DEBUG _webBrowser.ScriptErrorsSuppressed = false; #endif }
public MsgViewer(IServiceProvider provider) { _serviceManager = new ServiceManager(provider); _serviceManager.Publish <IActiveMessagesService>( new MessageViewerActiveMessageService(this)); this.AssignServices(_serviceManager); InitializeComponent(); _messageBrowser.Navigating += MessageBrowserNavigating; _messageBrowser.StatusTextChanged += MessageBrowserStatusTextChanged; #if DEBUG _messageBrowser.ScriptErrorsSuppressed = false; #endif _toolbarGenerator = new StripMenuGenerator(_serviceManager, _toolStrip, "MessageViewer.Toolbar", true); }
protected override void OnLoad(EventArgs e) { _contextMenuGenerator = new StripMenuGenerator(_serviceManager, _contextMenuStrip, "ForumMessage.ContextMenu"); base.OnLoad(e); }
// ReSharper restore RedundantDefaultFieldInitializer public NavigationDummyForm([NotNull] IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } _provider = provider; this.AssignServices(provider); InitializeComponent(); TabText = SR.Navigation.NavTree.DockName; Text = SR.Navigation.NavTree.DockName; _contextMenuStrip = new ContextMenuStrip(); #region Инициализация грида _treeGrid = new JanusGrid { AllowDrop = true, ContextMenuStrip = _contextMenuStrip, Dock = DockStyle.Fill, Indent = Config.Instance.ForumDisplayConfig.GridIndent, FullRowSelect = true, HideSelection = false, MultiSelect = false }; _treeGrid.Columns.AddRange( new[] { new ColumnHeader { Name = "Name", Text = SR.Navigation.NavTree.NameColumn }, new ColumnHeader { Name = "Info", Text = SR.Navigation.NavTree.InfoColumn, TextAlign = HorizontalAlignment.Right } }); _treeGrid.ColumnsWidth = Config.Instance.NavTreeColumnWidth; _treeGrid.AfterActivateNode += TreeGridAfterActivateNode; _treeGrid.ColumnWidthChanged += TreeGridColumnWidthChanged; _treeGrid.MouseDown += OnTreeGridMouseDown; _treeGrid.MouseMove += OnTreeGridMouseMove; _treeGrid.MouseUp += OnTreeGridMouseUp; _treeGrid.DragEnter += OnTreeGridDragEnter; _treeGrid.DragOver += OnTreeGridDragOver; //_treeGrid.DragDrop += OnTreeGridDragDrop; Controls.Add(_treeGrid); #endregion _menuGenerator = new StripMenuGenerator(_provider, _contextMenuStrip, "NavigationBox.ContextMenu"); Features.Instance.AfterFeatureActivate += FeaturesAfterFeatureActivate; UpdateStyle(); StyleConfig.StyleChange += StyleConfigStyleChange; _eventsSubscription = EventBrokerHelper.SubscribeEventHandlers(this, _provider); }