private void Window_Loaded(object sender, RoutedEventArgs e) { WindowPosition.Move(this); var items = new List<VersionListViewItem>(); var files = new List<string>(); files.AddRange(Directory.GetFiles(Directory.GetCurrentDirectory(), "*.dll", SearchOption.TopDirectoryOnly)); files.AddRange(Directory.GetFiles(Directory.GetCurrentDirectory(), "*.exe", SearchOption.TopDirectoryOnly)); files.Sort((x, y) => { return System.IO.Path.GetFileName(x).CompareTo(System.IO.Path.GetFileName(y)); }); foreach (var path in files) { var info = System.Diagnostics.FileVersionInfo.GetVersionInfo(path); var item = new VersionListViewItem(); item.FileName = System.IO.Path.GetFileName(path); item.Version = info.FileVersion; items.Add(item); } foreach (var item in items) { _versionListView.Items.Add(item); } }
private void SearchCompleted(string pattern, List<SearchResult2> results) { ContentBox.Items.Clear(); results.Sort(); foreach (SearchResult2 result in results) ContentBox.Items.Add(new SearchResultListItem2(result)); }
public OpcodeInfoWindow(NetworkLogViewerBase viewer) { InitializeComponent(); m_viewer = viewer; var window = viewer.InterfaceObject as Window; if (window != null) { this.Owner = window; this.Style = window.Style; var styler = window as INotifyStyleChanged; if (styler != null) styler.StyleChanged += (o, e) => this.Style = ((Window)m_viewer.InterfaceObject).Style; } var fields = typeof(WowOpcodes).GetFields(BindingFlags.Static | BindingFlags.Public); var list = new List<string>(fields.Length); foreach (var field in fields) { var value = (uint)field.GetRawConstantValue(); if (value != SpecialOpcodes.UnknownOpcode) list.Add(field.Name); } list.Sort(); var items = ui_cbInput.Items; foreach (var item in list) items.Add(item); this.Prepare(WowOpcodes.UNKNOWN_OPCODE); }
public ctlImportLocation(ModulePermissions[] MyPermissions) { try { InitializeComponent(); _MyPermissions = MyPermissions; DataSet dsTimeZone = clsBusiness.fncGetTimeZone(); for (int i = 0; i < dsTimeZone.Tables[0].Rows.Count; i++) { cmbTimeZone.Items.Add(dsTimeZone.Tables[0].Rows[i][0]); } List<string> xList = new List<string>(); for (int i = 0; i < cmbTimeZone.Items.Count; i++) { xList.Add(cmbTimeZone.Items[i].ToString()); } xList.Sort(); cmbTimeZone.Items.Clear(); for (int j = 0; j < xList.Count; j++) { cmbTimeZone.Items.Add(xList[j]); } this.Loaded += new RoutedEventHandler(ctlImportLocation_Loaded); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "ctlImportLocation", "ctlImportLocation.xaml.cs"); } }
/// <summary> /// Finds the ConvexHull of a series of points. See /// http://www.cs.princeton.edu/courses/archive/spr10/cos226/demo/ah/GrahamScan.html /// for further information. /// </summary> /// <param name="points">The points to compute the ConvexHull for</param> /// <returns>a collection of points that represents the polygon /// of the ConvexHull</returns> public static ICollection<Point> CalculateConvexHull(ICollection<Point> points) { if (points.Count <= 3) return points; List<ConvexHullPoint> chPoints = new List<ConvexHullPoint>(); // Get the current anchor point anchor = new ConvexHullPoint(DetermineAnchorPoint(points), 0, null); // Loop over the points foreach (Point currentPoint in points) { // Ensure that this point is not the anchor if (currentPoint != anchor.Point) { // Create a new ConvexHUllPoint and save it for later use ConvexHullPoint newConvexHullPoint = new ConvexHullPoint(currentPoint, CalculateCartesianAngle(currentPoint.X - anchor.Point.X, currentPoint.Y - anchor.Point.Y), anchor); chPoints.Add(newConvexHullPoint); } } // Sort the points chPoints.Sort(); // Actually calculate and return the ConvexHull return GrahamScan(chPoints); }
private void Grid_Loaded(object sender, RoutedEventArgs e) { if (ctrl.CrmConnectionMgr != null && ctrl.CrmConnectionMgr.CrmSvc != null && ctrl.CrmConnectionMgr.CrmSvc.IsReady) { CrmServiceClient svcClient = ctrl.CrmConnectionMgr.CrmSvc; if (svcClient.IsReady) { List<AttributeMetadata> entitiesList = svcClient.GetAllAttributesForEntity(EntityName); List<string> MyAttributes = new List<string>(); foreach (AttributeMetadata entityinlist in entitiesList) { if (entityinlist.IsCustomizable.Value) { MyAttributes.Add(entityinlist.LogicalName); } } MyAttributes.Sort(); foreach (string item in MyAttributes) { CheckBox chk = new CheckBox(); chk.Content = item; LB_AttributesList.Items.Add(chk); } } } }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { try { string cacheName = ConfigurationManager.AppSettings["CacheName"] ?? "default"; string region = ConfigurationManager.AppSettings["LogRegion"]; DataCacheFactoryConfiguration config = new DataCacheFactoryConfiguration(); DataCacheFactory factory = new DataCacheFactory(); DataCache cache = factory.GetCache(cacheName); List<KeyValuePair<string, object>> objects = cache.GetObjectsInRegion(region).ToList(); logEntries = new List<KeyValuePair<long, string>>(); for (int i = 0; i < objects.Count; i++) { long key; if (long.TryParse(objects[i].Key, out key)) { logEntries.Add(new KeyValuePair<long, string>(key, objects[i].Value.ToString())); } } logEntries.Sort((a, b) => a.Key.CompareTo(b.Key)); Grid.ItemsSource = logEntries; } catch (Exception ex) { MessageBox.Show("Error getting objects from cache: " + ex.Message); } }
private void salvaScore_Click(object sender, RoutedEventArgs e) { List<itemRanking> ranking = new List<itemRanking>(); ranking.Capacity = 3; itemRanking itemRanking = new itemRanking(); itemRanking.nomeJogador = campoJogador.Text; itemRanking.pontuacao = this.pontuacao; IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; if (settings.Contains("ranking")) { ranking = (List<itemRanking>)settings["ranking"]; ranking.Add(itemRanking); Comparison<itemRanking> comparador = new Comparison<itemRanking>(itemRanking.comparaPontuacao); ranking.Sort(comparador); if (ranking.Count > 3) { ranking.RemoveAt(3); } } else { ranking.Add(itemRanking); } settings["ranking"] = ranking; settings.Save(); NavigationService.Navigate(new Uri("/Ranking.xaml", UriKind.Relative)); }
public UserSettings(FacebookUserSetting setting) { _setting = setting; //get user InitializeComponent(); var fb = new FacebookClient(setting.AccessToken); var picSettings = new List<FacebookPictureSetting>(); dynamic friends = fb.Get("/me/friends"); foreach (var friend in friends.data) { picSettings.Add(new FacebookPictureSetting(new FacebookUser(friend.name, friend.id), false)); } picSettings.Sort((x, y) => string.Compare(x.User.Name, y.User.Name)); picSettings.Insert(0, new FacebookPictureSetting(new FacebookUser(setting.User.Name, setting.User.Id), false)); var selectedPics = picSettings.Where(x => setting.PictureSettings.Any(y => y.User.Id == x.User.Id)); foreach (var sp in selectedPics) { sp.Selected = true; } lsUsers.ItemsSource = picSettings; }
/// <summary> /// Permet de recuperer l'evenement qui indique qu'on a selectionne un item dans la liste box. /// </summary> /// <param name="sender">???</param> /// <param name="e">???</param> private void cbEquipes_SelectionChanged(object sender, SelectionChangedEventArgs e) { // On recupere la liste des joueurs de l'equipe selectionnee, et on les affiches. var equipe = (sender as ComboBox).SelectedItem as Equipe; var joueurs = new List<Joueur>(); joueurs = equipe.Joueurs; joueurs.Sort(); lvJoueurs.ItemsSource = joueurs; }
/// <summary> /// Permet de recuperer l'evenement qui indique qu'on a selectionne un item dans la liste box. /// </summary> /// <param name="sender">???</param> /// <param name="e">???</param> private void cbCoupes_SelectionChanged(object sender, SelectionChangedEventArgs e) { // On recupere la liste des matchs de la coupe selectionnee, et on les affiches. var coupe = (sender as ComboBox).SelectedItem as Coupe; var matchs = new List<Match>(); matchs = coupe.Matchs; matchs.Sort(); lvMatchs.ItemsSource = matchs; }
public void SayActionErrors(List<Pose.JointError> errorList, int nFrames) { errorList.Sort((s1, s2) => s1.mag.CompareTo(s2.mag)); errorList.Reverse(); Dictionary<string, int> errorDict = new Dictionary<string, int>(); for (int i = 0; i < errorList.Count; i++) { string text = ""; Pose.JointError err = errorList[i]; text += "Your " + getStringFromJointType(err.joint) + " was " + getStringFromErrorType(err.error); if (err.frame < nFrames / 3) { text += " at the beginning. "; } else if (err.frame < 2 * nFrames / 3) { text += " during the middle. "; } else { text += " near the end. "; } if (errorDict.ContainsKey(text)) { errorDict[text] += 1; } else { errorDict[text] = 1; } } List<string> comments = errorDict.Keys.ToList(); comments.Sort((k1, k2) => errorDict[k1].CompareTo(errorDict[k2])); comments.Reverse(); string speech = ""; for (int i = 0; i < Math.Min(numberErrorsMentioned, comments.Count); i++) { if (errorDict[comments[i]] < frameErrorMinimum) { break; } speech += comments[i]; } if (speech.Equals("")) { speech = "No significant errors found."; } Speak(speech); }
public void AddPhoneOptions(IEnumerable<IPhoneDeviceInfo> phoneDevices) { List<IPhoneDeviceInfo> phoneDevicesLocal = new List<IPhoneDeviceInfo>(phoneDevices); phoneDevicesLocal.Sort(ComparePhones); foreach (IPhoneDeviceInfo phoneDevice in phoneDevicesLocal) { Items.Add(new PhoneDeviceListItem(phoneDevice)); } }
// Functions public static string[] GetFiles(string path, string searchPattern, SearchOption searchOption) { // Splits the search patterns up so that each can be called individually string[] searchPatterns = searchPattern.Split(';'); List<string> files = new List<string>(); foreach (string sp in searchPatterns) files.AddRange(Directory.GetFiles(path, sp, searchOption)); files.Sort(); return files.ToArray(); }
/// <summary> /// Constructeur de la fenetre de gestion des stades. /// </summary> public GestionDesStades() { InitializeComponent(); // On recupere la liste des equipes et de l'afficher var stades = new List<Stade>(); stades = BusinessManager.getStades(); stades.Sort(); lvStades.ItemsSource = stades; }
/// <summary> /// Constructeur de la fenetre de gestion des coupes. /// </summary> public GestionDesCoupes() { InitializeComponent(); // On recupere la liste des coupes et on les affiches var coupes = new List<Coupe>(); coupes = BusinessManager.getCoupes(); coupes.Sort(); lbCoupes.ItemsSource = coupes; }
/// <summary> /// Constructeur de la fenetre de la gestion des equipes. /// </summary> public GestionDesEquipes() { InitializeComponent(); // On recupere la liste des coupes et on les affiches var equipes = new List<Equipe>(); equipes = BusinessManager.getEquipes(); equipes.Sort(); lvEquipes.ItemsSource = equipes; }
public ComplexSampleMeansProperties( DashboardHelper dashboardHelper, IGadget gadget, ComplexSampleMeansParameters parameters, List<Grid> strataGridList ) { InitializeComponent(); this.DashboardHelper = dashboardHelper; this.Gadget = gadget; this.Parameters = parameters; List<string> fields = new List<string>(); List<FieldInfo> items = new List<FieldInfo>(); List<string> crosstabFields = new List<string>(); List<string> strataFields = new List<string>(); crosstabFields.Add(string.Empty); items.Add(new FieldInfo() { Name = "", DataType = "", VariableCategory = VariableCategory.Field }); foreach (string fieldName in DashboardHelper.GetFieldsAsList()) { items.Add(new FieldInfo() { Name = fieldName, DataType = DashboardHelper.GetColumnDbType(fieldName).ToString(), VariableCategory = VariableCategory.Field }); fields.Add(fieldName); crosstabFields.Add(fieldName); strataFields.Add(fieldName); } fields.Sort(); crosstabFields.Sort(); cbxField.ItemsSource = fields; cbxFieldWeight.ItemsSource = fields; cbxFieldCrosstab.ItemsSource = crosstabFields; cbxFieldStrata.ItemsSource = strataFields; cbxFieldPSU.ItemsSource = strataFields; CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(cbxField.ItemsSource); PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory"); view.GroupDescriptions.Add(groupDescription); RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as ComplexSampleMeansControl).DataFilters, true); RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; panelFilters.Children.Add(RowFilterControl); }
/// <summary> /// 计算签名 /// 此方法传入的是所有签名需要的参数 /// </summary> /// <param name="paras">传入需要的参数</param> /// <returns></returns> public static string CalSig(List<APIParameter> paras) { paras.Sort(new ParameterComparer()); StringBuilder sbList = new StringBuilder(); foreach (APIParameter para in paras) { sbList.AppendFormat("{0}={1}", para.Name, para.Value); } sbList.Append(ConstantValue.SecretKey); return ApiHelper.MD5Encrpt(sbList.ToString()); }
private void InitComboBox() { List<FontFamily> ffList = new List<FontFamily>(); ffList.AddRange(Fonts.SystemFontFamilies); ffList.Sort(new Comparison<FontFamily>((ff1,ff2)=> string.Compare(ff1.Source, ff2.Source))); foreach (FontFamily ff in ffList) { cbFont.Items.Add(ff); } }
public SelectAdditionalProcesses() { InitializeComponent(); CurrentProcesses = new List<string>(); Process[] active = Process.GetProcesses(); foreach (Process p in active) CurrentProcesses.Add(p.ProcessName); CurrentProcesses.Sort(); }
protected override Size MeasureOverride(Size availableSize) { double totWidth = 0; //double maxHeight = 0; if (Children.Count == 0) return base.MeasureOverride(availableSize); List<UIElement> childsOrderedByWidth = new List<UIElement>(); foreach (FrameworkElement child in Children) { child.Width = double.NaN; child.Height = double.NaN; child.Measure(new Size(double.PositiveInfinity, availableSize.Height)); totWidth += child.DesiredSize.Width; childsOrderedByWidth.Add(child); } if (totWidth > availableSize.Width) { childsOrderedByWidth.Sort(delegate(UIElement elem1, UIElement elem2) { return elem2.DesiredSize.Width.CompareTo(elem1.DesiredSize.Width); }); int i = childsOrderedByWidth.Count - 1; double sumWidth = 0; while (childsOrderedByWidth[i].DesiredSize.Width * (i + 1) + sumWidth < availableSize.Width) { sumWidth += childsOrderedByWidth[i].DesiredSize.Width; i--; if (i < 0) break; } double shWidth = (availableSize.Width - sumWidth) / (i + 1); foreach (UIElement child in Children) { if (shWidth < child.DesiredSize.Width) child.Measure(new Size(shWidth, availableSize.Height)); } } return base.MeasureOverride(availableSize); }
/// <summary> /// Constructeur de la fenetre de gestion des matchs. /// </summary> public GestionDesMatchs() { InitializeComponent(); // On recupere la liste des coupes et on les charge dans la liste box var coupes = new List<Coupe>(); coupes = BusinessManager.getCoupes(); coupes.Sort(); cbCoupes.ItemsSource = coupes; // On initialise la liste des joueurs avec la premiere equipe cbCoupes_SelectionChanged(cbCoupes, null); }
public LetterWindow(List<SessionRow> sessions, LetterTemplate letterTemplate) { InitializeComponent(); tbKenmerk.Text = letterTemplate.Kenmerk; tbContactpersonen.Text = letterTemplate.Contactpersonen; tbTelefoon.Text = letterTemplate.Telefoon; tbEmail.Text = letterTemplate.Email; tbAvansAdres.Text = letterTemplate.AvansAdres; tbAvansLocatie.Text = letterTemplate.AvansLocatie; tbBeginKern.Text = letterTemplate.BeginKern; tbReisInformatie.Text = letterTemplate.ReisInformatie; tbVerdereInformatie.Text = letterTemplate.VerdereInformatie; tbAfzenders.Text = letterTemplate.Afzenders; tbBijlagen.Text = letterTemplate.Bijlagen; tbVoettekstLinks.Text = letterTemplate.VoettekstLinks; tbVoettekstMidden.Text = letterTemplate.VoettekstCenter; tbVoettekstRechts.Text = letterTemplate.VoettekstRechts; _experts = new List<Expert>(); _receivers = new Dictionary<int, Expert>(); _sessions = sessions; // Note: Dit ziet er misschien klote uit, maar een List.Contains check schijnt niet te werken(mogelijk zijn er dubbele expert objecten?) Dictionary<int, Expert> experts = new Dictionary<int, Expert>(); foreach (SessionRow session in sessions) { Session sessionModel = session.GetSessionModel(); foreach (KeyValuePair<int, Expert> keyValuePair in sessionModel.Experts) { if(!experts.ContainsKey(keyValuePair.Key)) experts.Add(keyValuePair.Key, keyValuePair.Value); } } // En nu weer naar een List omdat Dictionary faalt en niet kan sorten foreach (KeyValuePair<int, Expert> keyValuePair in experts) _experts.Add(keyValuePair.Value); _experts.Sort(); ExpertsToevoegen(); _controller = PAZController.GetInstance(); _ini = _controller.IniReader; _letterTemplate = letterTemplate; btnSave.IsEnabled = false; }
public void SetFormattedText (FormattedText text) { var atts = new List<Drawing.TextAttribute> (text.Attributes); atts.Sort ((a, b) => { var c = a.StartIndex.CompareTo (b.StartIndex); if (c == 0) c = -(a.Count.CompareTo (b.Count)); return c; }); int i = 0, attrIndex = 0; Label.TextBlock.Inlines.Clear (); GenerateBlocks (Label.TextBlock.Inlines, text.Text, ref i, text.Text.Length, atts, ref attrIndex); }
private void LoadHelpTopics(List<HelpTopic> helpTopics, Exception e) { if (e != null) { isBusyIndicator.IsBusy = false; } if (helpTopics != null && helpTopics.Count > 0) { isBusyIndicator.IsBusy = false; helpTopics.Sort(TopicAddedDateComparer); this.listBox1.ItemsSource = helpTopics; } }
public void SetNonOverflowButton(ToolboxButton button) { ToolboxButton currentNonOverflowButton = this.Children.OfType<ToolboxButton>().First(); if (currentNonOverflowButton != button) { List<ToolboxButton> allButtons = new List<ToolboxButton>(); allButtons.Add(currentNonOverflowButton); foreach (ToolboxButton item in Overflow.Items) allButtons.Add(item); allButtons.Remove(button); allButtons.Sort(delegate(ToolboxButton one, ToolboxButton two) { return one.DisplayIndex.CompareTo(two.DisplayIndex); }); Overflow.Items.Clear(); allButtons.ForEach(delegate(ToolboxButton item) { Overflow.Items.Add(item); }); } }
public ComboBox loadCatalogue(ComboBox data) { MakerspaceDataDataContext db = new MakerspaceDataDataContext(); var query = from e in db.Inventories select e; var listItems=query.ToList(); List<string> ItemIDs=new List<string>(); foreach( var i in listItems){ ItemIDs.Add( i.ItemID); }; ItemIDs.Sort(); data.ItemsSource = ItemIDs; data.SelectedIndex = 0; return data; }
private void btnDraw_Click(object sender, RoutedEventArgs e) { int drawNum = 0; List<int> lottoRivi = new List<int>(); if (Int32.TryParse(txtDrawNum.Text, out drawNum)) { for (int i = 0; i < drawNum; i++) { lottoRivi = lottoKone.ArvoRivi(cmbType.Text); lottoRivi.Sort(); lottoRivi.ForEach(Tulosta); lottoRivi.Clear(); txtResult.Text += Environment.NewLine; } } }
public EmailWindow(List<SessionRow> sessions, EmailTemplate emailTemplate) { InitializeComponent(); tbAfzender.Text = emailTemplate.Displayname; tbInleiding.Text = emailTemplate.Inleiding; tbInformatie.Text = emailTemplate.Informatie; tbAfsluiting.Text = emailTemplate.Afsluiting; tbAfzenders.Text = emailTemplate.Afzenders; _teachers = new List<Teacher>(); _students = new List<Student>(); _receivers = new List<User>(); _sessions = sessions; // Note: Dit ziet er misschien klote uit, maar een List.Contains check schijnt niet te werken(mogelijk zijn er dubbele teacher objecten?) Dictionary<int, Teacher> teachers = new Dictionary<int, Teacher>(); foreach (SessionRow session in sessions) { Session sessionModel = session.GetSessionModel(); foreach(KeyValuePair<int, Teacher> keyValuePair in sessionModel.Teachers) if (!teachers.ContainsKey(keyValuePair.Key)) teachers.Add(keyValuePair.Key, keyValuePair.Value); _students.Add(sessionModel.Pair.Student1); _students.Add(sessionModel.Pair.Student2); } // En nu weer naar een List omdat Dictionary faalt en niet kan sorten foreach (KeyValuePair<int, Teacher> keyValuePair in teachers) _teachers.Add(keyValuePair.Value); _students.Sort(); _teachers.Sort(); StudentenToevoegen(); DocentenToevoegen(); _controller = PAZController.GetInstance(); _ini = _controller.IniReader; _emailTemplate = emailTemplate; btnSave.IsEnabled = false; }