/// <summary> /// Pastes a strategy from clipboard. /// </summary> protected override void MenuStrategyPaste_OnClick(object sender, EventArgs e) { DialogResult dialogResult = WhetherSaveChangedStrategy(); if (dialogResult == DialogResult.Yes) { SaveStrategy(); } else if (dialogResult == DialogResult.Cancel) { return; } var xmlDoc = new XmlDocument(); var strategyXML = new StrategyXML(); Strategy tempStrategy; try { xmlDoc.InnerXml = Clipboard.GetText(); tempStrategy = strategyXML.ParseXmlStrategy(xmlDoc); } catch (Exception exception) { MessageBox.Show(exception.Message); return; } OnStrategyChange(); Data.Strategy = tempStrategy; Data.StrategyName = tempStrategy.StrategyName; Data.Strategy.StrategyName = tempStrategy.StrategyName; Data.SetStrategyIndicators(); RebuildStrategyLayout(); SetSrategyOverview(); SetFormText(); Data.IsStrategyChanged = false; Data.LoadedSavedStrategy = Data.StrategyPath; Data.StackStrategy.Clear(); CalculateStrategy(true); AfterStrategyOpening(); }
/// <summary> /// Loads the strategy from a file in XML format. /// </summary> public static bool Load(string filename) { var xmlDocStrategy = new XmlDocument(); try { xmlDocStrategy.Load(filename); } catch (Exception e) { MessageBox.Show(e.Message, Language.T("Strategy Loading")); return(false); } var strategyXML = new StrategyXML(); Data.Strategy = strategyXML.ParseXmlStrategy(xmlDocStrategy); return(true); }
/// <summary> /// Loads the strategy from a file in XML format. /// </summary> public static bool Load(string filename) { var xmlDocStrategy = new XmlDocument(); try { xmlDocStrategy.Load(filename); } catch (Exception e) { MessageBox.Show(e.Message, Language.T("Strategy Loading")); return false; } var strategyXML = new StrategyXML(); Data.Strategy = strategyXML.ParseXmlStrategy(xmlDocStrategy); return true; }
/// <summary> /// Pastes a strategy from clipboard. /// </summary> protected override void MenuStrategyPaste_OnClick(object sender, EventArgs e) { DialogResult dialogResult = WhetherSaveChangedStrategy(); if (dialogResult == DialogResult.Yes) SaveStrategy(); else if (dialogResult == DialogResult.Cancel) return; var xmlDoc = new XmlDocument(); var strategyXML = new StrategyXML(); Strategy tempStrategy; try { xmlDoc.InnerXml = Clipboard.GetText(); tempStrategy = strategyXML.ParseXmlStrategy(xmlDoc); } catch (Exception exception) { MessageBox.Show(exception.Message); return; } OnStrategyChange(); Data.Strategy = tempStrategy; Data.StrategyName = tempStrategy.StrategyName; Data.Strategy.StrategyName = tempStrategy.StrategyName; Data.SetStrategyIndicators(); RebuildStrategyLayout(); SetSrategyOverview(); SetFormText(); Data.IsStrategyChanged = false; Data.LoadedSavedStrategy = Data.StrategyPath; Data.StackStrategy.Clear(); CalculateStrategy(true); AfterStrategyOpening(); }