public MainWindow() { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); InitializeComponent(); Uri uri = new Uri("DataTemplates.xaml", System.UriKind.Relative); ResourceDictionary resourceDico = (ResourceDictionary)System.Windows.Application.LoadComponent(uri); Resources.MergedDictionaries.Add(resourceDico); EditorLink.Instance.Init(this.renderControl.Handle, Resources); this.renderControl.Paint += new PaintEventHandler(simpleOpenGlControl_Paint); CompositionTargetEx.FrameUpdating += new EventHandler<RenderingEventArgs>(CompositionTargetEx_FrameUpdating); List<ObjectLink> entityList = new List<ObjectLink>(); entityList.Add(EditorLink.Instance.SpawnEntity(-10.0f, 0, 0)); entityList.Add(EditorLink.Instance.SpawnEntity(10.0f, 0, 0)); SimpleTest[] obj = new SimpleTest[2]; obj[0] = new SimpleTestA(); obj[1] = new SimpleTestB(); myPropertyGrid.SelectedObjects = entityList.ToArray(); propertygrid2.SelectedObjects = entityList.ToArray(); // o.PropertyChanged += new PropertyChangedEventHandler(o_PropertyChanged); }
public MainWindow() { InitializeComponent(); string[] clubnames ={ "AC Ajaccio", "AS Nancy-Lorraine" , "AS Saint-Etienne", "ESTAC Troyes", "Evian TG FC", "FC Lorient", "FC Sochaux-Montbéliard", "Girondins de Bordeaux", "LOSC Lille", "Montpellier Hérault SC", "OGC Nice", "Olympique de Marseille", "Olympique Lyonnais", "Paris Saint-Germain", "SC Bastia", "Stade Brestois 29", "Stade de Reims", "Stade Rennais FC", "Toulouse FC", "Valenciennes FC" }; List<Club> clubs = new List<Club>(); foreach (string clubname in clubnames) clubs.Add(new Club(clubname)); Ranking ranking = new Ranking(new FrenchLeague1PointSystem(), clubs.ToArray()); this.matchEditView.DataContext = new ViewModel.MatchViewModel(clubs, ranking); this.rankingView.DataContext = new ViewModel.RankingViewModel(ranking); }
public MainWindow() { InitializeComponent(); var reviews = new List<Review> { new Review(){Critic = "Wesley Morris" ,LetterGrade="B",ReviewSnippet="For better and worse, it weights nothing, which is not the same as saying it means nothing."}, new Review(){Critic ="Roger Ebert" ,LetterGrade="A-",ReviewSnippet="Like the hero of that film, the viewer of Inception is adrift in time and experience"}, new Review(){Critic ="Michael Phillips" ,LetterGrade="B",ReviewSnippet="Nolan conjures up a fever dream."}, //new Review(){Critic ="Joshua Flores" ,LetterGrade="B-",ReviewSnippet="Not great, interesting idea, and although the possibilities seem endless, Nolan had only proven he make use the same characters to be in 3 different action scenes at once."}, }; var reviews2 = new List<Review> { new Review(){Critic ="Michael Phillips" ,LetterGrade="B",ReviewSnippet="Nolan conjures up a fever dream."}, new Review(){Critic ="Roger Ebert" ,LetterGrade="A-",ReviewSnippet="Like the hero of that film, the viewer of Inception is adrift in time and experience"}, new Review(){Critic = "Wesley Morris" ,LetterGrade="B",ReviewSnippet="For better and worse, it weights nothing, which is not the same as saying it means nothing."}, new Review(){Critic ="Joshua Flores" ,LetterGrade="B-",ReviewSnippet="Not great, interesting idea, and although the possibilities seem endless, Nolan had only proven he make use the same characters to be in 3 different action scenes at once."}, }; var templates = new ScreenSavers[] { new ScreenSavers(){TemplateName = "Default", Screens = reviews.ToArray()}, new ScreenSavers(){TemplateName = "Ragnarock", Screens = reviews2.ToArray()} }; Code_Flextion_TPanel.ItemsSource = templates; }
public static string[] FlowDocumentToSlipPrinterFormat(FlowDocument document) { var result = new List<string>(); if (document != null) result.AddRange(ReadBlocks(document.Blocks)); return result.ToArray(); }
/// <summary> /// Construct the heading for a power. /// </summary> /// <param name="power"> /// The <see cref="Power"/> to consturct the /// </param> /// <returns> /// The header as a string encoded for HTML. /// </returns> /// <exception cref="ArgumentNullException"> /// No argument can be null. /// </exception> public string GetPowerHeading(Power power) { if (power == null) { throw new ArgumentNullException("power"); } StringBuilder result; List<string> additionalKeyWords; result = new StringBuilder(); result.AppendFormat(string.Format("{0} ", power.Name)); additionalKeyWords = new List<string>(); additionalKeyWords.Add(CharacterRendererHelper.GetActionType(power.Action)); if (power is AttackPower) { additionalKeyWords.Add("attack"); } else if (power.PowerSource != PowerSource.Item && power is UtilityPower) { additionalKeyWords.Add("utility"); } result.AppendFormat("({0})", string.Join("; ", additionalKeyWords.ToArray())); return result.ToString(); }
public MedicsWindow() { InitializeComponent(); medico = new Medicos(); medic = new Medic(); service = new Service(); speciality = new Speciality(); medics = medic.GetAll(); medicsGrid.ItemsSource = medics.ToArray(); services = service.GetAll(); foreach (ServicioMedico service in services) { comboService.Items.Add(service.nombre + " - " + service.descripcion); } specialities = speciality.GetAll(); foreach (Especialidades speciality in specialities) { comboSpeciality.Items.Add(speciality.nombre + " - " + speciality.descripcion); } }
/// <summary> /// 得到当前登录用户的好友列表,带scope参数 /// </summary> /// <param name="sessionkey">当前用户的session_key</param> /// <param name="userid">当前用户的id</param> /// <param name="callback">回调函数</param> /// <param name="scope">额外需要返回的字段,多个字段用逗号(,)隔开。目前支持如下字段: headurl_with_logo, tinyurl_with_logo</param> /// <param name="count">返回每页个数,默认为500</param> /// <param name="page">分页,默认为1</param> public void GetFriends(DownloadStringCompletedHandler callback,List<string> scope, int count ,int page) { string accessToken = RenrenSDK.RenrenInfo.tokenInfo.access_token; string callID = String.Format("{0}", DateTime.Now.Second); List<APIParameter> parameters = new List<APIParameter>() { new APIParameter("method",Method.GetFriends) }; parameters.Add(new APIParameter("access_token", accessToken)); parameters.Add(new APIParameter("call_id", callID)); parameters.Add(new APIParameter("v", "1.0")); parameters.Add(new APIParameter("userId", RenrenSDK.RenrenInfo.detailInfo.uid.ToString())); parameters.Add(new APIParameter("format", "JSON")); parameters.Add(new APIParameter("page", page.ToString())); if (count != 500) parameters.Add(new APIParameter("count", count.ToString())); if (scope != null && scope.Count > 0) { string[] arrScope = scope.ToArray<string>(); parameters.Add(new APIParameter("fields", String.Join(" ", arrScope))); } string strSig = ApiHelper.CalSig(parameters); if (strSig == "") return; parameters.Add(new APIParameter("sig", strSig)); RenrenWebRequest getFriendsAgent = new RenrenWebRequest(); getFriendsAgent.DownloadStringCompleted += new RenrenWebRequest.DownloadStringCompletedHandler(callback); getFriendsAgent.DownloadStringAsync(ConstantValue.RequestUri.ToString(), parameters); }
private void buttonClick(object sender, RoutedEventArgs e) { string[] info = ((Button)sender).Uid.Split(new string[] {","}, StringSplitOptions.RemoveEmptyEntries); List<armCommand> commands = new List<armCommand>(); foreach (string potentialCommand in info) { double val; if (double.TryParse(potentialCommand.Substring(potentialCommand.LastIndexOf(":") + 1) , out val)) { if (potentialCommand.StartsWith("SH:")) { commands.Add(new armCommand(val, armConstants.armActuatorID.shoulder)); } else if (potentialCommand.StartsWith("G:")) { commands.Add(new armCommand(val, armConstants.armActuatorID.grip)); } else if (potentialCommand.StartsWith("E:")) { commands.Add(new armCommand(val, armConstants.armActuatorID.elbow)); } else if (potentialCommand.StartsWith("TT:")) { commands.Add(new armCommand(val, armConstants.armActuatorID.turnTable)); } } } if (commands.Count > 0 && newMacroData != null) { newMacroData(commands.ToArray()); } }
static public string[] GetFiles(string path) { path = path.Replace("\\", "/"); List<string> files = Discovery.Resources; List<string> result = new List<string>(); foreach (string file in files) { int idx = file.IndexOf(";component/"); string f = file.Substring(idx + 11); if (f.Length >= path.Length && f.Substring(0, path.Length).ToLower() == path.ToLower()) { result.Add(file); } } files = Discovery.Content; foreach (string file in files) { int idx = file.IndexOf("/"); string f = file.Substring(idx + 1); if (f.Length >= path.Length && f.Substring(0, path.Length).ToLower() == path.ToLower()) { result.Add(file); } } return result.ToArray(); }
public static FrameworkElement Create(IClassificationFormatMap classificationFormatMap, string text, List<TextClassificationTag> tagsList, TextElementFlags flags) { bool useFastTextBlock = (flags & (TextElementFlags.TrimmingMask | TextElementFlags.WrapMask | TextElementFlags.FilterOutNewLines)) == (TextElementFlags.NoTrimming | TextElementFlags.NoWrap | TextElementFlags.FilterOutNewLines); bool filterOutNewLines = (flags & TextElementFlags.FilterOutNewLines) != 0; if (tagsList.Count != 0) { if (useFastTextBlock) { return new FastTextBlock((flags & TextElementFlags.NewFormatter) != 0, new TextSrc { text = ToString(text, filterOutNewLines), classificationFormatMap = classificationFormatMap, tagsList = tagsList.ToArray(), }); } var propsSpans = tagsList.Select(a => new TextRunPropertiesAndSpan(a.Span, classificationFormatMap.GetTextProperties(a.ClassificationType))); var textBlock = TextBlockFactory.Create(text, classificationFormatMap.DefaultTextProperties, propsSpans, TextBlockFactory.Flags.DisableSetTextBlockFontFamily | TextBlockFactory.Flags.DisableFontSize | (filterOutNewLines ? TextBlockFactory.Flags.FilterOutNewlines : 0)); textBlock.TextTrimming = GetTextTrimming(flags); textBlock.TextWrapping = GetTextWrapping(flags); return textBlock; } FrameworkElement fwElem; if (useFastTextBlock) { fwElem = new FastTextBlock((flags & TextElementFlags.NewFormatter) != 0) { Text = ToString(text, filterOutNewLines) }; } else { fwElem = new TextBlock { Text = ToString(text, filterOutNewLines), TextTrimming = GetTextTrimming(flags), TextWrapping = GetTextWrapping(flags), }; } return InitializeDefault(classificationFormatMap, fwElem); }
void buttonSave_Click(object sender, RoutedEventArgs e) { List<Participant> newParticipants = new List<Participant>(); foreach (Participant p in Participant.List) { if (p.AgeDivision == AgeDivisionButtons.SelectedValue + GenderButtons.SelectedValue && p.Team == TeamButtons.SelectedValue) { continue; } newParticipants.Add(p); } // todo: doesnt delete participant results, could be a problem foreach (Participant p in SelectedParticipants) { if (p.Id == null || p.FirstName == null || p.LastName == null || p.Id.Length == 0 || p.FirstName.Length == 0 || p.LastName.Length == 0) { continue; } p.AgeDivision = AgeDivisionButtons.SelectedValue + GenderButtons.SelectedValue; p.Team = TeamButtons.SelectedValue; newParticipants.Add(p); } Participant.Write(newParticipants.ToArray()); RefreshList(); }
public static void EmailWorkday(IEnumerable<Workday> workdays, String emailAddr) { if (workdays.Count() == 0) return; if (workdays.Count() == 1) { EmailWorkday(workdays.First(), emailAddr); return; } EmailComposeTask email = new EmailComposeTask(); IEnumerable<Workday> w = from wd in workdays orderby wd.StartTime select wd; email.Subject = "Timesheets for " + w.First().StartTime.ToString("D") + " to " + w.Last().StartTime.ToString("D"); List<String> texts = new List<String>(); foreach (Workday i in w) { texts.Add(EmailFormatWorkday(i)); } email.Body = String.Join(Environment.NewLine + "---" + Environment.NewLine + Environment.NewLine, texts.ToArray()); if (emailAddr != null) email.To = emailAddr; email.Show(); }
public static void CreateFileWithSPDate() { PropertyInfo[] pi = typeof(EquilendExcelDataObjectSingleCtpy).GetProperties(); List<string> data = new List<string>(); int i = 1; data.Add("CREATE TABLE #EQUILENDTable("); foreach (var pt in pi) { string n = pt.Name + " varchar(150),"; data.Add(n.PadRight(50) + "--" + i.ToString()); i++; } data.Add(")"); i = 1; data.Add(""); data.Add("INSERT INTO #EQUILENDTable("); foreach (var pt in pi) { string n = pt.Name + ","; data.Add(n.PadRight(50) + "--" + i.ToString()); i++; } data.Add(")"); data.Add("VALUES (" + Environment.NewLine + Environment.NewLine + ")"); File.WriteAllLines(AppDomain.CurrentDomain.BaseDirectory + "/AddToSP.txt", data.ToArray()); }
//for each image on the filesystem pipe through all the streams up to the server //Resize and produce all the images through the resizer and into memory streams //pass all the memory streams into the zipper //Pass the Zipper out put stream into teh request stream. public void ResizeAndZipToStream(Stream outputStream, params string[] filePaths) { var streams = new List<StreamHolder>(); MemoryStream ms; foreach (var path in filePaths) { var fs = File.OpenRead(path); { ms = new MemoryStream(); StreamUtils.Copy(fs, ms, buffer); string fileName = Path.GetFileName(path); string ext = Path.GetExtension(path); string prefix = Path.GetFileNameWithoutExtension(path); var streamHolder = new StreamHolder(ms, fileName); var sizes = new int[] { 100, 300, 500 }; foreach (int size in sizes) { ms.Seek(0, SeekOrigin.Begin); streams.Add(ImageResizer.ResizeStream(ms, prefix + "_" + size.ToString() + ext, size)); } } } Zipper.CreateZip(outputStream, streams.ToArray()); }
public static EnumFile[] EnumerateFiles(string folder) { InteropSvc.InteropLib.WIN32_FIND_DATA data; uint handle = InteropSvc.InteropLib.Instance.FindFirstFile7(folder + "\\*", out data); var list = new List<EnumFile>(); if (handle != 0xFFFFFFFFU) { bool result = false; do { if (data.cFileName != "." && data.cFileName != "..") { EnumFile ef = new EnumFile(); ef.FileName = data.cFileName; bool t = ((data.dwFileAttributes & 0x10) == 0x10) ? true : false; ef.isFolder = t ? true : false; list.Add(ef); } result = InteropSvc.InteropLib.Instance.FindNextFile7(handle, out data); } while (result != false); InteropSvc.InteropLib.Instance.FindClose7(handle); } return list.ToArray(); }
public EditParameterViewModel(OperationParameter parameter, ITestItemController testItemController) { this.parameter = parameter; this.testItemController = testItemController; ValidationModes = Enum.GetNames(typeof (OperationParameterValueMode)) .ToArray(); SaveParameterCommand = new DelegateCommand(ExecuteSaveParameterCommand); CancelParameterCommand = new DelegateCommand(ExecuteCancelParameterCommand); Value = parameter.Value.ToString(); SelectedValidationMode = parameter.Mode.ToString(); List<string> vars = new List<string>(); foreach (Variable variable in parameter.OwningTestItem.Test.Variables) { vars.Add(variable.Name); if (variable.VariableType == VariableType.TableValue) { foreach (DataColumn col in variable.DataTableValue.Columns) { vars.Add(variable.Name + "[" + col.ColumnName + "]"); } } } Variables = vars.ToArray(); }
private byte[] GetTextArray () { List<byte> byteList = new List<byte>(); string text = this.inputTextBox.Text; byteList.AddRange(Encoding.GetEncoding(1251).GetBytes(text)); return byteList.ToArray(); }
/// <summary> /// 登录接口 /// </summary> /// <param name="redirect_uri"></param> /// <param name="scope"></param> public void Login(string redirect_uri, List<string> scope) { if (redirect_uri == null) { return; } string uri = ConstantValue.LoginAuth; uri += "client_id=" + ConstantValue.ApiKey + "&" + "response_type=token"; if (scope != null && scope.Count > 0) { string[] arrScope = scope.ToArray<string>(); string scopeString = String.Join(" ", arrScope); uri += "&" + "scope=" + scopeString; } uri += "&" + "redirect_uri=" + redirect_uri + "&display=touch"; if (browserControl != null) { browserControl.SetUri(uri); browserControl.LoadCompleted -= new BrowserControl.LoadCompletedEventHandler(RenrenBrowser_LoadCompleted); browserControl.LoadCompleted += new BrowserControl.LoadCompletedEventHandler(RenrenBrowser_LoadCompleted); } else { return; } }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { lstOtherCandidates.Items.Clear(); empMoleGrid.Children.Clear(); if (elePanes.Count() <= 0) { MessageBox.Show("Elements are required to calculate the empirical formula. To do so, press 'Add Elements'."); return; } try { List<EmpiricalElement> input = new List<EmpiricalElement>(); foreach (ElementPane elePane in elePanes) { if (elePane.Percentage <= 0) { MessageBox.Show("Values cannot be below or equal to 0."); return; } input.Add(new EmpiricalElement(elePane.Percentage, PeriodicTable.elements[elePane.Index])); } List<Molecule> candidates = EmpiricalCalc.FindEmpiricalCandidates(1000, 0.05M, input.ToArray()); if (candidates.Count() <= 0) { return; } empMoleGrid.Children.Add(new MoleculePane(candidates[0])); try { for (int i = 1; i < candidates.Count(); i++) { lstOtherCandidates.Items.Add(new MoleculePane(candidates[i])); } } catch { } } catch { } }
public HistoryWindow() { InitializeComponent(); historial = new Historiales(); medic = new Medic(); user = new User(); history = new History(); medics = medic.GetAll(); users = user.GetAll(); histories = history.GetAll(); foreach (Usuarios user in users) { comboUsers.Items.Add(user.nombre + " " + user.apellidos); } foreach (Medicos medic in medics) { comboMedics.Items.Add(medic.nombre + " " + medic.apellidos); } historialGrid.ItemsSource = histories.ToArray(); }
private void NewButton_Clicked(object sender, RoutedEventArgs e) { Config c = new Config() { Name = "New Config", Standard = false, OptimizeLevel = 2, VerboseLevel = 1 }; List<Config> configList = new List<Config>(Program.Configs); configList.Add(c); Program.Configs = configList.ToArray(); ConfigListBox.Items.Add(new ListBoxItem() { Content = "New Config" }); }
private void Window_Loaded (object sender, RoutedEventArgs e) { String[] Rollen = LoginHandler.SetDataAccessSecurity(); List<String> AuthorityRoles = new List<string> (); List<String> GroupRoles = new List<string> (); List<String> AdditionalFunctions = new List<string> (); foreach (String Rolle in Rollen) { if (Rolle.IndexOf ("Redaktion") != -1) { AdditionalFunctions.Add (Rolle); continue; } if (Rolle.IndexOf ("Group") != -1) { GroupRoles.Add (Rolle); continue; } AuthorityRoles.Add (Rolle); } WMB.WPMediaApplicationState.Instance.Properties ["Rollen"] = AuthorityRoles.ToArray (); WMB.WPMediaApplicationState.Instance.Properties ["Groups"] = GroupRoles.ToArray (); WMB.WPMediaApplicationState.Instance.Properties ["AddOnFunctions"] = AdditionalFunctions.ToArray (); WMB.WPMediaApplicationState.Instance.Properties ["UserName"] = UsedUserName.ToUpper (); #if DEBUG if (!RunWPMediaCleanUp()) { Close(); return; } if (!RunWPMediaPublisher()) { Close(); return; } Close(); return; #endif if (!RunWPMediaCleanUp ()) { Close(); return; } if (!RunWordUpCleanUp ()) { Close(); return; } RunWPMediaPublisher (); RunWordUpPublisher (); Close (); }
public Estatisticas(List<string> aeroportos) { InitializeComponent(); label5.Content = "Número de aeroportos: " + aeroportos.ToArray<string>().Length.ToString(); comboBox.ItemsSource = aeroportos; comboBox1.ItemsSource = aeroportos; comboBox2.ItemsSource = aeroportos; ae = new Aeroporto.Aeroporto(); }
public void fill() { LocalList.ItemsSource = null; if ((Application.Current as App).estado == Estado.accepted && (Application.Current as App).state == WatcherState.active) { geolist = geolist.OrderBy(s => s.GetDistanceTo(watcher.Position.Location)).ToList(); loc = loc.OrderBy(i => geolist.IndexOf(new GeoCoordinate() { Latitude = i.latLocal, Longitude = i.longLocal })).ToList(); for (int i = 0; i < geolist.ToArray().Length; i++) { loc.ToArray()[i].distance = "~" + Math.Round((geolist.ToArray()[i].GetDistanceTo(watcher.Position.Location) / 1000), 1) + "km"; } LocalList.ItemsSource = loc; } else { LocalList.ItemsSource = loc; } }
/// <summary> /// 导出DataGrid数据到Excel /// </summary> /// <param name="withHeaders">是否需要表头</param> /// <param name="grid">DataGrid</param> /// <returns>Excel内容字符串</returns> public static string ExportDataGrid(bool withHeaders, DataGrid grid) { System.Reflection.PropertyInfo propInfo; System.Windows.Data.Binding binding; var strBuilder = new System.Text.StringBuilder(); DictionaryConverter dicConverter = new DictionaryConverter(); var source = (grid.ItemsSource as System.Collections.IList); if (source == null) return ""; var headers = new List<string>(); grid.Columns.ForEach(col => { if (col is DataGridBoundColumn) { string strHeader = ConvertDic(col.Header.ToString()); headers.Add(FormatCsvField(strHeader)); } }); strBuilder.Append(String.Join(",", headers.ToArray())).Append("\r\n"); foreach (Object data in source) { var csvRow = new List<string>(); foreach (DataGridColumn col in grid.Columns) { try { if (col is DataGridBoundColumn) { binding = (col as DataGridBoundColumn).Binding; string colPath = binding.Path.Path; string[] arr = colPath.Split('.'); string dicCategory = Convert.ToString(binding.ConverterParameter);//如有绑定字典值,则为字典类别 propInfo = data.GetType().GetProperty(colPath); object ob = data; if (arr.Length > 1) { ob = data.GetObjValue(arr[0]); propInfo = data.GetObjValue(arr[0]).GetType().GetProperty(arr[1]); } if (propInfo != null) { object obj = propInfo.GetValue(ob, null) == null ? null : propInfo.GetValue(ob, null).ToString(); obj = dicConverter.Convert(obj, null, dicCategory, null); string value = Convert.ToString(obj); csvRow.Add(FormatCsvField(value)); } } } catch { continue; } } strBuilder.Append(String.Join(",", csvRow.ToArray())).Append("\r\n"); } return strBuilder.ToString(); }
private void Button_Click(object sender, RoutedEventArgs e) { TextSearchR.Text = ""; ManagedClient user = new ManagedClient(); int port = Convert.ToInt32(Tport.Text); int LN = Convert.ToInt32(TLN.Text); string Msg = TCN.Text; for (int i = 0; i < l1.Items.Count; i++) Msg +="||"+l1.Items[i]; for (int i = 0; i < KeyWord.Items.Count; i++) Msg += "||#" + KeyWord.Items[i]; Random rd = new Random(); int rand = rd.Next(); port += rand % 100; string tport = port.ToString(); user.start(port, 5, 0, LN, Msg,tport); string useit = user.getResult(); string big = DateTime.Now.ToString(); string[] vect = useit.Split('?'); string display = ""; //for (int i = 1; i < vect.Length; i++) //{ // string[] vect2 = vect[i].Split('&'); // display = display + vect2[0] + "\n---Duration: " + vect2[1] + "ms\n---Endtime: " + big + "." + vect2[2] + "\n\n"; //} List<string> listArr = new List<string>(); for (int i = 1; i < vect.Length; i++) { string[] vect2 = vect[i].Split('&'); display = display + vect2[0] + "\n---Duration: " + vect2[1] + "ms\n---Endtime: " + big + "." + vect2[2] + "\n\n"; listArr.Add(vect2[1]); } string[] time = listArr.ToArray(); int amount = 0; int largest = 0; int shortest = 0; for (int i = 0; i < time.Length; i++) { int each = Convert.ToInt32(time[i]); if (each > largest) largest = each; if (i == 0) shortest = largest; if (each < shortest) shortest = each; amount += each; } int average = amount / time.Length; string Saverage = average.ToString(); STT4.Text = shortest.ToString()+"ms"; LGT_Copy2.Text = largest.ToString()+"ms"; Saverage += "ms"; UAV2.Text = Saverage; TextSearchR.Text = display; }
internal static string ToJson(ThemeGraphSize graphSize) { string json = ""; List<string> list = new List<string>(); list.Add(string.Format("\"maxGraphSize\":{0}", graphSize.MaxGraphSize.ToString(System.Globalization.CultureInfo.InvariantCulture))); list.Add(string.Format("\"minGraphSize\":{0}", graphSize.MinGraphSize.ToString(System.Globalization.CultureInfo.InvariantCulture))); json = string.Join(",", list.ToArray()); return json; }
private void PrintLottoRow(List<int> NumeroLista) { int[] taulukko = NumeroLista.ToArray(); for (int j = 0; j < taulukko.Length; j++) { txtLottoRows.Text += taulukko[j] + " "; } txtLottoRows.Text += "\n"; }
public Dictionary<string, object>[] getFiles() { List<Dictionary<string, object>> files = new List<Dictionary<string, object>>(); foreach (File file in _files) { files.Add(file.ToObject()); Moxie.blobPile.Add(file.id, file); } return files.ToArray(); }
public static object[] GetValues(Type type) { if (!type.IsEnum) throw new ArgumentException("Type '" + type.Name + "' is not an enum"); List<object> ltemp = new List<object>(); object[] values = ltemp.ToArray(); if (!Cache.TryGetValue(type, out values)) { System.Reflection.FieldInfo[] temp = type.GetFields(); foreach (System.Reflection.FieldInfo f in temp) { if (f.IsLiteral) ltemp.Add(f.GetValue(null)); } Cache[type] = values = ltemp.ToArray(); } return values; }