public Form1() { InitializeComponent(); // create IMRUItemStorage implementation using default xml-based storage from OpenMRU.Core MRUItemFileStorage storage = new MRUItemFileStorage("demo_mru_storage.xml"); // create default manager from OpenMRU.Core manager = new MRUManager(); // init manager with storage manager.Initialize(storage); // subscribe to 'item selected' event manager.MRUItemSelected += Manager_MRUItemSelected; // init GUI control with created manager and default (eng) localization mruItemsControl1.Initialize(manager, new MRUGuiLocalization()); // init menu items MRUItemsMenu itemsMenu = new MRUItemsMenu(); itemsMenu.Initialize(manager, new MRUGuiLocalization()); itemsMenu.AttachToMenu(recentFilesToolStripMenuItem); // init menu items - custom appearance MRUItemsMenu itemsMenu2 = new MRUItemsMenu(); itemsMenu2.Initialize(manager, new MRUGuiLocalization()); itemsMenu2.AttachToMenu(recentcustomToolStripMenuItem, "%FileName% - [%Path%] - [%AccessDate%]"); }
private void InitializeWithItems(List <MRUItem> items, DateTime today, DayOfWeek firstDay) { storage = new InMemoryMRUStorage(items); manager = new MRUManager(); manager.Initialize(storage); viewMock = new MRUItemsViewMock(); viewMock.Initialize(manager, new MRUGuiLocalization()); viewMock.SetDateProvider(new MockDateProvider(today, firstDay)); }
private void frmMain_Load(object sender, EventArgs e) { this.Text = Application.ProductName + " v" + Application.ProductVersion; //初始化最近打开的文件 mruManager = new MRUManager(); mruManager.Initialize(this, 文件ToolStripMenuItem, 最近打开的文件ToolStripMenuItem, // Recent Files menu item "Software\\MEditor" // Registry path to keep MRU list ); mruManager.CurrentDir = "....."; // default is current directory mruManager.MaxMRULength = 10; // default is 10 mruManager.MaxDisplayNameLength = 40; //定义编辑管理器 meditorManager = new MarkdownEditorManager(this, tabControl1, mruManager, webBrowser1); ReadCss(); //webBrowser1.Navigate("about:blank"); meditorManager.SetStyle(rtbHtml); //webBrowser1.DocumentText = meditorManager.GetHTMLStyle(""); _filemonitor = new FileMonitor(fsw_Changed); string command = Environment.CommandLine; //获取进程命令行参数 if (!string.IsNullOrEmpty(command)) { string[] para = command.Split('\"'); if (para.Length > 2) { string pathC = para[2]; //获取打开的文件的路径 if (pathC.Length > 3) { openfile(pathC); } else { meditorManager.Open(""); } } } else { meditorManager.Open(""); } //this.timer1.Start(); rtbHtml.EnableAutoDragDrop = false; rtbHtml.AllowDrop = true; // rtbHtml.KeyDown += rtbHtml_KeyDown; rtbHtml.DragDrop += new DragEventHandler(frmMain_DragDrop); rtbHtml.DragEnter += new DragEventHandler(rtbHtml_DragEnter); tabControl1.MouseDown += new MouseEventHandler(tabControl1_MouseDown); tabControl2.MouseDown += new MouseEventHandler(tabControl1_MouseDown); //tabControl1.GotFocus += new EventHandler(tabControl1_GotFocus); }
private void Initialize() { var today = DateTime.Now; storage = new InMemoryMRUStorage(CreateItems(today)); manager = new MRUManager(); manager.Initialize(storage); viewMock = new MRUItemsViewMock(); viewMock.Initialize(manager, new MRUGuiLocalization()); viewMock.SetDateProvider(new MockDateProvider(today, DayOfWeek.Monday)); }
private void Initialize() { listChangedWasInvoked = false; itemSelectedWasInvoked = false; mruItems = CreateItems(); InMemoryMRUStorage storage = new InMemoryMRUStorage(mruItems); manager = new MRUManager(); manager.MRUItemsListChanged += Manager_MRUItemsListChanged; manager.MRUItemSelected += Manager_MRUItemSelected; manager.Initialize(storage); }
public XEditNetMainForm() { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.SupportsTransparentBackColor, false); SetStyle(ControlStyles.Opaque, true); InitializeComponent(); state.RegistryPath = registryPath; state.Parent = this; mru.Initialize(this, menuFileMru, registryPath); Application.EnableVisualStyles(); Application.DoEvents(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { // load settings only if not in debug mode if (!Settings.Default.ShowLogConsole) { ToolStripManager.LoadSettings(this, Name); } // --- // initialize menu state PicGlobalCotationProperties.ShowShortCotationLines = Settings.Default.UseCotationShortLines; _log.Info(string.Format("ShowShortCotationLines initialized with value : {0}", Settings.Default.UseCotationShortLines.ToString())); toolStripMenuItemCotationShortLines.Checked = PicGlobalCotationProperties.ShowShortCotationLines; // Set DockPanel properties dockPanel.DocumentStyle = DocumentStyle.DockingMdi; dockPanel.ActiveAutoHideContent = null; dockPanel.Parent = this; dockPanel.SuspendLayout(true); UpdateToolCommands(null, null); ShowLogConsole(); dockPanel.ResumeLayout(true, true); if (IsWebSiteReachable) { ShowStartPage(); } CreateBasicLayout(); // update tool bars UpdateToolCommands(null); // Most recently used databases mruManager = new MRUManager(); mruManager.Initialize( this, // owner form databaseToolStripMenuItem, // Recent Files menu item mnuFileMRU, // Recent Files menu item "Software\\treeDiM\\PLMPackLib"); // Registry path to keep MRU list mruManager.Add(Pic.DAL.ApplicationConfiguration.CustomSection.DatabasePath); } catch (Exception ex) { Debug.Fail(ex.ToString()); _log.Error(ex.ToString()); } // restore window position if (null != Settings.Default.MainFormSettings && !Settings.Default.StartMaximized) { Settings.Default.MainFormSettings.Restore(this); } // show maximized if (Settings.Default.StartMaximized) { WindowState = FormWindowState.Maximized; } }