Example #1
0
        private void symbolicExpressionTreeChart_SymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e)
        {
            if (Grammar.ReadOnly)
            {
                return;
            }
            if ((Control.ModifierKeys & Keys.Control) == 0)
            {
                selectedSymbolicExpressionTreeNodes.Clear();
            }

            VisualSymbolicExpressionTreeNode clickedNode = (VisualSymbolicExpressionTreeNode)sender;
            var selectedNode = clickedNode.Content;

            if (selectedNode.SubtreeCount == 0)
            {
                if (!selectedSymbolicExpressionTreeNodes.Contains(selectedNode))
                {
                    selectedSymbolicExpressionTreeNodes.Add(selectedNode);
                }
                else
                {
                    selectedSymbolicExpressionTreeNodes.Remove(selectedNode);
                }
            }

            UpdateSelectedSymbolicExpressionTreeNodes();
        }
        private void TestPlanningExplorerTreeView_ItemSelected(object sender, EventArgs e)
        {
            mCurrentSelectedTestSets.Clear();

            TreeViewItem item = (TreeViewItem)sender;

            mCurrentSelectedTreeItem = (ITreeViewItem)item.Tag;

            if (mCurrentSelectedTreeItem is ZephyrEntPhaseTreeItem)
            {
                if (mExplorerTestPlanningPageUsageType != eExplorerTestPlanningPageUsageType.BrowseFolders)
                {
                    mCurrentSelectedTestSets.Add((ZephyrEntPhaseTreeItem)mCurrentSelectedTreeItem);
                    GetTestSetDetails(mCurrentSelectedTestSets[0]);
                    ShowTestSetDetailsPanel(true);
                }
                else
                {
                    //don't count as selected
                    mCurrentSelectedTreeItem = null;
                    mCurrentSelectedTestSets.Clear();
                }
            }
            else
            {
                //probably a folder
                string[] returnedValues = new string[] { ((TestPlanningFolderTreeItem)mCurrentSelectedTreeItem).entityType.ToString(),
                                                         ((TestPlanningFolderTreeItem)mCurrentSelectedTreeItem).Id,
                                                         ((TestPlanningFolderTreeItem)mCurrentSelectedTreeItem).ParentId.ToString(),
                                                         ((TestPlanningFolderTreeItem)mCurrentSelectedTreeItem).CycleId.ToString() };
                CurrentSelectedPath = String.Join("#", returnedValues);
                ShowTestSetDetailsPanel(false);
            }
        }
Example #3
0
 public void LearnDelta()
 {
     try
     {
         IsLearning = true;
         mIWindowExplorerDriver.UnHighLightElements();
         ((DriverBase)Agent.Driver).mStopProcess = false;
         POMElementsCopy.Clear();
         DeltaViewElements.Clear();
         PomLearnUtils.PrepareLearningConfigurations();
         PomLearnUtils.LearnScreenShot();//this will set screen size to be same as in learning time
         PrepareCurrentPOMElementsData();
         if (PomLearnUtils.LearnOnlyMappedElements)
         {
             mIWindowExplorerDriver.GetVisibleControls(PomLearnUtils.AutoMapElementTypesList.Where(x => x.Selected).Select(y => y.ElementType).ToList(), POMLatestElements, true);
         }
         else
         {
             mIWindowExplorerDriver.GetVisibleControls(null, POMLatestElements, true);
         }
         SetUnidentifiedElementsDeltaDetails();
         DoEndOfRelearnElementsSorting();
     }
     finally
     {
         IsLearning = false;
     }
 }
        public async Task LearnDelta()
        {
            try
            {
                IsLearning = true;
                mIWindowExplorerDriver.UnHighLightElements();
                ((DriverBase)((AgentOperations)Agent.AgentOperations).Driver).StopProcess = false;
                POMElementsCopy.Clear();
                DeltaViewElements.Clear();
                PomLearnUtils.PrepareLearningConfigurations();
                PomLearnUtils.LearnScreenShot();//this will set screen size to be same as in learning time
                PrepareCurrentPOMElementsData();
                if (PomLearnUtils.LearnOnlyMappedElements)
                {
                    List <eElementType> selectedElementList = GetSelectedElementList();

                    await mIWindowExplorerDriver.GetVisibleControls(selectedElementList, POMLatestElements, true, SpecificFramePath, GetRelativeXpathTemplateList());
                }
                else
                {
                    await mIWindowExplorerDriver.GetVisibleControls(null, POMLatestElements, true, SpecificFramePath, GetRelativeXpathTemplateList());
                }
                SetUnidentifiedElementsDeltaDetails();
                DoEndOfRelearnElementsSorting();
            }
            finally
            {
                IsLearning = false;
            }
        }
Example #5
0
        private void TestLabExplorerTreeView_ItemSelected(object sender, EventArgs e)
        {
            mCurrentSelectedTestSets.Clear();

            TreeViewItem item = (TreeViewItem)sender;

            mCurrentSelectedTreeItem = (ITreeViewItem)item.Tag;

            if (mCurrentSelectedTreeItem is QCTestSetTreeItem)
            {
                if (mExplorerTestLabPageUsageType != eExplorerTestLabPageUsageType.BrowseFolders)
                {
                    mCurrentSelectedTestSets.Add((QCTestSetTreeItem)mCurrentSelectedTreeItem);
                    GetTestSetDetails(mCurrentSelectedTestSets[0]);
                    CurrentSelectedPath = mCurrentSelectedTestSets[0].Path;
                    ShowTestSetDetailsPanel(true);
                }
                else
                {
                    //don't count as selected
                    mCurrentSelectedTreeItem = null;
                    mCurrentSelectedTestSets.Clear();
                }
            }
            else
            {
                //probably a folder
                CurrentSelectedPath = ((QCTestLabFolderTreeItem)mCurrentSelectedTreeItem).Path;
                ShowTestSetDetailsPanel(false);
            }
        }
Example #6
0
        private void RerunButton_Click(object sender, RoutedEventArgs e)
        {
            if (BusyInProcess)
            {
                Reporter.ToUser(eUserMsgKeys.StaticInfoMessage, "Please wait for current process to end.");
                return;
            }

            mIssues.Clear();
            CriticalAndHighIssuesLabelCounter.Content    = "0";
            CriticalAndHighIssuesLabelCounter.Foreground = (SolidColorBrush) new BrushConverter().ConvertFromString("#20334f");   //"#20334f";
            CanAutoFixLableCounter.Content = "0";
            Analyze();
        }
Example #7
0
    private void UpdateVisibilities()
    {
        Objects.Clear();

        if (GoList != null && GoList.Objects != null)
        {
            foreach (var o in GoList.Objects)
            {
                if (o == null)
                {
                    continue;
                }

                var materialProperties = o.GetComponentsInChildren <MaterialProperties>();
                if (materialProperties == null || materialProperties.Length == 0)
                {
                    continue;
                }

                foreach (var materialPropertiese in materialProperties)
                {
                    materialPropertiese.RestoreState();
                }
                Objects.Add(new VisibilityStruct
                {
                    Name     = o.name,
                    Opacity  = materialProperties[0].Opacity,
                    Enabled  = materialProperties[0].Enabled,
                    MatProps = materialProperties
                });
            }
        }
        var go        = GameObject.Find("Visibilities");
        var selection = go.GetComponentInChildren <GameObjectSelection>();

        if (selection != null)
        {
            foreach (var selectionInfo in selection.Selections)
            {
                var localName = "";
                if (selectionInfo.Base != null)
                {
                    localName = selectionInfo.Base.name;
                }
                if (selectionInfo.SearchChildren)
                {
                    localName = localName + "-" + selectionInfo.SearchString;
                }

                Objects.Add(new VisibilityStruct
                {
                    Name        = localName,
                    Enabled     = true,
                    GameObjects = selectionInfo.Selected == null ? null : selectionInfo.Selected.ToArray()
                });
            }
        }

        Objects.ItemsModified();
    }
Example #8
0
        public void Clear()
        {
            if (m_SchemeMobaGoodsDataSource != null)
            {
                while (m_SchemeMobaGoodsDataSource.Count > 0)
                {
                    if (m_SchemeMobaGoodsDataSource[0] != null && m_SchemeMobaGoodsDataSource.Contains(m_SchemeMobaGoodsDataSource[0]))
                    {
                        m_SchemeMobaGoodsDataSource.RemoveAt(0);
                    }
                }
                m_SchemeMobaGoodsDataSource = null;
            }

            if (m_SchemeGoodsLabelDescirptionTable != null)
            {
                m_SchemeGoodsLabelDescirptionTable.Clear();
                m_SchemeGoodsLabelDescirptionTable = null;
            }

            if (m_currentHeroPortraitItemList != null)
            {
                m_currentHeroPortraitItemList.Clear();
                m_currentHeroPortraitItemList = null;
            }
        }
 public LocationsTreeViewModel(ObservableCollection<Location> locations)
 {
     Locations = new ObservableList<LocationNode>();
     foreach (var location in locations) Locations.Add(new LocationNode(location));
     locations.CollectionChanged += (s, e) =>
     {
         switch (e.Action)
         {
             case NotifyCollectionChangedAction.Add:
                 foreach (Location location in e.NewItems) Locations.Add(new LocationNode(location));
                 break;
             case NotifyCollectionChangedAction.Remove:
                 foreach (Location location in e.OldItems)
                 {
                     var item = Locations.FirstOrDefault(l => l.Location.Guid == location.Guid);
                     if (item != null) Locations.Remove(item);
                 }
                 break;
             case NotifyCollectionChangedAction.Replace:
                 foreach (Location location in e.OldItems)
                 {
                     var item = Locations.FirstOrDefault(l => l.Location.Guid == location.Guid);
                     if (item != null) Locations.Remove(item);
                 }
                 foreach (Location location in e.NewItems) Locations.Add(new LocationNode(location));
                 break;
             case NotifyCollectionChangedAction.Reset:
                 Locations.Clear();
                 foreach (Location location in e.NewItems) Locations.Add(new LocationNode(location));
                 break;
         }
     };
     LocationsTreeViewSource = new CollectionViewSource { Source = Locations };
     LocationsTreeViewSource.SortDescriptions.Add(new SortDescription("Location.Name", ListSortDirection.Ascending));
 }
Example #10
0
        private void MappedElementsGrid_RowChangedEvent(object sender, EventArgs e)
        {
            if (IsFirstSelection)
            {
                xDetailsExpander.IsEnabled  = true;
                xDetailsExpander.IsExpanded = true;
                IsFirstSelection            = false;
            }

            mLocators.Clear();
            mProperties.Clear();
            if (((DataGrid)sender).SelectedItem != null)
            {
                ElementInfo SelectedElement = (ElementInfo)((DataGrid)sender).SelectedItem;
                if (SelectedElement.ElementTitle != null)
                {
                    xDetailsExpanderLabel.Content = "'" + SelectedElement.ElementTitle + "' Details";
                }
                foreach (ElementLocator EL in SelectedElement.Locators)
                {
                    mLocators.Add(EL);
                }

                foreach (ControlProperty CP in SelectedElement.Properties)
                {
                    mProperties.Add(CP);
                }
            }
            else
            {
                xDetailsExpander.IsEnabled  = false;
                xDetailsExpander.IsExpanded = false;
                IsFirstSelection            = true;
            }
        }
Example #11
0
 public void Dispose()
 {
     _tree = null;
     _imageSets.Clear();
     _imageSets = null;
     _bingding  = null;
 }
Example #12
0
        public void CanAccumulate()
        {
            var items = new ObservableList<Person>();


            var subscription = items.Changes
                .Subscribe(changes =>
                {
                    Console.WriteLine(changes);
                });


            using (var x = items.SuspendNotifications())
            {
                foreach (var person in _random.Take(20000))
                {
                    items.Add(person);
                }
                items.Clear();
                var result = items.GetChanges();

                items[10] = new Person("Roland", 1);
            }

        }
        public void ResetList()
        {
            Debug.LogFormat("ResetList");

            objectList.Clear();

            // disable notify
            objectList.IsNotifying = false;

            for (int groupIndex = 0; groupIndex < groupCount; groupIndex++)
            {
                // create header
                var header = new Header();
                header.Name = string.Format("ItemGroup {0}", ConvertToLetter(groupIndex));
                objectList.Add(header);

                for (int itemIndex = 0; itemIndex < itemCountPerGroup; itemIndex++)
                {
                    // create item
                    var item = new Item();
                    item.Name       = string.Format("Item {0}{1}", ConvertToLetter(groupIndex), itemIndex + 1);
                    item.Price      = (itemIndex + 1) * 10f;
                    item.BuyCommand = new DelegateCommand(() => BuyItem(item), () => !item.IsOwned);

                    objectList.Add(item);
                }
            }

            // enable notify and notify add event
            objectList.IsNotifying = true;
            objectList.NotifyCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, objectList));
        }
Example #14
0
        public void ClearList()
        {
            Debug.LogFormat("ClearList");

            nextIndex = 0;
            itemList.Clear();
        }
        public void UpdateTest()
        {
            Logger logger = new Logger();
            var    list   = new ObservableList <string>();

            list.Attach(logger);
            string str1 = "string1",
                   str2 = "string2",
                   str3 = "string3";

            list.Add(str1);
            list.Add(str2);
            list.Insert(2, str3);

            list.Remove(str1);
            list.Detach(logger);
            list.Clear();

            foreach (string entry in logger.Log)
            {
                Trace.WriteLine(entry);
            }

            Assert.AreEqual(logger.Log.Count, 4);
        }
Example #16
0
        public void Clear()
        {
            List <char> initial = new List <char>();

            initial.Add('A');
            initial.Add('B');
            initial.Add('C');

            ObservableList <char> collection      = new ObservableList <char>(initial);
            bool          propertyChanged         = false;
            List <string> changedProps            = new List <string>();
            NotifyCollectionChangedEventArgs args = null;

            ((INotifyPropertyChanged)collection).PropertyChanged += (sender, e) =>
            {
                propertyChanged = true;
                changedProps.Add(e.PropertyName);
            };

            collection.CollectionChanged += (sender, e) =>
            {
                args = e;
            };

            collection.Clear();

            Assert.IsTrue(propertyChanged, "CLEAR_1");
            Assert.IsTrue(changedProps.Contains("Count"), "CLEAR_2");
            Assert.IsTrue(changedProps.Contains("Item[]"), "CLEAR_3");

            CollectionChangedEventValidators.ValidateResetOperation(args, "CLEAR_4");
        }
Example #17
0
 public void ClearHeroTalentData()
 {
     HeroTalentData.Clear();
     NumGroup.ResetData();
     HeroTalentList.DataSource = HeroTalentData;
     SetTalentOpenButtonColorChange(false);
 }
Example #18
0
        public void Learn()
        {
            ClearStopLearning();
            PrepareLearningConfigurations();
            LearnScreenShot();
            POM.PageURL = ((DriverBase)Agent.Driver).GetURL();
            POM.Name    = IWindowExplorerDriver.GetActiveWindow().Title;

            // appending Specific frame title in POM name
            if (!string.IsNullOrEmpty(SpecificFramePath))
            {
                var frame = IWindowExplorerDriver.GetWindowAllFrames().Where(x => x.Path.Equals(SpecificFramePath)).FirstOrDefault();

                if (frame != null)
                {
                    POM.Name = string.Concat(POM.Name, " : ", frame.Title);
                }
            }

            POM.MappedUIElements.Clear();
            POM.UnMappedUIElements.Clear();
            mElementsList.Clear();
            if (LearnOnlyMappedElements)
            {
                if (SelectedElementTypesList.Count > 0)
                {
                    IWindowExplorerDriver.GetVisibleControls(SelectedElementTypesList, mElementsList, true, SpecificFramePath);
                }
            }
            else
            {
                IWindowExplorerDriver.GetVisibleControls(null, mElementsList, true, SpecificFramePath);
            }
        }
        /// <summary>
        /// Clears the given Collection.
        /// </summary>
        public void ClearTest(ObservableList <string> collection)
        {
            INotifyPropertyChanged collectionPropertyChanged = collection;

            collectionPropertyChanged.PropertyChanged += Collection_PropertyChanged;
            _expectedPropertyChanged = new[]
            {
                new PropertyNameExpected(COUNT),
                new PropertyNameExpected(ITEMARRAY)
            };

            collection.CollectionChanged += Collection_CollectionChanged;
            ExpectedCollectionChangedFired++;
            ExpectedAction           = NotifyCollectionChangedAction.Reset;
            ExpectedNewItems         = null;
            ExpectedNewStartingIndex = -1;
            ExpectedOldItems         = null;
            ExpectedOldStartingIndex = -1;

            collection.Clear();
            Assert.Equal(0, collection.Count);
            Assert.Equal(ExpectedCollectionChangedFired, NumCollectionChangedFired);

            foreach (var item in _expectedPropertyChanged)
            {
                Assert.True(item.IsFound, "The propertychanged event should have fired for" + item.Name + ", since we just cleared the collection");
            }

            collection.CollectionChanged -= Collection_CollectionChanged;
            collectionPropertyChanged.PropertyChanged -= Collection_PropertyChanged;
        }
Example #20
0
        public void Observable_List_Should_Trigger_On_Item_Count_Change()
        {
            var l = new ObservableList <int>()
            {
                1, 2, 3
            };
            int triggerCount = 0;

            When(() =>
            {
                triggerCount++;
                return(l[1] == 100);
            });

            Assert.Equal(1, triggerCount);

            l.Add(4);
            Assert.Equal(2, triggerCount);

            l.Remove(4);
            Assert.Equal(3, triggerCount);

            l.RemoveAt(2);
            Assert.Equal(4, triggerCount);

            l.Clear();
            Assert.Equal(5, triggerCount);
        }
Example #21
0
        /// <summary>
        /// Handle click event.
        /// </summary>
        protected virtual void Click()
        {
            if (click == 0)
            {
                items = ListView.DataSource;

                items.Add("Added from script 0");
                items.Add("Added from script 1");
                items.Add("Added from script 2");

                items.Remove("Caster");

                click += 1;
                return;
            }

            if (click == 1)
            {
                items.Clear();

                click += 1;
                return;
            }

            if (click == 2)
            {
                items.Add("test");

                click += 1;
                return;
            }
        }
Example #22
0
        private void FullReset()
        {
            var oldCount = _resultList.Count;

            _fullResetInProgress = true;
            try
            {
                _resultList.Clear();

                foreach (var set in _joinerLookup.Values)
                {
                    set.Dispose();
                }

                _joinerLookup.Clear();
                _leftJoiners.Clear();
                _rightJoiners.Clear();

                OnLeftReset(_leftItems);
                OnRightReset(_rightItems);
            }
            finally
            {
                _fullResetInProgress = false;
                if (oldCount != _resultList.Count)
                {
                    NotifyOfPropertyChange(new PropertyChangedEventArgs(nameof(Count)));
                }
                NotifyOfCollectionChange(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            }
        }
Example #23
0
    public void LoadAward()
    {
        awards.Clear();
        ApplicationContext context = Context.GetApplicationContext();

        IRewardRepository rewardRepository = context.GetService <IRewardRepository>();

        IAsyncResult <List <Award> > result = rewardRepository.GetAwards();
        List <Award> awardList = result.Synchronized().WaitForResult();

        foreach (Award award in awardList)
        {
            AwardItemViewModel awardItemViewModel = new AwardItemViewModel();
            if (award.Quality == (int)QualityType.Orange)
            {
                awardItemViewModel.Name = $"<color=#FF7F00>{award.Name}  {award.Count}</color>";
            }
            else if (award.Quality == (int)QualityType.Purple)
            {
                awardItemViewModel.Name = $"<color=#8B00FF>{award.Name}  {award.Count}</color>";
            }
            else
            {
                awardItemViewModel.Name = $"<color=#00FF00>{award.Name}  {award.Count}</color>";
            }

            this.awards.Add(awardItemViewModel);
        }
    }
        public void ObservableListTest()
        {
            ObservableList <float> list = new ObservableList <float>(new List <float>());
            float lastAddCall = 0, lastRemoveCall = 0;
            bool  wasClearCalled = false;

            list.onAdd    += (v) => { lastAddCall = v; };
            list.onRemove += (v) => { lastRemoveCall = v; };
            list.onClear  += () => { wasClearCalled = true; };

            list.Add(123);
            Assert.AreEqual(123, lastAddCall);
            lastAddCall = 0;

            list.Insert(0, 1337);
            Assert.AreEqual(1337, lastAddCall);
            Assert.AreEqual(2, list.Count);
            Assert.AreEqual(0, list.IndexOf(1337));
            lastAddCall = 0;

            list.Remove(1337);
            Assert.AreEqual(1337, lastRemoveCall);
            lastRemoveCall = 0;

            list.RemoveAt(0);
            Assert.AreEqual(123, lastRemoveCall);
            lastRemoveCall = 0;

            list.Add(-1);
            list.Clear();
            Assert.AreEqual(-1, lastRemoveCall);
            Assert.IsTrue(wasClearCalled);
            lastRemoveCall = 0;
            wasClearCalled = false;
        }
Example #25
0
        public void UnitTest6(ObservableList <int> list)
        {
            // ARRANGE
            EnvironmentSettings.AlwaysSuppressCurrentSynchronizationContext = true;

            list.Clear();

            list.Undo();

            Assert.True(list.Contains(1));
            Assert.True(list.Contains(7));
            Assert.True(list.Contains(19));
            Assert.True(list.Contains(23));
            Assert.True(list.Contains(4));

            // ACT
            list.Redo();

            // ASSERT
            Assert.False(list.Contains(1));
            Assert.False(list.Contains(7));
            Assert.False(list.Contains(19));
            Assert.False(list.Contains(23));
            Assert.False(list.Contains(4));
        }
Example #26
0
        public void TestClear()
        {
            var list = new List <string> {
                "aaa", "bbb", "ccc"
            };
            var set = new ObservableList <string>(list);

            Assert.AreEqual(set.Count, list.Count);
            bool propertyChangedInvoked   = false;
            bool collectionChangedInvoked = false;

            set.PropertyChanged += (sender, e) =>
            {
                Assert.AreEqual(e.PropertyName, nameof(ObservableList <string> .Count));
                propertyChangedInvoked = true;
            };
            set.CollectionChanged += (sender, e) =>
            {
                Assert.AreEqual(e.Action, NotifyCollectionChangedAction.Reset);
                collectionChangedInvoked = true;
            };
            set.Clear();
            Assert.AreEqual(set.Count, 0);
            Assert.True(propertyChangedInvoked);
            Assert.True(collectionChangedInvoked);
        }
Example #27
0
        public void ProcessFinish()
        {
            foreach (WizardPage p in Pages)
            {
                // TODO: call validate on page to run the rules
                //WizardEventArgs WizardEventArgs = new WizardEventArgs(this, EventType.Validate);
                //p.Page.WizardEvent(WizardEventArgs);
                // as soon as we have errors exist.
                if (p.HasErrors)
                {
                    Pages.CurrentItem = p;
                    return;
                }
            }

            //foreach (WizardPage p in Pages)
            //{
            //    WizardEventArgs WizardEventArgs2 = new WizardEventArgs(this, EventType.Finish);
            //    p.Page.WizardEvent(WizardEventArgs2);
            //}

            // all went OK!
            Finish();
            Pages.Clear();
            mWizardWindow.Close();
            mWizardWindow = null;
            // GC.Collect();
        }
Example #28
0
    void Start()
    {
        var verticalPrefab   = Resources.Load <GameObject>("Prefab/ExampleListItem_Vertical");
        var horizontalPrefab = Resources.Load <GameObject>("Prefab/ExampleListItem_Horizontal");

        // top
        topDataProvider = new ObservableList <ExampleListViewData>();
        topList         = new ListView <ExampleListViewData>(topRectTransform, topDataProvider, ViewHelper.Origin.Top, verticalPrefab);
        topDataProvider.Clear(false);

        for (int i = 0, max = 100; i < max; i++)
        {
            var data = new ExampleListViewData(i, topDataProvider);
            data.StringName.Value = "top : " + i;

            topDataProvider.Add(data, i == max - 1);
        }

        // bottom
        bottomDataProvider = new ObservableList <ExampleListViewData>();
        bottomList         = new ListView <ExampleListViewData>(bottomRectTransform, bottomDataProvider, ViewHelper.Origin.Bottom, verticalPrefab);
        bottomDataProvider.Clear(false);

        for (int i = 0, max = 100; i < max; i++)
        {
            var data = new ExampleListViewData(i, bottomDataProvider);
            data.StringName.Value = "bottom : " + i;

            bottomDataProvider.Add(data, i == max - 1);
        }

        // left
        leftDataProvider = new ObservableList <ExampleListViewData>();
        leftList         = new ListView <ExampleListViewData>(leftRectTransform, leftDataProvider, ViewHelper.Origin.Left, horizontalPrefab);
        leftDataProvider.Clear(false);

        for (int i = 0, max = 100; i < max; i++)
        {
            var data = new ExampleListViewData(i, leftDataProvider);
            data.StringName.Value = "left : " + i;

            leftDataProvider.Add(data, i == max - 1);
        }


        // right
        rightDataProvider = new ObservableList <ExampleListViewData>();
        rightList         = new ListView <ExampleListViewData>(rightRectTransform, rightDataProvider, ViewHelper.Origin.Right, horizontalPrefab);

        rightDataProvider.Clear(false);

        for (int i = 0, max = 100; i < max; i++)
        {
            var data = new ExampleListViewData(i, rightDataProvider);
            data.StringName.Value = "right : " + i;

            rightDataProvider.Add(data, i == max - 1);
        }
    }
Example #29
0
 /// <summary>
 /// Clears the <see cref="Messages"/> collection.
 /// </summary>
 public void ClearMessages()
 {
     messages.Clear();
     foreach (var logger in Loggers)
     {
         logger.Value.Clear();
     }
 }
 public static void CopySelectedItems(IClipboardOperations containerControl)
 {
     try
     {
         CutSourceList = null;
         CopiedorCutItems.Clear();
         foreach (RepositoryItemBase item in containerControl.GetSelectedItems())
         {
             CopiedorCutItems.Add(item);
         }
     }
     catch (Exception ex)
     {
         Reporter.ToUser(eUserMsgKey.StaticWarnMessage, "Copy Operation Failed");
         Reporter.ToLog(eLogLevel.ERROR, "Error occurred while Copying item", ex);
     }
 }
Example #31
0
 public void CloseAllRunningPluginProcesses()
 {
     foreach (PluginProcessWrapper process in mProcesses)
     {
         process.Close();
     }
     mProcesses.Clear();
 }
Example #32
0
 private void RestoreOriginalActions()
 {
     mActions.Clear();
     foreach (Act a in mOriginalActions)
     {
         mActions.Add(a);
     }
 }
        public void ClearFiresListClearedEvent()
        {
            var didFire = false;
            var observableList = new ObservableList<string> { "it doesn't matter" };

            observableList.ListCleared += (s, e) => { didFire = true; };
            observableList.Clear();

            Assert.IsTrue(didFire);
        }
        public void Clearing_the_list_raises_property_changed()
        {
            var observable = new ObservableList<string>();
            var propertyChangedRaised = false;
            observable.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "Clear")
                    propertyChangedRaised = true;
            };

            observable.Clear();

            Assert.IsTrue(propertyChangedRaised);
        }
Example #35
0
        public void ObservableList_RaisesCollectionResetOnClear()
        {
            var list  = new ObservableList<Int32>();
            var reset = false;

            list.CollectionReset += (source) =>
            {
                reset = true;
            };
            list.Add(1234);
            list.Clear();

            TheResultingValue(reset).ShouldBe(true);
        }
        public void When_Clear_Then_Action_Reset_Raised()
        {
            // Arrange
            var sut = new ObservableList<int>(new[] {10, 12, 18, 100});
            var results = new List<NotifyCollectionChangedEventArgs>();
            var expected = new[]
            {
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset),
            };
            sut.CollectionChanged += (o, e) => results.Add(e);

            // Act
            sut.Clear();

            // Assert
            KKAssert.AreEqualByValue(expected, results);
        }
 public void ClearWithNoEventListenerClearsList()
 {
     var observableList = new ObservableList<DateTime> { DateTime.Now, new DateTime(2001, 5, 4) };
     observableList.Clear();
     CollectionAssert.IsEmpty(observableList.ToArray());
 }
        public void event_raised_when_list_is_cleared()
        {
            var testObject = new ObservableList<int>();

            var events = new List<NotifyCollectionChangedEventArgs>();

            testObject.Add(1);
            testObject.Add(2);

            testObject.CollectionChanged += (source, args) => events.Add(args);

            testObject.Clear();

            Assert.Equal(1, events.Count);

            var ev = events[0];
            Assert.Equal(NotifyCollectionChangedAction.Reset, ev.Action);
            Assert.Equal(2, ev.OldItems.Count);
            Assert.Equal(1, ev.OldItems[0]);
            Assert.Equal(2, ev.OldItems[1]);
            Assert.Equal(0, ev.OldStartingIndex);
        }
Example #39
0
 public void TestClear()
 {
     var list = new List<string> { "aaa", "bbb", "ccc" };
     var set = new ObservableList<string>(list);
     Assert.AreEqual(set.Count, list.Count);
     bool propertyChangedInvoked = false;
     bool collectionChangedInvoked = false;
     set.PropertyChanged += (sender, e) =>
     {
         Assert.AreEqual(e.PropertyName, nameof(ObservableList<string>.Count));
         propertyChangedInvoked = true;
     };
     set.CollectionChanged += (sender, e) =>
     {
         Assert.AreEqual(e.Action, NotifyCollectionChangedAction.Reset);
         collectionChangedInvoked = true;
     };
     set.Clear();
     Assert.AreEqual(set.Count, 0);
     Assert.True(propertyChangedInvoked);
     Assert.True(collectionChangedInvoked);
 }