public DefinedSubject(Guid id, Common.Professor.Professor professor, EvaluationType type, Proportion prop) : base(subjectName, credits) { this.id = id; Professor = professor; this.type = type; this.prop = prop; }
public GridStyle(GridStyle gs) : base(gs) { this.RowSpacing = gs.RowSpacing; this.ColumnSpacing = gs.ColumnSpacing; this.DefaultColumnProportion = gs.DefaultColumnProportion; this.DefaultRowProportion = gs.DefaultRowProportion; }
/// <summary> /// Calculates the z-score for which a proportion greater than or less than is equal to a given p-value. /// </summary> /// <param name="proportionType">Whether to calculate the z-score for which the given p-value is greater than or less than.</param> /// <param name="p">The given p-value for which to calculate the z-score.</param> /// <returns>The z-score for which the amount less than or greater than (based on the given proportion type) is equal to the given p-value.</returns> public static double GetZFromProportion(Proportion proportionType, double p) { if (proportionType == Proportion.LessThan) return critz(p); else return critz(1 - p); }
public void SetDownSize(Proportion width, Proportion height) { byte size = (byte)(((byte)height & 0x3) << 4); size |= (byte)((byte)width & 0x3); RunCommand(Command.DOWNSIZE_CTRL, new byte[] { size }, 5); }
protected virtual void GenerateIntervals() { var intervals = new List <double>(); var currentProportion = new Proportion(1, 1); var currentPitch = StartingPitch; var endPitch = StartingPitch.OctaveUp(); var iteration = 0; do { var generator = GetGenerator(iteration); currentProportion = (currentProportion * generator.IntervalProportion).Normalize(); currentPitch = currentPitch.Translate(generator.Interval, Pitch.MidiPitchTranslationMode.Auto); while (currentProportion > Proportion.Dupla) { currentProportion /= 2; currentPitch = currentPitch.OctaveDown(); } AllIntervalRatios[new BoundInterval(StartingPitch, currentPitch)] = currentProportion.Cents; intervals.Add(currentProportion.Cents); iteration++; }while (Math.Abs(currentPitch.MidiPitch - endPitch.MidiPitch) % 12 != 0); CommaBetweenLastIntervalAndPerfectOctave = intervals.Last(); }
public void SetActivityProportion(PlainText subjectName, Proportion proportion) { Contract.Requires(subjectName != null, "subjectName"); Contract.Requires(proportion != null, "proportion"); _subjects.Find(d => d.SubjectInfo.Name == subjectName).SubjectInfo.SetActivityProportion(proportion); }
public Panos_1(String SVGPanos1String) { int tempInt; String[] valuesString = SVGPanos1String.Split(' '); if (int.TryParse(valuesString[0], out tempInt)) family = (Family)tempInt; if (int.TryParse(valuesString[1], out tempInt)) serifStyle = (Serif_Style)tempInt; if (int.TryParse(valuesString[2], out tempInt)) weight = (Weight)tempInt; if (int.TryParse(valuesString[3], out tempInt)) proportion = (Proportion)tempInt; if (int.TryParse(valuesString[4], out tempInt)) contrast = (Contrast)tempInt; if (int.TryParse(valuesString[5], out tempInt)) strokeVariation = (Stroke_Variation)tempInt; if (int.TryParse(valuesString[6], out tempInt)) armStyle = (Arm_Style)tempInt; if (int.TryParse(valuesString[7], out tempInt)) letterform = (Letterform)tempInt; if (int.TryParse(valuesString[8], out tempInt)) midline = (Midline)tempInt; if (int.TryParse(valuesString[0], out tempInt)) xHeight = (XHeight)tempInt; }
public SubjectInformation(PlainText name, Credits credits, EvaluationType type, Proportion activity) { Name = name; Credits = credits; Evaluation = type; ActivityProportion = activity; }
/// <summary> /// Calculates the proportion greater than or less than a given z-score. /// </summary> /// <param name="proportionType">Whether to calculate the proportion greater than or less than the given z-score.</param> /// <param name="z">The z-score for which to find the proportions.</param> /// <returns>The proportion either less than or greater than (based on the given proportion type) the given z-score.</returns> public static double GetProportionFromZ(Proportion proportionType, double z) { if (proportionType == Proportion.LessThan) return poz(z); else return 1 - poz(z); }
public void SetActivityProportion(PlainText subjectName, Proportion proportion) { Contract.Requires(subjectName != null, "Subject name is null!"); Contract.Requires(proportion != null, "Proportion is null!"); _subjects.First(d => d.Name == subjectName).SetActivityProportion(proportion); }
public DefinedSubject(PlainText subjectName, Credits credits, EvaluationType examType, Common.Professor.Professor professor, Proportion proportion) : base(subjectName, credits) { ExamType = examType; Professor = professor; Proportion = proportion; _enrolledStudents = new Dictionary <Common.Student.Student, ViewableSituation>(); }
public LevelBoxButton() : base() { DefaultColumnProportion = new Proportion(ProportionType.Pixels, 540); DefaultRowProportion = new Proportion(ProportionType.Auto); Padding = new Thickness(5); Margin = new Thickness(0, 0, 10, 0); Width = 580; Background = UnselectedBackground; }
public void CompareShouldbeCorrect() { var quantity1 = new Proportion() { Numerator = 1, Denominator = 1}; var quantity2 = new Proportion() { Numerator = 2, Denominator = 1 }; var quantity3 = new Proportion() { Numerator = 2, Denominator = 1 }; Assert.AreEqual(0, quantity2.CompareTo(quantity3)); Assert.AreEqual(-1, quantity1.CompareTo(quantity2)); Assert.AreEqual(1, quantity2.CompareTo(quantity1)); }
protected override MutableObject Mutate(MutableObject mutable) { foreach (var entry in ColorScope.GetEntries(mutable)) { ColorTarget.SetValue(ColorLerp(mutable, FromColor.GetValue(entry), ToColor.GetValue(entry), Proportion.GetValue(entry)), entry); } return(mutable); }
public void DefaultPropertiesShouldBeSet() { var proportion1 = new Proportion(); Assert.IsTrue(proportion1.IsIntegral()); Assert.AreEqual(ProportionKind.Ratio, proportion1.Type); Assert.AreEqual(0, proportion1.Magnitude); const int precision = 2; proportion1.Precision = precision; Assert.AreEqual(precision, proportion1.Precision); }
public void GetDownSize(out Proportion width, out Proportion height) { RunCommand(Command.DOWNSIZE_STATUS, null, 6); var temp = _response[5]; temp &= 0x3; width = (Proportion)temp; temp = _response[5]; temp >>= 4; temp &= 0x3; height = (Proportion)temp; }
public SubjectInformation(PlainText name, Credits credits, EvaluationType type, Proportion activity) { Contract.Requires(name != null, "name"); Contract.Requires(credits != null, "credits"); Contract.Requires(type != null, "type"); Contract.Requires(activity != null, "activity"); Name = name; Credits = credits; Evaluation = type; ActivityProportion = activity; }
public void CentsTest() { Assert.AreEqual(Proportion.Dupla.Cents, 1200); Assert.AreEqual(UsefulMath.CentsToLinear(1200), Proportion.Dupla.DoubleValue); var second1 = new Proportion(9, 8); var second2 = Proportion.GetApproximatedProportionFromCents(second1.Cents); Assert.AreEqual((int)second1.Cents, (int)second2.Cents); var pureFifth = Proportion.Sesquialtera.Cents; }
public void Add(Proportion obj) { int aggre=0; foreach (Proportion t in _ActivityProportion) { if (t.Type2 =="100") { Aggre++; if ((Aggregate >1 ) { throw new Exception(" Only one value of the proportion is allowed"); } } } _ActivityProportion.Add(obj); }
public Panos_1(String SVGPanos1String) { int tempInt; String[] valuesString = SVGPanos1String.Split(' '); if (int.TryParse(valuesString[0], out tempInt)) { family = (Family)tempInt; } if (int.TryParse(valuesString[1], out tempInt)) { serifStyle = (Serif_Style)tempInt; } if (int.TryParse(valuesString[2], out tempInt)) { weight = (Weight)tempInt; } if (int.TryParse(valuesString[3], out tempInt)) { proportion = (Proportion)tempInt; } if (int.TryParse(valuesString[4], out tempInt)) { contrast = (Contrast)tempInt; } if (int.TryParse(valuesString[5], out tempInt)) { strokeVariation = (Stroke_Variation)tempInt; } if (int.TryParse(valuesString[6], out tempInt)) { armStyle = (Arm_Style)tempInt; } if (int.TryParse(valuesString[7], out tempInt)) { letterform = (Letterform)tempInt; } if (int.TryParse(valuesString[8], out tempInt)) { midline = (Midline)tempInt; } if (int.TryParse(valuesString[0], out tempInt)) { xHeight = (XHeight)tempInt; } }
public void CompareShouldbeCorrect() { var quantity1 = new Proportion() { Numerator = 1, Denominator = 1 }; var quantity2 = new Proportion() { Numerator = 2, Denominator = 1 }; var quantity3 = new Proportion() { Numerator = 2, Denominator = 1 }; Assert.AreEqual(0, quantity2.CompareTo(quantity3)); Assert.AreEqual(-1, quantity1.CompareTo(quantity2)); Assert.AreEqual(1, quantity2.CompareTo(quantity1)); }
private void SaveTPOConfig() { TPOConfig config = new TPOConfig(); Figure fig; if (viewer.TryGetFigure(out fig)) { config.Proportions = new Proportion[fig.TPOList.Count]; for (int i = 0; i < fig.TPOList.Count; i++) { config.Proportions[i] = new Proportion(); } for (int i = 0; i < fig.TPOList.Count; i++) { TPOFile tpo = fig.TPOList[i]; Proportion portion = config.Proportions[i]; portion.ClassName = tpo.ProportionName; portion.Ratio = tpo.Ratio; } } config.Save(Figure.GetTPOConfigPath()); }
// TPOConfig.xmlを書き出す public void SaveTPOConfig(string path) { TPOConfig config = new TPOConfig(); Figure fig; if (viewer.TryGetFigure(out fig)) { config.Proportions = new Proportion[fig.TPOList.Count]; for (int i = 0; i < fig.TPOList.Count; i++) { config.Proportions[i] = new Proportion(); } for (int i = 0; i < fig.TPOList.Count; i++) { TPOFile tpo = fig.TPOList[i]; Proportion portion = config.Proportions[i]; portion.ClassName = tpo.ProportionName; portion.Ratio = tpo.Ratio; } } config.Save(Path.Combine(path, @"TPOConfig.xml")); }
public SubjectInformation(PlainText name, Credits credits, EvaluationType type, Proportion activity, Professor.Professor professor) : this(name, credits, type, activity) { Professor = professor; }
public void DefineSubject(PlainText subjectName, Credits credits, EvaluationType type, Proportion activity, Common.Professor professor) { _definedSubjects.Add(new Subject(new SubjectInformation(subjectName, credits, type, activity, professor))); }
private void FillSubGrid(ref int y, IReadOnlyList <Record> records) { for (var i = 0; i < records.Count; ++i) { var record = records[i]; var hasSetter = record.HasSetter; if (_parentProperty != null && !_parentProperty.HasSetter) { hasSetter = false; } var value = record.GetValue(_object); Widget valueWidget = null; var oldY = y; var propertyType = record.Type; Proportion rowProportion; if (record.ItemsProvider != null) { var values = record.ItemsProvider.Items; var cb = new ComboBox(); foreach (var v in values) { cb.Items.Add(new ListItem(v.ToString(), null, v)); } cb.SelectedIndex = Array.IndexOf(values, value); if (hasSetter) { cb.SelectedIndexChanged += (sender, args) => { var item = cb.SelectedItem != null ? values[cb.SelectedIndex] : null; record.SetValue(_object, item); FireChanged(propertyType.Name); }; } else { cb.Enabled = false; } valueWidget = cb; } else if (propertyType == typeof(bool)) { var isChecked = (bool)value; var cb = new CheckBox { IsPressed = isChecked }; if (hasSetter) { cb.Click += (sender, args) => { record.SetValue(_object, cb.IsPressed); FireChanged(propertyType.Name); }; } else { cb.Enabled = false; } valueWidget = cb; } else if (propertyType == typeof(Color) || propertyType == typeof(Color?)) { var subGrid = new Grid { ColumnSpacing = 8, HorizontalAlignment = HorizontalAlignment.Stretch }; var isColor = propertyType == typeof(Color); subGrid.ColumnsProportions.Add(new Proportion()); subGrid.ColumnsProportions.Add(new Proportion(ProportionType.Fill)); var color = Color.Transparent; if (isColor) { color = (Color)value; } else if (value != null) { color = ((Color?)value).Value; } var image = new Image { Renderable = DefaultAssets.WhiteRegion, VerticalAlignment = VerticalAlignment.Center, Width = 32, Height = 16, Color = color }; subGrid.Widgets.Add(image); var button = new Button { Text = "Change...", ContentHorizontalAlignment = HorizontalAlignment.Center, Tag = value, HorizontalAlignment = HorizontalAlignment.Stretch, GridColumn = 1 }; subGrid.Widgets.Add(button); if (hasSetter) { button.Click += (sender, args) => { var dlg = new ColorPickerDialog() { Color = image.Color }; dlg.Closed += (s, a) => { if (!dlg.Result) { return; } image.Color = dlg.Color; record.SetValue(_object, dlg.Color); FireChanged(propertyType.Name); }; dlg.ShowModal(Desktop); }; } else { button.Enabled = false; } valueWidget = subGrid; } else if (propertyType.IsAssignableFrom(typeof(IRenderable))) { } else if (propertyType.IsEnum) { var values = Enum.GetValues(propertyType); var cb = new ComboBox(); foreach (var v in values) { cb.Items.Add(new ListItem(v.ToString(), null, v)); } cb.SelectedIndex = Array.IndexOf(values, value); if (hasSetter) { cb.SelectedIndexChanged += (sender, args) => { if (cb.SelectedIndex != -1) { record.SetValue(_object, cb.SelectedIndex); FireChanged(propertyType.Name); } }; } else { cb.Enabled = false; } valueWidget = cb; } else if (propertyType.IsNumericType() || (propertyType.IsNullablePrimitive() && propertyType.GetNullableType().IsNumericType())) { var numericType = propertyType; if (propertyType.IsNullablePrimitive()) { numericType = propertyType.GetNullableType(); } var spinButton = new SpinButton { Integer = numericType.IsNumericInteger(), Nullable = propertyType.IsNullablePrimitive(), Value = value != null ? (float)Convert.ChangeType(value, typeof(float)) : default(float?) }; if (hasSetter) { spinButton.ValueChanged += (sender, args) => { try { object result; if (spinButton.Value != null) { result = Convert.ChangeType(spinButton.Value.Value, numericType); } else { result = null; } record.SetValue(_object, result); if (record.Type.IsValueType) { var tg = this; var pg = tg._parentGrid; while (pg != null && tg._parentProperty != null) { tg._parentProperty.SetValue(pg._object, tg._object); if (!tg._parentProperty.Type.IsValueType) { break; } tg = pg; pg = tg._parentGrid; } } FireChanged(record.Name); } catch (InvalidCastException) { // TODO: Rework this ugly type conversion solution } catch (Exception ex) { spinButton.Value = args.OldValue; var dialog = Dialog.CreateMessageBox("Error", ex.ToString()); dialog.ShowModal(Desktop); } }; } else { spinButton.Enabled = false; } valueWidget = spinButton; } else if (propertyType == typeof(string) || propertyType.IsPrimitive || propertyType.IsNullablePrimitive()) { var tf = new TextField { Text = value != null?value.ToString() : string.Empty }; if (hasSetter) { tf.TextChanged += (sender, args) => { try { object result; if (propertyType.IsNullablePrimitive()) { if (string.IsNullOrEmpty(tf.Text)) { result = null; } else { result = Convert.ChangeType(tf.Text, record.Type.GetNullableType()); } } else { result = Convert.ChangeType(tf.Text, record.Type); } record.SetValue(_object, result); if (record.Type.IsValueType) { var tg = this; var pg = tg._parentGrid; while (pg != null && tg._parentProperty != null) { tg._parentProperty.SetValue(pg._object, tg._object); if (!tg._parentProperty.Type.IsValueType) { break; } tg = pg; pg = tg._parentGrid; } } FireChanged(record.Name); } catch (Exception) { // TODO: Rework this ugly type conversion solution } }; } else { tf.Enabled = false; } valueWidget = tf; } else if (typeof(IList).IsAssignableFrom(propertyType)) { var it = propertyType.FindGenericType(typeof(ICollection <>)); if (it != null) { var itemType = it.GenericTypeArguments[0]; if (value != null) { var items = (IList)value; var subGrid = new Grid { ColumnSpacing = 8, HorizontalAlignment = HorizontalAlignment.Stretch }; subGrid.ColumnsProportions.Add(new Proportion()); subGrid.ColumnsProportions.Add(new Proportion(ProportionType.Fill)); var label = new TextBlock { VerticalAlignment = VerticalAlignment.Center, }; UpdateLabelCount(label, items.Count); subGrid.Widgets.Add(label); var button = new Button { Text = "Change...", ContentHorizontalAlignment = HorizontalAlignment.Center, Tag = value, HorizontalAlignment = HorizontalAlignment.Stretch, GridColumn = 1 }; button.Click += (sender, args) => { var collectionEditor = new CollectionEditor(items, itemType); var dialog = Dialog.CreateMessageBox("Edit", collectionEditor); dialog.ButtonOk.Click += (o, eventArgs) => { collectionEditor.SaveChanges(); UpdateLabelCount(label, items.Count); }; dialog.ShowModal(Desktop); }; subGrid.Widgets.Add(button); valueWidget = subGrid; } } } else if (!(value is SpriteFont) && !(value is IRenderable)) { // Subgrid if (value != null) { var subGrid = new SubGrid(this, value, record.Name, DefaultCategoryName, record) { GridColumnSpan = 2, GridRow = y }; InternalChild.Widgets.Add(subGrid); rowProportion = new Proportion(ProportionType.Auto); InternalChild.RowsProportions.Add(rowProportion); ++y; continue; } var tb = new TextBlock(); tb.ApplyTextBlockStyle(PropertyGridStyle.LabelStyle); tb.Text = "null"; valueWidget = tb; } if (valueWidget == null) { continue; } var nameLabel = new TextBlock { Text = record.Name, VerticalAlignment = VerticalAlignment.Center, GridColumn = 0, GridRow = oldY }; InternalChild.Widgets.Add(nameLabel); valueWidget.GridColumn = 1; valueWidget.GridRow = oldY; valueWidget.HorizontalAlignment = HorizontalAlignment.Stretch; valueWidget.VerticalAlignment = VerticalAlignment.Top; InternalChild.Widgets.Add(valueWidget); rowProportion = new Proportion(ProportionType.Auto); InternalChild.RowsProportions.Add(rowProportion); ++y; } }
private void Rebuild() { InternalChild.RowsProportions.Clear(); InternalChild.Widgets.Clear(); _records.Clear(); if (_object == null) { return; } var properties = from p in _object.GetType().GetProperties() select p; var records = new List <Record>(); foreach (var property in properties) { if (property.GetGetMethod() == null || !property.GetGetMethod().IsPublic || property.GetGetMethod().IsStatic) { continue; } var hasSetter = property.GetSetMethod() != null && property.GetSetMethod().IsPublic; var browsableAttr = property.FindAttribute <BrowsableAttribute>(); if (browsableAttr != null && !browsableAttr.Browsable) { continue; } var hiddenAttr = property.FindAttribute <HiddenInEditorAttribute>(); if (hiddenAttr != null) { continue; } var readOnlyAttr = property.FindAttribute <ReadOnlyAttribute>(); if (readOnlyAttr != null && readOnlyAttr.IsReadOnly) { hasSetter = false; } var record = new PropertyRecord(property) { HasSetter = hasSetter }; var selectionAttr = property.FindAttribute <SelectionAttribute>(); if (selectionAttr != null) { record.ItemsProvider = (IItemsProvider)Activator.CreateInstance(selectionAttr.ItemsProviderType, _object); } var categoryAttr = property.FindAttribute <EditCategoryAttribute>(); record.Category = categoryAttr != null ? categoryAttr.Name : DefaultCategoryName; records.Add(record); } var fields = from f in _object.GetType().GetFields() select f; foreach (var field in fields) { if (!field.IsPublic || field.IsStatic) { continue; } var categoryAttr = field.FindAttribute <EditCategoryAttribute>(); var hasSetter = true; var readOnlyAttr = field.FindAttribute <ReadOnlyAttribute>(); if (readOnlyAttr != null && readOnlyAttr.IsReadOnly) { hasSetter = false; } var record = new FieldRecord(field) { HasSetter = hasSetter, Category = categoryAttr != null ? categoryAttr.Name : DefaultCategoryName }; records.Add(record); } // Sort by categories for (var i = 0; i < records.Count; ++i) { var record = records[i]; List <Record> categoryRecords; if (!_records.TryGetValue(record.Category, out categoryRecords)) { categoryRecords = new List <Record>(); _records[record.Category] = categoryRecords; } categoryRecords.Add(record); } // Sort by names within categories foreach (var category in _records) { category.Value.Sort((a, b) => Comparer <string> .Default.Compare(a.Name, b.Name)); } var ordered = _records.OrderBy(key => key.Key); var y = 0; List <Record> defaultCategoryRecords; if (_records.TryGetValue(Category, out defaultCategoryRecords)) { FillSubGrid(ref y, defaultCategoryRecords); } if (Category != DefaultCategoryName) { return; } foreach (var category in ordered) { if (category.Key == DefaultCategoryName) { continue; } var subGrid = new SubGrid(this, Object, category.Key, category.Key, null) { GridColumnSpan = 2, GridRow = y }; InternalChild.Widgets.Add(subGrid); if (_expandedCategories.Contains(category.Key)) { subGrid.Mark.IsPressed = true; } var rp = new Proportion(ProportionType.Auto); InternalChild.RowsProportions.Add(rp); y++; } }
public void SetActivityProportion(Proportion proportion) { ActivityProportion = proportion; }
private void FillSubGrid(ref int y, IReadOnlyList <Record> records) { for (var i = 0; i < records.Count; ++i) { var record = records[i]; var hasSetter = record.HasSetter; if (_parentProperty != null && _parentProperty.Type.IsValueType && !_parentProperty.HasSetter) { hasSetter = false; } var value = record.GetValue(_object); Widget valueWidget = null; var oldY = y; var propertyType = record.Type; Proportion rowProportion; object[] customValues = null; if (CustomValuesProvider != null && (customValues = CustomValuesProvider(record)) != null) { if (customValues.Length == 0) { continue; } valueWidget = CreateCustomValuesEditor(record, customValues, hasSetter); } else if (propertyType == typeof(bool)) { valueWidget = CreateBooleanEditor(record, hasSetter); } else if (propertyType == typeof(Color) || propertyType == typeof(Color?)) { valueWidget = CreateColorEditor(record, hasSetter); } else if (propertyType.IsEnum) { valueWidget = CreateEnumEditor(record, hasSetter); } else if (propertyType.IsNumericType() || (propertyType.IsNullablePrimitive() && propertyType.GetNullableType().IsNumericType())) { valueWidget = CreateNumericEditor(record, hasSetter); } else if (propertyType == typeof(string) || propertyType.IsPrimitive || propertyType.IsNullablePrimitive()) { valueWidget = CreateStringEditor(record, hasSetter); } else if (typeof(IList).IsAssignableFrom(propertyType)) { if (!IgnoreCollections) { var it = propertyType.FindGenericType(typeof(ICollection <>)); if (it != null) { var itemType = it.GenericTypeArguments[0]; if (value != null) { valueWidget = CreateCollectionEditor(record, itemType); } } } } else if (propertyType == typeof(SpriteFont)) { valueWidget = CreateFileEditor <SpriteFont>(record, hasSetter, "*.fnt"); } else if (propertyType == typeof(IBrush)) { valueWidget = CreateBrushEditor(record, hasSetter); } else if (propertyType == typeof(IImage)) { valueWidget = CreateFileEditor <TextureRegion>(record, hasSetter, "*.png|*.jpg|*.bmp|*.gif"); } else { // Subgrid if (value != null) { var subGrid = new SubGrid(this, value, record.Name, DefaultCategoryName, record) { GridColumnSpan = 2, GridRow = y }; InternalChild.Widgets.Add(subGrid); rowProportion = new Proportion(ProportionType.Auto); InternalChild.RowsProportions.Add(rowProportion); ++y; continue; } var tb = new Label(); tb.ApplyLabelStyle(PropertyGridStyle.LabelStyle); tb.Text = "null"; valueWidget = tb; } if (valueWidget == null) { continue; } var name = record.Name; var dn = record.FindAttribute <DisplayNameAttribute>(); if (dn != null) { name = dn.DisplayName; } var nameLabel = new Label { Text = name, VerticalAlignment = VerticalAlignment.Center, GridColumn = 0, GridRow = oldY }; InternalChild.Widgets.Add(nameLabel); valueWidget.GridColumn = 1; valueWidget.GridRow = oldY; valueWidget.HorizontalAlignment = HorizontalAlignment.Stretch; valueWidget.VerticalAlignment = VerticalAlignment.Top; InternalChild.Widgets.Add(valueWidget); rowProportion = new Proportion(ProportionType.Auto); InternalChild.RowsProportions.Add(rowProportion); ++y; } }
public void PrecisionCannotBeLessThanMinusOne() { var proportion1 = new Proportion(); proportion1.Precision = -2; }
public void DefineSubject(PlainText subjectName, Credits credits, EvaluationType type, Proportion activity, GenericEntities.Professor professor) { Contract.Requires(subjectName != null, "subjectName"); Contract.Requires(credits != null, "credits"); Contract.Requires(type != null, "type"); Contract.Requires(activity != null, "activity"); Contract.Requires(professor != null, "professor"); _definedSubjects.Add(new ForStudentCalculation(new SubjectInformation(name, credits, type, activity))); }
public void SetActivityProportion(PlainText subjectName, Proportion proportion) { _subjects.Find(d => d.SubjectInfo.Name == subjectName).SubjectInfo.SetActivityProportion(proportion); }
public SubjectDefinedEvent(Guid id, PlainText subjectName, Credits credits, Dictionary <Common.Student.Student, ViewableSituation> enrolledStudents, EvaluationType type, Common.Professor.Professor professor, Proportion prop) { this.id = id; this.subjectName = subjectName; this.credits = credits; this.enrolledStudents = enrolledStudents; this.type = type; this.professor = professor; this.prop = prop; }
public TunedInterval(Interval interval, Proportion proportion) : this() { Interval = interval; IntervalProportion = proportion; }
public void SettingMagnitudeShouldThrowException() { var proportion1 = new Proportion(); proportion1.Magnitude = 2; }
/// <inheritdoc/> public override string ModelSummary(bool formatForParentControl) { using (StringWriter htmlWriter = new StringWriter()) { htmlWriter.Write($"\r\n<div class=\"activityentry\"><span class=\"setvalue\">{Proportion.ToString("p0")}</span> of the individuals will be "); if (RuminantTypeName == null || RuminantTypeName == "") { htmlWriter.Write("<span class=\"errorlink\">TYPE NOT SET</span>"); } else { htmlWriter.Write("<span class=\"resourcelink\">" + RuminantTypeName + "</span>"); } cohortFound = FindAllChildren <RuminantTypeCohort>().Count() > 0; if (cohortFound) { htmlWriter.Write($" with the following details:</div>"); } else { htmlWriter.Write($"</div>"); htmlWriter.Write($"\r\n<div class=\"activityentry\"><span class=\"errorlink\">No <span class=\"resourcelink\">RuminantCohort</span> describing the individuals was provided!</div>"); } return(htmlWriter.ToString()); } }