示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StrategyRemovedEventArgs"/> class.
 /// </summary>
 /// <param name="strategy">The strategy.</param>
 /// <param name="owner">The owner.</param>
 public StrategyRemovedEventArgs(StrategyBase strategy, string owner)
 {
     _owner    = owner;
     _strategy = strategy;
 }
示例#2
0
 /// <summary>
 /// Deletes the strategy.
 /// </summary>
 /// <param name="current">The current.</param>
 private void DeleteStrategy(StrategyBase current)
 {
     current.OnRemoving(this, new EventArgs());
     // TODO suppression des custom properties
 }
示例#3
0
        /// <summary>
        /// Sélection d'un noeud. Affichage des propriétés
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.TreeViewEventArgs"/> instance containing the event data.</param>
        private void tvStrategies_AfterSelect(object sender, TreeViewEventArgs e)
        {
            StrategyBase strategy = (StrategyBase)e.Node.Tag;

            OnSelectionChanged(strategy);
        }
示例#4
0
        /// <summary>
        /// Initialisation de la liste des stratégies
        /// </summary>
        /// <param name="strategiesOwner">The strategies owner.</param>
        /// <param name="selectedStrategy">The selected strategy.</param>
        private void PopulateTreeView(CandleElement strategiesOwner, StrategyBase selectedStrategy)
        {
            this._strategiesOwner = strategiesOwner != null ? strategiesOwner.StrategiesOwner : null;
            _initialize           = true;
            tvStrategies.Nodes.Clear();

            // Remplissage à partir des stratégies liées au modèle
            TreeNode selectedNode = null;

            foreach (StrategyBase strategy in StrategyManager.GetInstance(_store).GetStrategies(strategiesOwner, false))
            {
                TreeNodeCollection nodes = tvStrategies.Nodes;

                // Insertion dans l'arbre en tenant compte du path
                if (!String.IsNullOrEmpty(strategy.StrategyPath))
                {
                    string[] pathParts = strategy.StrategyPath.Split('/');
                    // Création ou recherche de l'arborescence liée au path
                    foreach (string part in pathParts)
                    {
                        // Recherche du noeud parent pour chaque part
                        bool bFind = false;
                        foreach (TreeNode node in nodes)
                        {
                            if (Utils.StringCompareEquals(node.Text, part))
                            {
                                nodes = node.Nodes;
                                bFind = true;
                                break;
                            }
                        }

                        // Si pas trouvé, on le crèe
                        if (!bFind)
                        {
                            TreeNode parent = new TreeNode(part);
                            nodes.Add(parent);
                            nodes = parent.Nodes;
                            parent.Expand();
                        }
                    }
                }

                // Création du noeud de la stratégie
                TreeNode tmpNode = new TreeNode(strategy.DisplayName);
                tmpNode.Tag = strategy;
                nodes.Add(tmpNode);
                tmpNode.Checked = strategy.IsEnabled;
                if (selectedStrategy != null && selectedStrategy.StrategyId == strategy.StrategyId)
                {
                    selectedNode = tmpNode;
                }
            }

            if (selectedNode != null)
            {
                tvStrategies.SelectedNode = selectedNode;
            }

            _initialize = false;
        }
示例#5
0
        /// <summary>
        /// Handles the ItemSelectionChanged event of the lvStrategies control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.ListViewItemSelectionChangedEventArgs"/> instance containing the event data.</param>
        private void lvStrategies_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            StrategyBase strategy = (StrategyBase)e.Item.Tag;

            OnSelectionChanged(strategy);
        }
示例#6
0
 /// <summary>
 /// Populates the specified strategies owner.
 /// </summary>
 /// <param name="strategiesOwner">The strategies owner.</param>
 /// <param name="selectedStrategy">The selected strategy.</param>
 private void Populate(CandleElement strategiesOwner, StrategyBase selectedStrategy)
 {
     PopulateListView(strategiesOwner, selectedStrategy);
 }