private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { txbSubId.Text = subjectViewInfo.SubjectInfo.SUBJECTID.ToString() + "."; txbSubContent.Text = subjectViewInfo.SubjectInfo.CONTENT; System.Linq.IOrderedEnumerable <T_OA_REQUIREDETAIL> oanswerList = subjectViewInfo.AnswerList.OrderBy(ee => ee.CODE); foreach (T_OA_REQUIREDETAIL i in oanswerList) { if (i.CONTENT != "无") { //根据答案 获取每个答案的统计结果 V_SSubjectAnswerResult v = null; if (_SubAnswerResult != null) { v = _SubAnswerResult.LstAnswer.FirstOrDefault(ee => ee.AnswerCode == i.CODE); } if (v == null) { v = new V_SSubjectAnswerResult(); } SurveyAnswer_1 sa = new SurveyAnswer_1(i.CODE, i.CONTENT, v.Count); spAnswerList.Children.Add(sa); } } }
public void NullSourceComparer() { #if !CISTERN_VALUELINQ System.Linq.IOrderedEnumerable <int> source = null; AssertExtensions.Throws <ArgumentNullException>("source", () => source.ThenByDescending(i => i, null)); #endif }
//internal static TextStyle ToMekanik(this SFML.Graphics.Text.Styles @this) { return (TextStyle)((int)@this); } ////internal static SFML.Graphics.Text.Styles ToSfml(this TextStyle @this) { return (SFML.Graphics.Text.Styles)((int)@this); } //internal static SFML.Graphics.Text.Styles ToSfml(this TextStyle @this) //{ // SFML.Graphics.Text.Styles @out = SFML.Graphics.Text.Styles.Regular; // for (int i = 0; i < 4; i++) // { // if (@this.HasFlag((TextStyle)i)) // @out |= (SFML.Graphics.Text.Styles)i; // } // return @out; //} public static Bunch <T> ToBunch <T>(this System.Linq.IOrderedEnumerable <T> @this) { return(new Bunch <T>() { @this.ToArray() }); }
// Sort notes into 2 groups- the one below center and one above void Sort(DateTime lower, DateTime upper) { List <CwaNote> notes = _Notes.Values.ToList(); _NotesSortedUpper = notes .Where(note => note.dtUnified > upper) .OrderBy(note => note.dtUnified); _NotesSortedLower = notes .Where(note => note.dtUnified < lower) .OrderByDescending(note => note.dtUnified); }
void OrderSource_QueryFBEntitiesCompleted(object sender, QueryFBEntitiesCompletedEventArgs e) { List <OrderEntity> list = e.Result.ToEntityAdapterList <OrderEntity>().ToList <OrderEntity>(); //this.OrderEntities = e.Result.ToEntityAdapterList<OrderEntity>(); //this.OrderEntities = e.Result.ToEntityAdapterList<OrderEntity>(); System.Linq.IOrderedEnumerable <OrderEntity> itest = from item in list orderby item.Entity.GetObjValue("UPDATEDATE") descending select item; this.OrderEntities = itest.ToList(); BindingData(this.OrderEntities); CloseProcess(); }
public static double MedianLow ( this Memory <uint> x ) { int n = x.Length; System.Linq.IOrderedEnumerable <uint> x_ordered = x.ToArray().OrderBy(x_i => x_i); int n2 = n / 2 - 1; if (n % 2 == 1) { return(x_ordered.ElementAt((n + 1) / 2 - 1)); } return(x_ordered.ElementAt(n2)); }
public void Run() { Console.WriteLine("{0,55}", "/// SHOW ALL LESSONS. ///"); Console.WriteLine(); List <Lesson> _lessons = new Database.CRUD().SelectLessons(); System.Linq.IOrderedEnumerable <Lesson> _sortedLesson = from u in _lessons orderby u.Name ascending select u; Console.WriteLine("{0,55}", "TABLE 'LESSONS'\n"); Console.WriteLine("| {0,-5} | {1,26} |", "ID", "NAME"); Console.WriteLine(); foreach (Lesson i in _sortedLesson) { Console.WriteLine("| {0,-5} | {1,26} |", i.LessonId, i.Name); } Console.ReadKey(); }
public void Run() { Console.WriteLine("{0,55}", "/// SHOW ALL AUTHORS. ///"); Console.WriteLine(); List <Author> _authors = new Database.CRUD().SelectAuthors(); System.Linq.IOrderedEnumerable <Author> _sortedAuthors = from u in _authors orderby u.AuthorId ascending select u; Console.WriteLine("{0,55}", "TABLE 'AUTHORS'\n"); Console.WriteLine("| {0,-5} | {1,15} | {2,15} |", "ID", "NAME", "SURNAME"); Console.WriteLine(); foreach (Author i in _authors) { Console.WriteLine("| {0,-5} | {1,15} | {2,15} |", i.AuthorId, i.Name, i.Surname); } Console.ReadKey(); }
public float GetValue(int x, int y, int z = 0, int pointIndex = 0) { if (_points == null) { throw new Exception("Call the Generate map method first."); } int max = Math.Max(Math.Max(Width, Height), Depth); int index = x + (y * Width) + (z * Width * Height); float[] distances = new float[_points.Length]; for (int i = 0; i < distances.Length; i++) { distances[i] = Map(Vector3.Distance(new Vector3(x, y, z), _points[i]), 0, max / 2, 0, 1); } System.Linq.IOrderedEnumerable <float> ordered = distances.OrderBy(d => d); return(ordered.ElementAt(pointIndex % NbOfPoints)); }
public void Preset() { _Dates = new Dates(); dtCalcCenter = dtCalcCenterRequested = DateTime.MinValue; Result = new Dictionary <StatProperty, int>(); ResultPreset(); _idPrev = String.Empty; _idNext = String.Empty; _NotesSortedUpper = null; _NotesSortedLower = null; _Worker = new BackgroundWorker(); _Worker.WorkerReportsProgress = false; _Worker.WorkerSupportsCancellation = false; _Worker.DoWork += Worker_DoWork; _Worker.RunWorkerCompleted += Worker_RunWorkerCompletedEventHandler; }
public void Run() { Console.WriteLine("{0,55}", "/// SHOW ALL BOOKS. ///"); Console.WriteLine(); List <Book> _books = new List <Book>(); _books = new Database.CRUD().SelectBooks(); System.Linq.IOrderedEnumerable <Book> _sortedBooks = from u in _books orderby u.Author.Surname ascending select u; Console.WriteLine("{0,55}", "TABLE 'BOOKS'\n"); Console.WriteLine("| {0,-5} | {1,25} | {2,15} | {3,15} | {4,20} | {5,20} |", "ID", "NAME", "YEAR OF PUBLISH", "AUTHOR NAME", "AUTHOR SURNAME", "IS AVAILABLE"); Console.WriteLine(); foreach (Book i in _sortedBooks) { Console.WriteLine("| {0,-5} | {1,25} | {2,15} | {3,15} | {4,20} | {5,20} |", i.BookId, i.Name, i.YearOfPublish, i.Author.Name, i.Author.Surname, i.IsAvailable); } Console.ReadKey(); }
public void Run() { Console.WriteLine("{0,55}", "/// SHOW ALL STUDENTS. ///"); Console.WriteLine(); List <Student> _studentList = new List <Student>(); _studentList = new Database.CRUD().SelectStudents(); System.Linq.IOrderedEnumerable <Student> _sortedStudentList = from u in _studentList orderby u.Course ascending select u; Console.WriteLine("{0,55}", "TABLE 'STUDENTS'\n"); Console.WriteLine("| {0,-5} | {1,15} | {2,15} | {3,20} | {4,8} | {5,15} |", "ID", "NAME", "SURNAME", "DATE OF BIRTH", "COURSE", "FACULTY"); Console.WriteLine(); foreach (Student i in _sortedStudentList) { Console.WriteLine("| {0,-5} | {1,15} | {2,15} | {3,20} | {4,8} | {5,15} |", i.StudentId, i.Name, i.Surname, i.BirthDate.ToString("yyyy.MM.dd"), i.Course, i.Faculty.Name); } Console.ReadKey(); }
private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { txbSubId.Text = subjectViewInfo.SubjectInfo.SUBJECTID.ToString() + "."; txbSubContent.Text = subjectViewInfo.SubjectInfo.CONTENT; System.Linq.IOrderedEnumerable <T_OA_REQUIREDETAIL> oanswerList = subjectViewInfo.AnswerList.OrderBy(ee => ee.CODE); foreach (T_OA_REQUIREDETAIL anserInfo in oanswerList) { if (anserInfo.CONTENT != "无") { SurveyAnswer sa = new SurveyAnswer(anserInfo); sa.IsShowResult = isShowResult; if (isShowResult != 0 && isShowResult != 3) { txtComments.Visibility = Visibility.Collapsed; } if (resultDetail != null) { if (resultDetail.RESULT == anserInfo.CODE) { sa.IsSelected = true; if (resultDetail.CONTENT != null) { txtComments.Text = resultDetail.CONTENT; } } } spAnswerList.Children.Add(sa); } } ImageButton btn = new ImageButton(); btn.Margin = new Thickness(0); btn.AddButtonAction("/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/ico_16_4406in.png", Utility.GetResourceStr("OTHERSUGGEST")); btn.Click += new RoutedEventHandler(chk_Other); spAnswerList.Children.Add(btn); }
private void ProcessSeatlist(JSONObject messageObj) { List <JSONObject> tempDeskInfos = messageObj["body"]["desks"].list; System.Linq.IOrderedEnumerable <JSONObject> deskInfos = tempDeskInfos.OrderBy(obj => int.Parse(obj[0].ToString())); GameObject deskPrefab = DeskPrefab(); UIGrid desksGrid = (UIGrid)vDesks.GetComponent(typeof(UIGrid)); Vector2 padding = DeskPadding(); desksGrid.cellWidth = padding.x; desksGrid.cellHeight = padding.y; desksGrid.maxPerLine = DeskRowCount(); foreach (JSONObject deskInfo in deskInfos) { if (deskInfo.type == JSONObject.Type.NULL) { break; } string deskId = deskInfo[0].ToString(); bool isPlaying = deskInfo[1].b; List <JSONObject> seatInfos = deskInfo[2].list; GameObject desk = (GameObject)Instantiate(deskPrefab); desk.name = "Desk_" + deskId; desk.transform.parent = vDesks; desk.transform.localScale = Vector3.one; ((UILabel)desk.transform.Find("ID").GetComponentInChildren(typeof(UILabel))).text = deskId; UpdateDeskState(desk.transform, isPlaying); for (int j = 0; j < seatInfos.Count; j++) { Transform deskSeat = desk.transform.Find("Seat_" + j); if (deskSeat == null) { continue; } DeskSeatInfo seatInfo = (DeskSeatInfo)deskSeat.GetComponent(typeof(DeskSeatInfo)); seatInfo.deskId = deskId; seatInfo.seatId = j; UIButtonMessage messageButton = (UIButtonMessage)deskSeat.GetComponent(typeof(UIButtonMessage)); messageButton.target = this.gameObject; messageButton.functionName = "OnSeatButtonClick"; if (seatInfos[j].type == JSONObject.Type.ARRAY) { DoSitdown(deskSeat, seatInfos[j][0].ToString(), j, (int)seatInfos[j][1].n); } else { DoSitup(deskSeat); } } } desksGrid.repositionNow = true; }
private void contextMenu_BuildMenu(bool pbRebuild = true) { //try //{ // Remove any old column name items for (int i = theContextMenu.Items.Count - 1; i > 0; i--) { if (((MenuItem)theContextMenu.Items[i]).FontWeight != FontWeights.Bold) { theContextMenu.Items.Remove(theContextMenu.Items[i]); } } nBaseItems = theContextMenu.Items.Count; // Attach the context menu to the DataGrid ColumnHeaders var headersPresenter = WPFDataGridConfigurationBehaviorFinder.FindChild <DataGridColumnHeadersPresenter>(dataGrid); if (headersPresenter == null) { return; // dirty hack to fix a creahs when loading first different pages than the one containing this element } ContextMenuService.SetContextMenu(headersPresenter, theContextMenu); if (VisibleColumns == null) { throw (new SettingsPropertyNotFoundException("User's VisibleColumns setting not found.")); } // Get the current column ordering from user.config if (DisplayIndexes == null) { throw (new SettingsPropertyNotFoundException("User's DisplayIndexes setting not found.")); } AllColumnDisplayIndexes = DisplayIndexes; string[] colIndexes = AllColumnDisplayIndexes.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); System.Linq.IOrderedEnumerable <DataGridColumn> dataGridColumns = dataGrid.Columns.OrderBy(x => x.DisplayIndex); // Sort the columns in display index order so menu header order matchs display column order if (pbRebuild == false) { // Initially the datagrid column order is such that display indexes are the same as the col indexes if (colIndexes.Length > 0) { dataGridColumns = dataGrid.Columns.OrderBy(x => Convert.ToInt16(colIndexes[x.DisplayIndex])); } } if (mnuAlpha.IsChecked) { dataGridColumns = dataGrid.Columns.OrderBy(x => x.Header.ToString()); } System.Linq.IOrderedEnumerable <DataGridColumn> filteredDataGridColumns = null; if (wordFilter.Length > 1) { filteredDataGridColumns = dataGrid.Columns .Where(x => x.Header.ToString().Contains(wordFilter) == true).OrderBy(x => x.Header.ToString()); } if (filteredDataGridColumns != null) { dataGridColumns = filteredDataGridColumns; } if (wordFilter.Length == 1) { dataGridColumns = dataGrid.Columns .Where(x => x.Header.ToString().ToUpper().StartsWith(wordFilter.ToUpper()) == true).OrderBy(x => x.Header.ToString()); } AllColumnsHeaders = ""; foreach (DataGridColumn col in dataGridColumns) { // All column name to a list of all column headers for later use. AllColumnsHeaders = String.Format("{0};{1}", col.Header.ToString().Replace("\n", " ").Replace("\r", " "), AllColumnsHeaders); // Add new menu item in display order. contextMenu_AddNewMenuItem(col); } string sTemp = VisibleColumns; VisibleColumns = null; VisibleColumns = sTemp; //} //catch (Exception ex) //{ StdErrOut(ex, MethodInfo.GetCurrentMethod().Name); } }