protected override void OnMenuButtonClick() { if (GanttView != null) { using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.DefaultExt = ".xml"; dlg.Filter = "XML files|*.xml|All files|*.*"; dlg.Title = "Load From XML File"; if (dlg.ShowDialog() == DialogResult.OK) { try { GanttView.LoadXml(dlg.FileName); var item = new Item(); item.Date = DateTime.Now; item.Text = Path.GetFileName(dlg.FileName); item.SubText = Path.GetDirectoryName(dlg.FileName); if (Items.FirstOrDefault(x => x.Text == item.Text && x.SubText == item.SubText) == null) { Items.Add(item); } } catch { } } } } }
protected override void OnMenuItemClick(MenuItem mi) { GanttView.LoadXml(System.IO.Path.Combine(mi.Item.SubText, mi.Item.Text)); mi.Item.Date = DateTime.Now; }