示例#1
0
        public void SelectionListCopyTo()
        {
            tlog.Debug(tag, $"SelectionListCopyTo START");

            var model = new TestModel();

            string[] list = { "Jiangsu", "Zhejiang", "Shanghai" };

            using (CollectionView cv = new CollectionView(model))
            {
                var testingTarget = new SelectionList(cv);
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <SelectionList>(testingTarget, "should be an instance of testing target class!");

                testingTarget.CopyTo(list, 1);

                var result = testingTarget.Remove("Zhejiang");
                tlog.Debug(tag, "Remove : " + result);

                testingTarget.Insert(0, "Beijing");
                tlog.Debug(tag, "Contains : " + testingTarget.Contains("Beijing"));

                testingTarget.RemoveAt(0);
                tlog.Debug(tag, "Contains : " + testingTarget.Contains("Beijing"));
            }

            tlog.Debug(tag, $"SelectionListCopyTo END (OK)");
        }
示例#2
0
文件: Runner.cs 项目: sjdweb/lignite
        public SelectionList CompleteTradedVolumeToRunner(SelectionList runnersToUpdateTo, SelectionList runnersToUpdateFrom)
        {
            for (var x = 0; x < runnersToUpdateFrom.Count; x++)
            {
                if (!runnersToUpdateTo.Contains(runnersToUpdateFrom[x].selectionId))
                {
                    runnersToUpdateTo.Add(runnersToUpdateFrom[x]);
                }
                else
                {
                    var index = runnersToUpdateTo.GetRunnerIndexNoBySelectionId(runnersToUpdateFrom[x].selectionId);
                    if (index >= 0)
                    {
                        runnersToUpdateTo[index].tradedVolume  = runnersToUpdateFrom[x].tradedVolume;
                        runnersToUpdateTo[index].actualSPPrice = runnersToUpdateFrom[x].actualSPPrice;
                    }
                }
            }

            if (runnersToUpdateFrom.Count < runnersToUpdateTo.Count)
            {
                for (var x = 0; x < runnersToUpdateTo.Count; x++)
                {
                    if (!runnersToUpdateFrom.Contains(runnersToUpdateTo[x].selectionId))
                    {
                        runnersToUpdateTo[x].tradedVolume = new TradedVolumeList();
                    }
                }
            }

            return(runnersToUpdateTo);
        }
示例#3
0
        public void SelectionListOnCollectionChanged()
        {
            tlog.Debug(tag, $"SelectionListOnCollectionChanged START");

            var model = new TestModel();

            string[] list = { "Jiangsu", "Zhejiang", "Shanghai" };

            var incc = new NCImpl();

            incc.CollectionChanged += OnCollectionChanged;

            List <object> item = new List <object>();

            item.Add(item);

            using (CollectionView cv = new CollectionView(model))
            {
                var testingTarget = new SelectionList(cv, item);
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <SelectionList>(testingTarget, "should be an instance of testing target class!");

                testingTarget.Insert(0, "Beijing");
                tlog.Debug(tag, "Contains : " + testingTarget.Contains("Beijing"));
            }

            tlog.Debug(tag, $"SelectionListOnCollectionChanged END (OK)");
        }
示例#4
0
        public void SelectionListContains()
        {
            tlog.Debug(tag, $"SelectionListContains START");

            var model = new TestModel();

            using (CollectionView cv = new CollectionView(model))
            {
                var testingTarget = new SelectionList(cv);
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <SelectionList>(testingTarget, "should be an instance of testing target class!");

                tlog.Debug(tag, "IsReadOnly : " + testingTarget.IsReadOnly.ToString());

                try
                {
                    testingTarget.Add("TEST");
                    var result = testingTarget.Contains("TEST");
                    tlog.Debug(tag, "Contains : " + result);
                }
                catch (Exception e)
                {
                    tlog.Debug(tag, e.Message.ToString());
                    Assert.Fail("Caught Exception : Failed!");
                }
            }

            tlog.Debug(tag, $"SelectionListContains END (OK)");
        }
示例#5
0
 private void StartSave()
 {
     if (SelectionList.Contains(saveName))
     {
         confirmDialog.StartConfirmation(clickSound, audioElement);
     }
     else
     {
         SaveGame();
     }
 }
示例#6
0
 private void StartSave()
 {
     // Prompt for override of name if necessary
     if (SelectionList.Contains(saveName))
     {
         confirmDialog.StartConfirmation(clickSound, audioElement);
     }
     else
     {
         SaveGame();
     }
 }
示例#7
0
 private void StartSave()
 {
     //prompt for override of name if necessary
     if (SelectionList.Contains(saveName))
     {
         confirmDialog.StartConfirmation();
     }
     else
     {
         SaveGame();
     }
 }
示例#8
0
 /// <summary>
 ///     Selecciona una sola primitiva pero antes se fija si ya no estaba en la lista de seleccion.
 ///     Si ya estaba, entonces la quita de la lista de seleccion
 /// </summary>
 private void selectOrRemovePrimitiveIfPresent(EditPolyPrimitive p)
 {
     //Ya existe, quitar
     if (SelectionList.Contains(p))
     {
         p.Selected = false;
         SelectionList.Remove(p);
     }
     //No existe, agregar
     else
     {
         p.Selected = true;
         SelectionList.Add(p);
     }
 }
示例#9
0
        public SelectionList DictionaryToRunnerList(SelectionList runnersToUpdateTo,
                                                    Dictionary <int, Collections.RacecardInfo> updateFrom)
        {
            foreach (var selectionId in updateFrom.Keys)
            {
                if (!runnersToUpdateTo.Contains(selectionId))
                {
                    continue;
                }
                var index = runnersToUpdateTo.GetRunnerIndexNoBySelectionId(selectionId);
                if (index >= 0)
                {
                    runnersToUpdateTo[index].runnerDisplayDetail = updateFrom[selectionId];
                }
            }

            return(Helper.CheckForEmtyRunnerInstances(runnersToUpdateTo));
        }