Ejemplo n.º 1
0
 private LayoutInfo GetLayout()
 {
   LayoutInfo layoutInfo = new LayoutInfo();
   layoutInfo.Tabs = new TabLayoutInfo[this.tabControl.TabCount];
   for (int index = 0; index < this.tabControl.TabCount; ++index)
   {
     System.Windows.Forms.TabPage tabPage = this.tabControl.TabPages[index];
     TabLayoutInfo tabLayoutInfo = new TabLayoutInfo();
     tabLayoutInfo.TabName = tabPage.Text;
     StrategyMonitorControl strategyMonitorControl = (StrategyMonitorControl) tabPage.Tag;
     tabLayoutInfo.StrategyColumns = strategyMonitorControl.GetStrategyColumnLayout();
     tabLayoutInfo.InstrumentColumns = strategyMonitorControl.GetInstrumentColumnLayout();
     layoutInfo.Tabs[index] = tabLayoutInfo;
   }
   return layoutInfo;
 }
Ejemplo n.º 2
0
 private bool LoadLayout(string path, out LayoutInfo layout)
 {
   try
   {
     XmlSerializer xmlSerializer = new XmlSerializer(typeof (LayoutInfo));
     FileStream fileStream = new FileStream(path, FileMode.Open);
     layout = (LayoutInfo) xmlSerializer.Deserialize((Stream) fileStream);
     fileStream.Close();
     return true;
   }
   catch (Exception ex)
   {
     int num = (int) MessageBox.Show((IWin32Window) this, ((object) ex).ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     layout = LayoutInfo.Default;
     return false;
   }
 }
Ejemplo n.º 3
0
 private void ApplyLayout(LayoutInfo layout)
 {
   this.RemoveAllTabs();
   for (int index = 0; index < layout.Tabs.Length; ++index)
   {
     TabLayoutInfo tabLayoutInfo = layout.Tabs[index];
     this.InsertTab(index, tabLayoutInfo.TabName);
     ((StrategyMonitorControl) this.tabControl.TabPages[index].Tag).SetColumnLayout(tabLayoutInfo.StrategyColumns, tabLayoutInfo.InstrumentColumns);
   }
 }
Ejemplo n.º 4
0
 private void SaveLayout(string path, LayoutInfo layout)
 {
   try
   {
     XmlSerializer xmlSerializer = new XmlSerializer(typeof (LayoutInfo));
     FileStream fileStream = new FileStream(path, FileMode.Create);
     xmlSerializer.Serialize((Stream) fileStream, (object) layout);
     fileStream.Close();
   }
   catch (Exception ex)
   {
     int num = (int) MessageBox.Show((IWin32Window) this, ((object) ex).ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
   }
 }