/// <summary> /// Executes the translation process. /// </summary> /// <param name="context">The compilation context.</param> public void Execute(CompilationContext context) { if (context == null || context.Model == null) return; if (context.OutputStream == null || !context.OutputStream.CanWrite) throw new CompilationException("The translation output stream is null or not writable."); var translationCtx = new TranslationContext(); translationCtx.OutputStream = context.OutputStream; // write enum declarations var enumTranslator = new EnumTranslator(); foreach (var item in context.Model.Enums) enumTranslator.Translate(item, translationCtx); // write class declarations var classTranslator = new ClassTranslator(); foreach (var item in ClassSorter.Sort(context.Model.Classes)) classTranslator.Translate(item, translationCtx); // write global statements if (context.Model.GlobalStatements.Any()) { translationCtx.WriteLine(); foreach (var item in context.Model.GlobalStatements) translationCtx.WriteModel(item); } }
private void RefreshAssortment() { this.titleText.text = EnumTranslator.Translate(this.activeFoodSlot.Type); foreach (var foodView in this.foodViews) { foodView.gameObject.SetActive(foodView.Food.Type == this.activeFoodSlot.Type); } this.crossButton.transform.SetAsLastSibling(); }
public EnumDecorator() { list = new List <EnumDescriber>(); Array arr = Enum.GetValues(typeof(T)); foreach (object o in arr) { list.Add(new EnumDescriber { Value = o.ToString(), Caption = EnumTranslator.Translate(typeof(T).Name, o.ToString()) }); } }
/// <summary> /// Retrieve an instance of the mapped class from a JDBC resultset. /// Implementors should handle possibility of null values. /// </summary> /// <param name="rs">a IDataReader</param> /// <param name="names">column names</param> /// <param name="owner">the containing entity</param> /// <returns></returns> /// <exception cref="HibernateException">HibernateException</exception> // /// <exception cref="SQLException">SQLException</exception> public object NullSafeGet(IDataReader rs, string[] names, object owner) { int ordinal = rs.GetOrdinal(names[0]); string dbValue = null; if (!rs.IsDBNull(ordinal)) { dbValue = rs.GetString(ordinal); } return(EnumTranslator.Translate <T>(dbValue)); }
private void RefreshCommon() { txtBaseDate.Text = _order.BaseDate.ToString(); //txtBuyerId.Text = _order.BuyerID.ToString(); txtCreatedAt.Text = _order.CreatedAt.ToString(); //txtPackageID.Text = _order.PackageID; //txtSellerId.Text = _order.SellerID.ToString(); txtServiceType.Text = _order.ServiceType.ToString(); txtStatus.Text = EnumTranslator.Translate("OrderStatus", _order.Status.ToString()); txtUniqueNumber.Text = _order.UniqueNumber; this.Text = "Заявка " + _order.UniqueNumber; //txtVendorID.Text = _order.VendorID.ToString(); txtVendorStatus.Text = EnumTranslator.Translate("OrderStatus", _order.VendorStatus.ToString()); txtVendorUniqueNumber.Text = _order.VendorUniqueNumber; }
private void CreateInfo(Skill skill) { if (this.header == null) { this.header = Instantiate(this.headerPrefab, this.container); } this.header.Construct(skill); CreateText().Text = " "; CreateText().Text = $"{I18N.Instance.Get("ui_target")}: {skill.UseStrategy.Name}"; CreateText().Text = $"{I18N.Instance.Get("ui_range")}: {skill.GetRangeString()}"; if (skill.AOE > 0) { CreateText().Text = $"{I18N.Instance.Get("ui_area")}: {EnumTranslator.Translate(skill.AOEShape)}"; CreateText().Text = $"{I18N.Instance.Get("ui_radius")}: {skill.AOE}"; } }
private static void achievementEvaluation(Subject subject, Document doc) { doc.Add(new Paragraph("OCENA OSIĄGNIĘCIA PRZEDMIOTOWYCH EFEKTÓW KSZTAŁCENIA") .SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER)); Table learningOutcomeTable = new Table(3); learningOutcomeTable.AddCell("Oceny (F – formująca (w trakcie semestru), P – podsumowująca(na koniec semestru)"); learningOutcomeTable.AddCell("Numer efektu kształcenia"); learningOutcomeTable.AddCell("Sposób oceny osiągnięcia efektu kształcenia"); subject.LearningOutcomeEvaluations.ForEach(loe => { learningOutcomeTable.AddCell(EnumTranslator.Translate(loe.GradingSystem.ToString())); learningOutcomeTable.AddCell(loe.LearningOutcomeSymbol); learningOutcomeTable.AddCell(loe.Description); }); doc.Add(learningOutcomeTable); }
public static List <KeyValuePair <int, string> > getModesList() { if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) { var flightModes = EnumTranslator.Translate <apmmodes>(); return(flightModes.ToList()); } else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) { var flightModes = EnumTranslator.Translate <ac2modes>(); return(flightModes.ToList()); } else if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover) { var flightModes = EnumTranslator.Translate <aprovermodes>(); return(flightModes.ToList()); } return(null); }
private void setCells(LearningOutcomeCategory enm, List <List <string> > items, int headers, Table tab) { if (items.Count > 0) { Cell categoryCell = new Cell(1, headers); categoryCell.SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER) .SetVerticalAlignment(iText.Layout.Properties.VerticalAlignment.MIDDLE) .SetFontSize(12); categoryCell.Add(new Paragraph(EnumTranslator.Translate(enm.ToString()))); tab.AddCell(categoryCell); items.ForEach(c => { foreach (string item in c) { tab.AddCell(new Cell().Add(new Paragraph(item))); } }); } }
//public static void LoadListControl<TEnum>(ComboBox control) where TEnum : struct //{ // control.DisplayMember = "DisplayName"; // control.ValueMember = "RawValue"; // control.DataSource = EnumTranslator.Translate<TEnum>(); //} //public static void LoadListControl<TEnum>(ComboBox control, TEnum selectedValue) where TEnum : struct //{ // control.DisplayMember = "DisplayName"; // control.ValueMember = "RawValue"; // control.DataSource = EnumTranslator.Translate<TEnum>(); // control.SelectedValue = selectedValue; //} //public static void LoadListControl<TEnum>(ComboBox control, TEnum selectedValue) //{ // PopulateHelper.LoadControl(control, EnumTranslator.Translate<TEnum>().ToList(), "RawValue", "DisplayName", EnumTranslator.Translate<TEnum>(selectedValue), string.Empty); //} //public static void LoadListControl<TEnum>(ComboBox control, TEnum selectedValue, string initialValue) where TEnum : struct //{ //} public static void LoadListControl <TEnum>(ComboBox control, object selectedValue, object initialValue) where TEnum : struct { control.BindingContext = new BindingContext(); control.Items.Clear(); control.DisplayMember = "DisplayName"; control.ValueMember = "RawValue"; if (initialValue != null) { control.Items.Add(initialValue); } foreach (var item in EnumTranslator.Translate <TEnum>().ToList()) { control.Items.Add(item); } if (selectedValue != null) { control.SelectedItem = selectedValue; } }
private void addLearningOutcomes(List <LearningOutcome> learningOutcomes, Document doc) { List <string> headers = new List <string>(); List <List <string> > cellsKnowledge = new List <List <string> >(); List <List <string> > cellsSkills = new List <List <string> >(); List <List <string> > cellsSocialCompetences = new List <List <string> >(); List <CategoryTableModel> categoryTableModels = new List <CategoryTableModel>(); fillHeaders(headers); learningOutcomes.ForEach(l => { List <string> cell = (typeof(LearningOutcome).GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(PdfNameAttribute))) .Select(prop => EnumTranslator.Translate(prop.GetValue(l)?.ToString() ?? ""))) .ToList(); fillSpecializationLists(l, cellsKnowledge, cellsSkills, cellsSocialCompetences, categoryTableModels, cell); }); generalLearningOutcomeTable(doc, headers, cellsKnowledge, cellsSkills, cellsSocialCompetences); specializationLearningOutcomeTable(doc, headers, categoryTableModels); }
private List <string> SetLectureRow(Lesson lesson, int headerCount) { List <string> row = new List <string>(); if (lesson is null) { for (int i = 0; i < headerCount; i++) { row.Add(""); } } else { row.Add(lesson.HoursAtUniversity.ToString()); row.Add(lesson.StudentWorkloadHours.ToString()); row.Add(EnumTranslator.Translate(lesson.FormOfCrediting.ToString())); row.Add(lesson.IsGroup ? "X" : ""); row.Add(lesson.Ects.ToString()); row.Add(lesson.EctsinclPracticalClasses.ToString()); row.Add(lesson.EctsinclDirectTeacherStudentContactClasses.ToString()); } return(row); }
public void Construct(ScenarioType type) { Type = type; this.label.text = EnumTranslator.Translate(type); }
public void Activate() { if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane) // APM { CB_simple1.Visible = false; CB_simple2.Visible = false; CB_simple3.Visible = false; CB_simple4.Visible = false; CB_simple5.Visible = false; CB_simple6.Visible = false; var flightModes = EnumTranslator.Translate <Common.apmmodes>(); CMB_fmode1.DataSource = flightModes.ToList(); CMB_fmode1.ValueMember = "Key"; CMB_fmode1.DisplayMember = "Value"; CMB_fmode2.DataSource = flightModes.ToList(); CMB_fmode2.ValueMember = "Key"; CMB_fmode2.DisplayMember = "Value"; CMB_fmode3.DataSource = flightModes.ToList(); CMB_fmode3.ValueMember = "Key"; CMB_fmode3.DisplayMember = "Value"; CMB_fmode4.DataSource = flightModes.ToList(); CMB_fmode4.ValueMember = "Key"; CMB_fmode4.DisplayMember = "Value"; CMB_fmode5.DataSource = flightModes.ToList(); CMB_fmode5.ValueMember = "Key"; CMB_fmode5.DisplayMember = "Value"; CMB_fmode6.DataSource = flightModes.ToList(); CMB_fmode6.ValueMember = "Key"; CMB_fmode6.DisplayMember = "Value"; try { CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE1"].ToString())); CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE2"].ToString())); CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE3"].ToString())); CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE4"].ToString())); CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE5"].ToString())); CMB_fmode6.Text = Common.apmmodes.MANUAL.ToString(); CMB_fmode6.Enabled = false; } catch { } } else if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduRover) // APM { CB_simple1.Visible = false; CB_simple2.Visible = false; CB_simple3.Visible = false; CB_simple4.Visible = false; CB_simple5.Visible = false; CB_simple6.Visible = false; var flightModes = EnumTranslator.Translate <Common.aprovermodes>(); CMB_fmode1.DataSource = flightModes.ToList(); CMB_fmode1.ValueMember = "Key"; CMB_fmode1.DisplayMember = "Value"; CMB_fmode2.DataSource = flightModes.ToList(); CMB_fmode2.ValueMember = "Key"; CMB_fmode2.DisplayMember = "Value"; CMB_fmode3.DataSource = flightModes.ToList(); CMB_fmode3.ValueMember = "Key"; CMB_fmode3.DisplayMember = "Value"; CMB_fmode4.DataSource = flightModes.ToList(); CMB_fmode4.ValueMember = "Key"; CMB_fmode4.DisplayMember = "Value"; CMB_fmode5.DataSource = flightModes.ToList(); CMB_fmode5.ValueMember = "Key"; CMB_fmode5.DisplayMember = "Value"; CMB_fmode6.DataSource = flightModes.ToList(); CMB_fmode6.ValueMember = "Key"; CMB_fmode6.DisplayMember = "Value"; try { CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE1"].ToString())); CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE2"].ToString())); CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE3"].ToString())); CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE4"].ToString())); CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE5"].ToString())); CMB_fmode6.Text = Common.aprovermodes.MANUAL.ToString(); CMB_fmode6.Enabled = false; } catch { } } else if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 { var flightModes = EnumTranslator.Translate <Common.ac2modes>(); CMB_fmode1.DataSource = flightModes.ToList(); CMB_fmode1.ValueMember = "Key"; CMB_fmode1.DisplayMember = "Value"; CMB_fmode2.DataSource = flightModes.ToList(); CMB_fmode2.ValueMember = "Key"; CMB_fmode2.DisplayMember = "Value"; CMB_fmode3.DataSource = flightModes.ToList(); CMB_fmode3.ValueMember = "Key"; CMB_fmode3.DisplayMember = "Value"; CMB_fmode4.DataSource = flightModes.ToList(); CMB_fmode4.ValueMember = "Key"; CMB_fmode4.DisplayMember = "Value"; CMB_fmode5.DataSource = flightModes.ToList(); CMB_fmode5.ValueMember = "Key"; CMB_fmode5.DisplayMember = "Value"; CMB_fmode6.DataSource = flightModes.ToList(); CMB_fmode6.ValueMember = "Key"; CMB_fmode6.DisplayMember = "Value"; try { CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE1"].ToString())); CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE2"].ToString())); CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE3"].ToString())); CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE4"].ToString())); CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE5"].ToString())); CMB_fmode6.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE6"].ToString())); CMB_fmode6.Enabled = true; int simple = int.Parse(MainV2.comPort.MAV.param["SIMPLE"].ToString()); CB_simple1.Checked = ((simple >> 0 & 1) == 1); CB_simple2.Checked = ((simple >> 1 & 1) == 1); CB_simple3.Checked = ((simple >> 2 & 1) == 1); CB_simple4.Checked = ((simple >> 3 & 1) == 1); CB_simple5.Checked = ((simple >> 4 & 1) == 1); CB_simple6.Checked = ((simple >> 5 & 1) == 1); } catch { } } timer.Tick += new EventHandler(timer_Tick); timer.Enabled = true; timer.Interval = 100; timer.Start(); }
public static void Bind <TEnum>(ComboBox control, TEnum selectedValue) where TEnum : struct { Bind <Translation <TEnum>, string, int>(control, EnumTranslator.Translate <TEnum>().ToList(), "DisplayName", "RawValue", "", EnumTranslator.Translate <TEnum>(selectedValue).DisplayName); }
public static Table appendToTable(int i, int[] acc, Subject subject, Lesson lesson, Table tab) { if (subject is null) { return(tab); } // lp tab.AddCell(moduleTabCell(i.ToString())); // kod kursu var sufix = EnumTranslator.Translate(lesson.LessonType.ToString()).Substring(0, 1).ToUpper(); tab.AddCell(moduleTabCell(subject.Code + sufix + (lesson.IsGroup ? "p" : ""))); // nazwa kursu tab.AddCell(moduleTabCell(subject.NamePl + (subject.Lessons.Any(l => l.IsGroup) ? "GK" : ""))); // w acc[0] += lesson.LessonType == LessonType.Lecture ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Lecture ? (lesson.HoursAtUniversity / 15).ToString() : "")); // ćw acc[1] += lesson.LessonType == LessonType.Classes ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Classes ? (lesson.HoursAtUniversity / 15).ToString() : "")); // l acc[2] += lesson.LessonType == LessonType.Laboratory ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Laboratory ? (lesson.HoursAtUniversity / 15).ToString() : "")); // p acc[3] += lesson.LessonType == LessonType.Project ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Project ? (lesson.HoursAtUniversity / 15).ToString() : "")); // s acc[4] += lesson.LessonType == LessonType.Seminar ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Seminar ? (lesson.HoursAtUniversity / 15).ToString() : "")); // symbol efektu uczenia tab.AddCell(moduleTabCell(subject.LearningOutcomeEvaluations.Aggregate("", (los, next) => los += next.LearningOutcomeSymbol + "\n", los => los))); // ZZU acc[5] += lesson.HoursAtUniversity; tab.AddCell(moduleTabCell(lesson.HoursAtUniversity.ToString())); //CNPS acc[6] += lesson.StudentWorkloadHours; tab.AddCell(moduleTabCell(lesson.StudentWorkloadHours.ToString())); //"łączna" acc[7] += lesson.Ects; tab.AddCell(moduleTabCell(lesson.Ects.ToString())); //"zajęć BK" acc[8] += lesson.EctsinclDirectTeacherStudentContactClasses; tab.AddCell(moduleTabCell(lesson.EctsinclDirectTeacherStudentContactClasses.ToString())); //"Forma kursu/grupy kursów" tab.AddCell(moduleTabCell("T")); //"Sposób zaliczenia" tab.AddCell(moduleTabCell(EnumTranslator.Translate(lesson.FormOfCrediting.ToString()))); //"ogólnouczelniany" tab.AddCell(moduleTabCell(subject.ModuleType == ModuleType.General ? "T" : "")); //"o charakterze praktycznym" tab.AddCell(moduleTabCell(lesson.LessonType == LessonType.Project || lesson.LessonType == LessonType.Laboratory ? $"P({lesson.Ects})" : "")); //"rodzaj" tab.AddCell(moduleTabCell(EnumTranslator.Translate(subject.ModuleType.ToString()))); //"typ" tab.AddCell(moduleTabCell(EnumTranslator.Translate(subject.TypeOfSubject.ToString()))); return(tab); }
public List <string> Verify(Syllabus syllabus) { var errors = new List <string>(); // description if (syllabus.Description.NumOfSemesters < 1 || syllabus.Description.NumOfSemesters > 10) { errors.Add("Niepoprawna liczba semestrów. (Dopuszczalne wartości 1-10)"); } if (string.IsNullOrWhiteSpace(syllabus.Description.Prerequisites) || syllabus.Description.Prerequisites == ".") { errors.Add("Nieuzupełnione pole Wymagania wstępne."); } if (string.IsNullOrWhiteSpace(syllabus.Description.EmploymentOpportunities) || syllabus.Description.EmploymentOpportunities == ".") { errors.Add("Nieuzupełnione pole Sylwetka absolwenta."); } if (string.IsNullOrWhiteSpace(syllabus.Description.PossibilityOfContinuation) || syllabus.Description.PossibilityOfContinuation == ".") { errors.Add("Nieuzupełnione pole Możliwość kontynuacji studiów."); } if (syllabus.FieldOfStudy.Type == CourseType.FullTime && syllabus.FieldOfStudy.Level == DegreeLevel.FirstLevel && syllabus.Description.NumOfSemesters < 6) { errors.Add($"Studia stacjonarne pierwszego stopnia muszą trwać co najmniej 6 semestrów. Podana liczba semestrów: {syllabus.Description.NumOfSemesters}"); } // subjects var wrongSubjects = syllabus.SubjectDescriptions.Where(sd => sd.AssignedSemester > syllabus.Description.NumOfSemesters); foreach (var subject in wrongSubjects) { errors.Add($"Przedmiot {subject.Subject.Code} \"{subject.Subject.NamePl}\" posiada niepoprawny przypisany semestr."); } wrongSubjects = syllabus.SubjectDescriptions.Where(sd => sd.CompletionSemester != null && sd.AssignedSemester > sd.CompletionSemester); foreach (var subject in wrongSubjects) { errors.Add($"Przedmiot {subject.Subject.Code} \"{subject.Subject.NamePl}\" posiada przypisany semestr większy niż semestr ukończenia."); } // obligatory fields if (string.IsNullOrWhiteSpace(syllabus.ThesisCourse) || syllabus.ThesisCourse == ".") { errors.Add("Nieuzupełnione pole Praca dyplomowa."); } if (string.IsNullOrWhiteSpace(syllabus.ScopeOfDiplomaExam) || syllabus.ScopeOfDiplomaExam == ".") { errors.Add("Nieuzupełnione pole Zakres egzaminu dyplomowego."); } if (string.IsNullOrWhiteSpace(syllabus.IntershipType) || syllabus.IntershipType == ".") { errors.Add("Nieuzupełnione pole Praktyki."); } // ects var semestersSubjects = syllabus.SubjectDescriptions.Where(s => s.AssignedSemester > 0) .GroupBy(s => s.AssignedSemester); foreach (var semesterSubjects in semestersSubjects) { var totalEctsForSem = semesterSubjects.Sum(s => s.Subject.Lessons.Sum(l => l.Ects)); if (totalEctsForSem != 30) { errors.Add($"Semestr: {semesterSubjects.Key}. Liczba ECTS przypisanych przedmiotów ({totalEctsForSem}) jest niezgodna z oczekiwaną liczbą ECTS (30)."); } var totalStudentWorkload = semesterSubjects.Sum(s => s.Subject.Lessons.Sum(l => l.StudentWorkloadHours)); if (totalStudentWorkload < 750 || totalStudentWorkload > 900) { errors.Add($"Semestr: {semesterSubjects.Key}. Liczba godzin CNPS ({totalStudentWorkload}) poza dopuszczalnym przedziałem 750 - 900."); } } // elective subjects var subjectGroups = syllabus.SubjectDescriptions.Where(s => s.Subject.TypeOfSubject == TypeOfSubject.Elective) .GroupBy(s => new { s.Subject.ModuleType, s.Subject.KindOfSubject }); foreach (var subjectGroup in subjectGroups) { if (subjectGroup.Select(s => s.Subject.Lessons.Sum(l => l.Ects)).Distinct().Count() > 1) { errors.Add($"Grupa: {EnumTranslator.Translate(subjectGroup.Key.ModuleType.ToString())} {EnumTranslator.Translate(subjectGroup.Key.KindOfSubject.ToString())}. W grupie kursów wybieralnych nie może być przedmiotów o różnej liczbie ECTS."); } } // point limits foreach (var limit in syllabus.PointLimits) { var totalSubjectEcts = syllabus.SubjectDescriptions.Where(s => s.Subject.ModuleType == limit.ModuleType && (limit.KindOfSubject is null || s.Subject.KindOfSubject == limit.KindOfSubject) && (limit.TypeOfSubject is null || s.Subject.TypeOfSubject == limit.TypeOfSubject)) .Sum(s => s.Subject.Lessons.Sum(l => l.Ects)); if (totalSubjectEcts < limit.Points) { errors.Add($"Grupa: {EnumTranslator.Translate(limit.ModuleType.ToString())} {EnumTranslator.Translate(limit.KindOfSubject?.ToString() ?? string.Empty)} {EnumTranslator.Translate(limit.TypeOfSubject?.ToString() ?? string.Empty)}. Liczba punktów ECTS poniżej limitu ({limit.Points})."); } } // practical lessons var practicalLessons = syllabus.SubjectDescriptions.Where(s => s.AssignedSemester > 0).SelectMany(s => s.Subject.Lessons.Where(l => l.LessonType != LessonType.Lecture)); var practicalEcts = practicalLessons.Sum(l => l.Ects); if ((double)practicalEcts / syllabus.Description.Ects < 0.3) { errors.Add($"Zajęcia kształtujące umiejętności praktyczne posiadają mniej niż 30% punktów ECTS ({(int)((double)practicalEcts / syllabus.Description.Ects * 100)}%)"); } var practicalHours = practicalLessons.Sum(l => l.HoursAtUniversity); var totalHours = syllabus.SubjectDescriptions.Where(s => s.AssignedSemester > 0) .Sum(s => s.Subject.Lessons.Sum(l => l.HoursAtUniversity)); if ((double)practicalHours / totalHours < 0.4) { errors.Add($"Zajęcia kształtujące umiejętności praktyczne posiadają mniej niż 40% godzin ({(int)((double)practicalHours / totalHours * 100)}%)"); } return(errors); }
private void ConfigFlightModes_Load(object sender, EventArgs e) { if (!MainV2.comPort.BaseStream.IsOpen) { this.Enabled = false; return; } else { this.Enabled = true; } if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) // APM { CB_simple1.Visible = false; CB_simple2.Visible = false; CB_simple3.Visible = false; CB_simple4.Visible = false; CB_simple5.Visible = false; CB_simple6.Visible = false; var flightModes = EnumTranslator.Translate<Common.apmmodes>(); CMB_fmode1.DataSource = flightModes.ToList(); CMB_fmode1.ValueMember = "Key"; CMB_fmode1.DisplayMember = "Value"; CMB_fmode2.DataSource = flightModes.ToList(); CMB_fmode2.ValueMember = "Key"; CMB_fmode2.DisplayMember = "Value"; CMB_fmode3.DataSource = flightModes.ToList(); CMB_fmode3.ValueMember = "Key"; CMB_fmode3.DisplayMember = "Value"; CMB_fmode4.DataSource = flightModes.ToList(); CMB_fmode4.ValueMember = "Key"; CMB_fmode4.DisplayMember = "Value"; CMB_fmode5.DataSource = flightModes.ToList(); CMB_fmode5.ValueMember = "Key"; CMB_fmode5.DisplayMember = "Value"; CMB_fmode6.DataSource = flightModes.ToList(); CMB_fmode6.ValueMember = "Key"; CMB_fmode6.DisplayMember = "Value"; try { CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE1"].ToString())); CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE2"].ToString())); CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE3"].ToString())); CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE4"].ToString())); CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE5"].ToString())); CMB_fmode6.Text = Common.apmmodes.MANUAL.ToString(); CMB_fmode6.Enabled = false; } catch { } } else if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover) // APM { CB_simple1.Visible = false; CB_simple2.Visible = false; CB_simple3.Visible = false; CB_simple4.Visible = false; CB_simple5.Visible = false; CB_simple6.Visible = false; var flightModes = EnumTranslator.Translate<Common.aprovermodes>(); CMB_fmode1.DataSource = flightModes.ToList(); CMB_fmode1.ValueMember = "Key"; CMB_fmode1.DisplayMember = "Value"; CMB_fmode2.DataSource = flightModes.ToList(); CMB_fmode2.ValueMember = "Key"; CMB_fmode2.DisplayMember = "Value"; CMB_fmode3.DataSource = flightModes.ToList(); CMB_fmode3.ValueMember = "Key"; CMB_fmode3.DisplayMember = "Value"; CMB_fmode4.DataSource = flightModes.ToList(); CMB_fmode4.ValueMember = "Key"; CMB_fmode4.DisplayMember = "Value"; CMB_fmode5.DataSource = flightModes.ToList(); CMB_fmode5.ValueMember = "Key"; CMB_fmode5.DisplayMember = "Value"; CMB_fmode6.DataSource = flightModes.ToList(); CMB_fmode6.ValueMember = "Key"; CMB_fmode6.DisplayMember = "Value"; try { CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE1"].ToString())); CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE2"].ToString())); CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE3"].ToString())); CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE4"].ToString())); CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE5"].ToString())); CMB_fmode6.Text = Common.aprovermodes.MANUAL.ToString(); CMB_fmode6.Enabled = false; } catch { } } else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 { var flightModes = EnumTranslator.Translate<Common.ac2modes>(); CMB_fmode1.DataSource = flightModes.ToList(); CMB_fmode1.ValueMember = "Key"; CMB_fmode1.DisplayMember = "Value"; CMB_fmode2.DataSource = flightModes.ToList(); CMB_fmode2.ValueMember = "Key"; CMB_fmode2.DisplayMember = "Value"; CMB_fmode3.DataSource = flightModes.ToList(); CMB_fmode3.ValueMember = "Key"; CMB_fmode3.DisplayMember = "Value"; CMB_fmode4.DataSource = flightModes.ToList(); CMB_fmode4.ValueMember = "Key"; CMB_fmode4.DisplayMember = "Value"; CMB_fmode5.DataSource = flightModes.ToList(); CMB_fmode5.ValueMember = "Key"; CMB_fmode5.DisplayMember = "Value"; CMB_fmode6.DataSource = flightModes.ToList(); CMB_fmode6.ValueMember = "Key"; CMB_fmode6.DisplayMember = "Value"; try { CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE1"].ToString())); CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE2"].ToString())); CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE3"].ToString())); CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE4"].ToString())); CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE5"].ToString())); CMB_fmode6.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE6"].ToString())); CMB_fmode6.Enabled = true; int simple = int.Parse(MainV2.comPort.param["SIMPLE"].ToString()); CB_simple1.Checked = ((simple >> 0 & 1) == 1); CB_simple2.Checked = ((simple >> 1 & 1) == 1); CB_simple3.Checked = ((simple >> 2 & 1) == 1); CB_simple4.Checked = ((simple >> 3 & 1) == 1); CB_simple5.Checked = ((simple >> 4 & 1) == 1); CB_simple6.Checked = ((simple >> 5 & 1) == 1); } catch { } } }
private void OnBehaviourApplied(Behaviour behaviour) { var text = new I18NString(); if (behaviour.StatusFlags.HasFlag(StatusFlags.Disarm)) { text = EnumTranslator.Translate(StatusFlags.Disarm); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Swiftness)) { text = EnumTranslator.Translate(StatusFlags.Swiftness); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Immobilization)) { text = EnumTranslator.Translate(StatusFlags.Immobilization); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Invisibility)) { text = EnumTranslator.Translate(StatusFlags.Invisibility); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Invulnerability)) { text = EnumTranslator.Translate(StatusFlags.Invulnerability); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Silence)) { text = EnumTranslator.Translate(StatusFlags.Silence); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Confusion)) { text = EnumTranslator.Translate(StatusFlags.Confusion); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Slow)) { text = EnumTranslator.Translate(StatusFlags.Slow); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Stun)) { text = EnumTranslator.Translate(StatusFlags.Stun); } if (behaviour.StatusFlags.HasFlag(StatusFlags.Weakness)) { text = EnumTranslator.Translate(StatusFlags.Weakness); } if (text.IsNullOrEmpty()) { return; } Enqueue(behaviour.Target, text, Color.white); }