//Handle the Script Conversion Status private void ShowStats() { double count = (from x in mCCL where x.Status != ConvertedCodeLine.eStatus.Unknown select x).Count(); string perc = (int)(count / mCCL.Count() * 100) + "%"; ConvertedCountLabel.Content = "Converted Lines: " + count + " out of " + mCCL.Count() + " " + perc; }
private void RepoItemUsages_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { Dispatcher.Invoke(() => { xUsageCountLabel.Content = RepoItemUsages.Count(); }); }
private void BusinessFlowsCount() { Console.WriteLine("Executing BFs count"); ObservableList <BusinessFlow> BFs = SR.GetAllRepositoryItems <BusinessFlow>(); Console.WriteLine("BFs count = " + BFs.Count()); }
void AddIssues(List <AnalyzerItemBase> issues) { StatusLabel.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new Action( delegate() { foreach (AnalyzerItemBase AIB in issues) { mIssues.Add(AIB); IssuesCounterLabel.Content = "Total Issues: "; IssuesCountLabel.Content = mIssues.Count(); if ((mIssues.Where(x => (x.Severity.ToString() == "High")).Count()) > 0 || (mIssues.Where(x => (x.Severity.ToString() == "Critical")).Count()) > 0) { CriticalAndHighIssuesLabel.Content = "Total High & Critical Issues: "; CriticalAndHighIssuesLabelCounter.Content = (mIssues.Where(x => (x.Severity.ToString() == "High")).Count() + mIssues.Where(x => (x.Severity.ToString() == "Critical")).Count()); CriticalAndHighIssuesLabelCounter.Foreground = new SolidColorBrush(Colors.Red); CriticalAndHighIssuesLabel.Visibility = Visibility.Visible; } if ((mIssues.Where(x => (x.CanAutoFix.ToString() == "Yes")).Count()) > 0) { CanAutoFixLable.Content = "Can Auto Fix: "; CanAutoFixLableCounter.Content = mIssues.Where(x => (x.CanAutoFix.ToString() == "Yes")).Count(); CanAutoFixLable.Visibility = Visibility.Visible; } } } )); }
// TODO is there a way to run a callback when a field changes? public void SetItems(ObservableList <ItemInstance> items) { SetValue("Items", items); int NumInColumn = (int)Math.Ceiling((float)items.Count() / NumInRow); Height.Value = ElementSize.FromPixels(NumInColumn * Template.Height.Value.Pixels + ContainerNameLabel.Height.Value.Pixels); }
/// <summary> /// Sample filter. /// Set node.IsVisible if it's match condition or it's subnodes match condition. /// </summary> /// <param name="nodes">Nodes.</param> /// <param name="filterFunc">Match function.</param> /// <returns>true if any node match condition; otherwise, false.</returns> protected static bool SampleFilter(ObservableList <TreeNode <TreeViewItem> > nodes, Func <TreeViewItem, bool> filterFunc) { return(nodes.Count(x => { var have_visible_children = (x.Nodes != null) && SampleFilter(x.Nodes, filterFunc); x.IsVisible = have_visible_children || filterFunc(x.Item); return x.IsVisible; }) > 0); }
public void ObservableListExtensions_Count_ReturnsCorrectSize() { var list = new ObservableList <Int32>() { 1, 2, 3 }; var result = list.Count(); TheResultingValue(result).ShouldBe(3); }
public void ObservableListExtensions_CountWithPredicate_ReturnsCorrectSize() { var list = new ObservableList <Int32>() { 1, 2, 3 }; var result = list.Count(x => x % 2 == 0); TheResultingValue(result).ShouldBe(1); }
private void MIssues_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { Dispatcher.Invoke(() => { IssuesCounterLabel.Content = "Total Issues: "; IssuesCountLabel.Content = mIssues.Count(); if ((mIssues.Where(x => (x.Severity.ToString() == "High")).Count()) > 0 || (mIssues.Where(x => (x.Severity.ToString() == "Critical")).Count()) > 0) { CriticalAndHighIssuesLabel.Content = "Total High & Critical Issues: "; CriticalAndHighIssuesLabelCounter.Content = (mIssues.Where(x => (x.Severity.ToString() == "High")).Count() + mIssues.Where(x => (x.Severity.ToString() == "Critical")).Count()); CriticalAndHighIssuesLabelCounter.Foreground = new SolidColorBrush(Colors.Red); CriticalAndHighIssuesLabel.Visibility = Visibility.Visible; } if ((mIssues.Where(x => (x.CanAutoFix.ToString() == "Yes")).Count()) > 0) { CanAutoFixLable.Content = "Can be Auto Fixed: "; CanAutoFixLableCounter.Content = mIssues.Where(x => (x.CanAutoFix.ToString() == "Yes")).Count(); CanAutoFixLable.Visibility = Visibility.Visible; } }); }
//Handles the Combo box status and Lines Converted section in bottom of the dialog private void FilterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { IEnumerable <ConvertedCodeLine> FilterdCCLs; ObservableList <ConvertedCodeLine> CCLs = new ObservableList <ConvertedCodeLine>(); eFilter mFilter = (eFilter)FilterComboBox.SelectedValue; switch (mFilter) { case eFilter.AllLines: FilterdCCLs = from x in mCCL select x; break; case eFilter.ConvertedtoScript: FilterdCCLs = from x in mCCL where x.Status == ConvertedCodeLine.eStatus.ConvertedToScript select x; break; case eFilter.Ignored: FilterdCCLs = from x in mCCL where x.Status == ConvertedCodeLine.eStatus.Ignored select x; break; case eFilter.NotConverted: FilterdCCLs = from x in mCCL where x.Status == ConvertedCodeLine.eStatus.Unknown select x; break; default: FilterdCCLs = null; break; } foreach (ConvertedCodeLine CCL in FilterdCCLs) { CCLs.Add(CCL); } ResultsDataGrid.DataSourceList = CCLs; ResultsDataGrid.IsReadOnly = true; RecordsCountLabel.Content = "Records: " + CCLs.Count(); }
private void MergeAndConvertToEnhancedList(ObservableList <AppModelParameter> AppModelParameters, ObservableList <EnhancedActInputValue> OldList) { if (AppModelParameters != null) { foreach (AppModelParameter AMDP in AppModelParameters) { if (AMDP.RequiredAsInput == true) { //Check if already exists in the list, if yes - add only its optional values and description EnhancedActInputValue EAIV = null; EAIV = mAddApiModelActionWizardPage.EnhancedInputValueList.Where(x => x.Param == AMDP.PlaceHolder).FirstOrDefault(); if (EAIV != null) { foreach (OptionalValue optionalValue in AMDP.OptionalValuesList) { if (!EAIV.OptionalValues.Contains(optionalValue.Value)) { if (optionalValue.IsDefault) { EAIV.Value = optionalValue.Value; } EAIV.OptionalValues.Add(optionalValue.Value); } } if (!string.IsNullOrEmpty(EAIV.Description) && !EAIV.Description.Contains(AMDP.Description)) { EAIV.Description += " | " + AMDP.Description; } } else { //Not exists in the list, add it, his optional values and description EnhancedActInputValue AIV = new EnhancedActInputValue(); AIV.ParamGuid = AMDP.Guid; AIV.Param = AMDP.PlaceHolder; AIV.Description = AMDP.Description; string OldValue = string.Empty; if (OldList != null && OldList.Count() > 0) { EnhancedActInputValue oldAIV = OldList.Where(x => x.ParamGuid == AMDP.Guid).FirstOrDefault(); if (oldAIV != null) { OldValue = oldAIV.Value; } else { OldValue = null; } } foreach (OptionalValue optionalValue in AMDP.OptionalValuesList) { AIV.OptionalValues.Add(optionalValue.Value); if (optionalValue.IsDefault) { AIV.Value = optionalValue.Value; } else if (string.IsNullOrEmpty(AIV.Value)) { AIV.Value = optionalValue.Value; } } if (!string.IsNullOrEmpty(OldValue)) { AIV.Value = OldValue; } mAddApiModelActionWizardPage.EnhancedInputValueList.Add(AIV); } } } } }
public void ObservableListExtensions_Count_ReturnsCorrectSize() { var list = new ObservableList<Int32>() { 1, 2, 3 }; var result = list.Count(); TheResultingValue(result).ShouldBe(3); }
public void ObservableListExtensions_CountWithPredicate_ReturnsCorrectSize() { var list = new ObservableList<Int32>() { 1, 2, 3 }; var result = list.Count(x => x % 2 == 0); TheResultingValue(result).ShouldBe(1); }
public int CountVoiceActorsAssigned() { return(CharacterGroups.Count(cg => cg.VoiceActorId != -1)); }