void DownloadProgressUpdate(object sender, ProgressEventArgs e) { lock (MessageSyncLock) { ISyncItem syncItem = e.UserState as ISyncItem; if (e.ProgressPercentage % 10 == 0) { // only do every 10% var line = string.Format("{0} ({1} of {2}) {3}%", syncItem.EpisodeTitle, DisplayFormatter.RenderFileSize(e.ItemsProcessed), DisplayFormatter.RenderFileSize(e.TotalItemsToProcess), e.ProgressPercentage); Logger.Debug(() => line); MessageStore.StoreMessage(syncItem.Id, line); if (e.ProgressPercentage == 100) { AnalyticsEngine.DownloadEpisodeEvent(ByteConverter.BytesToMegabytes(e.TotalItemsToProcess)); } Observables.UpdateItemProgress?.Invoke(this, Tuple.Create(syncItem, e.ProgressPercentage)); } var controlFile = ApplicationControlFileProvider.GetApplicationConfiguration(); if (IsDestinationDriveFull(controlFile.GetSourceRoot(), controlFile.GetFreeSpaceToLeaveOnDownload())) { TaskPool?.CancelAllTasks(); } } }
void ProgressUpdate(object sender, ProgressEventArgs e) { lock (SyncLock) { // keep all the message together ISyncItem syncItem = e.UserState as ISyncItem; if (e.ProgressPercentage % 10 == 0) { var line = string.Format("{0} ({1} of {2}) {3}%", syncItem.EpisodeTitle, DisplayFormatter.RenderFileSize(e.ItemsProcessed), DisplayFormatter.RenderFileSize(e.TotalItemsToProcess), e.ProgressPercentage); AddLineToOutput(line); AndroidApplication.Logger.Debug(() => line); } if (e.ProgressPercentage == 100) { number_of_files_downloaded++; AddLineToOutput($"Completed {number_of_files_downloaded} of {number_of_files_to_download} downloads"); } DisplayOutput(); } }
static void ProgressUpdate(object sender, ProgressEventArgs e) { lock (_synclock) { // keep all the message together ISyncItem syncItem = e.UserState as ISyncItem; if (e.ProgressPercentage % 10 == 0) { Console.WriteLine(string.Format("{0} ({1} of {2}) {3}%", syncItem.EpisodeTitle, DisplayFormatter.RenderFileSize(e.ItemsProcessed), DisplayFormatter.RenderFileSize(e.TotalItemsToProcess), e.ProgressPercentage)); } if (e.ProgressPercentage == 100) { _number_of_files_downloaded++; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Completed {0} of {1} downloads", _number_of_files_downloaded, _number_of_files_to_download); Console.ResetColor(); } if (IsDestinationDriveFull(_control.GetSourceRoot(), _control.GetFreeSpaceToLeaveOnDownload())) { if (_taskPool != null) { _taskPool.CancelAllTasks(); } } } }
public void DisplayFormatterDoesConflictingWarning() { var notificationCenter = Substitute.For <INotificationCenter>(); var positionCalc = Substitute.For <IPositionCalc>(); var display = Substitute.For <IDisplay>(); displayFormatter = new DisplayFormatter(display, positionCalc, notificationCenter); mapper.Attach(new Airspace(monitor, displayFormatter, log)); var testData = new List <string>(); testData.Add("ATR423;10;10;14000;20151006213456719"); // ATR423 ENTERING simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); testData[0] = "ATR423;501;501;1000;20151006213456789"; // ATR423 INSIDE simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); testData[0] = "AT422;10000;10000;1000;20151006213456799"; // AT422 ENTERING simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); testData[0] = "AT422;1000;1000;1000;20151006213456999"; // AT422 CONFLICTING simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); notificationCenter.Received(1).EnqueWarning(Arg.Any <List <List <string> > >()); notificationCenter.Received(1).SetWarningsSignalHandle(); }
public static ElementGenerator <T> For(Action <ScenarioDefinition> configure) { var definition = new ScenarioDefinition(); configure(definition); var activators = definition.Activators().ToList(); activators.Add(new ElementRequestActivator(new InMemoryFubuRequest(), definition.Naming)); var stringifier = definition.Display.BuildStringifier(); var formatter = new DisplayFormatter(definition.Services, stringifier); definition.Services.Add <IDisplayFormatter>(formatter); definition.Library.Import(new DefaultHtmlConventions().Library); var generator = ElementGenerator <T> .For(definition.Library, activators); generator.Model = definition.Model; return(generator); }
public void DisplayFormatterDoesShowTracks() { var notificationCenter = Substitute.For <INotificationCenter>(); var positionCalc = Substitute.For <IPositionCalc>(); var display = Substitute.For <IDisplay>(); displayFormatter = new DisplayFormatter(display, positionCalc, notificationCenter); mapper.Attach(new Airspace(monitor, displayFormatter, log)); var testData = new List <string>(); testData.Add("ATR423;10;10;14000;20151006213456719"); // ATR423 ENTERING simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); testData[0] = "ATR423;501;501;1000;20151006213456789"; // ATR423 INSIDE simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); display.Received(2).ShowTracks(Arg.Any <List <IEnumerable <string> > >()); positionCalc.ReceivedWithAnyArgs().FormatTrackData(null, null); }
public void Null__undefined_format_passes_data_through() { string input = "my input"; var expected = "my input"; var actual = DisplayFormatter.ApplyFormat(null, input); Assert.That(actual, Is.EqualTo(expected)); }
private static string?TryApplyDisplayFormat(DocumentBox box, string?str) { if (box.Definition.DisplayFormat == null) { return(str); } var transformed = DisplayFormatter.ApplyFormat(box.Definition.DisplayFormat, str); return(transformed ?? str); }
public void Integral__truncates_numbers_with_no_rounding(string input, string expected) { var format = new DisplayFormatFilter { Type = DisplayFormatType.Integral, FormatParameters = new Dictionary <string, string>() }; var actual = DisplayFormatter.ApplyFormat(format, input); Assert.That(actual, Is.EqualTo(expected)); }
static void Main(string[] args) { ConsoleUI ui = new ConsoleUI(); var displayFormatter = new DisplayFormatter(); var inputConverter = new InputConverter(); var displayDelayer = new Delayer(milliSecDelay: 1100); var fileReader = new FileReader(); Game life = new Game(ui, displayFormatter, inputConverter, displayDelayer, fileReader); life.Run(); }
public void Fractional__displays_the_fractional_part_with_exact_number_of_places_and_rounding(string input, string places, string expected) { var format = new DisplayFormatFilter { Type = DisplayFormatType.Fractional, FormatParameters = new Dictionary <string, string> { { nameof(FractionalDisplayParams.DecimalPlaces), places } } }; var actual = DisplayFormatter.ApplyFormat(format, input); Assert.That(actual, Is.EqualTo(expected)); }
[Test] // Note: render image is used as a flag in the render phase. This format doesn't change the underlying data public void RenderImage__passes_data_through() { string input = "my input"; var format = new DisplayFormatFilter { Type = DisplayFormatType.RenderImage, FormatParameters = new Dictionary <string, string>() }; var expected = "my input"; var actual = DisplayFormatter.ApplyFormat(format, input); Assert.That(actual, Is.EqualTo(expected)); }
public void DateFormat__returns_null_for_invalid_inputs() { string input = "ceci nest pas un date"; var format = new DisplayFormatFilter { Type = DisplayFormatType.DateFormat, FormatParameters = new Dictionary <string, string> { { nameof(DateDisplayParams.FormatString), "dddd d MMM yyyy" } } }; var actual = DisplayFormatter.ApplyFormat(format, input); Assert.That(actual, Is.Null); }
public void DateFormat__reformats_parsable_date_input() { string input = "2019-04-11"; var format = new DisplayFormatFilter { Type = DisplayFormatType.DateFormat, FormatParameters = new Dictionary <string, string> { { nameof(DateDisplayParams.FormatString), "dddd d MMM yyyy" } } }; var expected = "Thursday 11 Apr 2019"; var actual = DisplayFormatter.ApplyFormat(format, input); Assert.That(actual, Is.EqualTo(expected)); }
protected void ProgressUpdate(object sender, ProgressEventArgs e) { lock (this) { // keep all the message together ISyncItem syncItem = e.UserState as ISyncItem; if (e.ProgressPercentage % 10 == 0) { Console.WriteLine(string.Format("{0} ({1} of {2}) {3}%", syncItem.EpisodeTitle, DisplayFormatter.RenderFileSize(e.ItemsProcessed), DisplayFormatter.RenderFileSize(e.TotalItemsToProcess), e.ProgressPercentage)); } } }
public void NumberFormat__reformats_numbers(string input, string expected) { var format = new DisplayFormatFilter { Type = DisplayFormatType.NumberFormat, FormatParameters = new Dictionary <string, string> { { nameof(NumberDisplayParams.Prefix), "=$" }, { nameof(NumberDisplayParams.Postfix), "=" }, { nameof(NumberDisplayParams.DecimalPlaces), "3" }, { nameof(NumberDisplayParams.DecimalSeparator), "." }, { nameof(NumberDisplayParams.ThousandsSeparator), "'" }, } }; var actual = DisplayFormatter.ApplyFormat(format, input); Assert.That(actual, Is.EqualTo(expected)); }
public void NumberFormat__returns_null_for_invalid_input() { var input = "Little house on the prairie"; var format = new DisplayFormatFilter { Type = DisplayFormatType.NumberFormat, FormatParameters = new Dictionary <string, string> { { nameof(NumberDisplayParams.Prefix), "=$" }, { nameof(NumberDisplayParams.Postfix), "=" }, { nameof(NumberDisplayParams.DecimalPlaces), "3" }, { nameof(NumberDisplayParams.DecimalSeparator), "." }, { nameof(NumberDisplayParams.ThousandsSeparator), "'" }, } }; var actual = DisplayFormatter.ApplyFormat(format, input); Assert.That(actual, Is.Null); }
public void DisplayFormatterDoesEnteringNotification() { var notificationCenter = Substitute.For <INotificationCenter>(); var positionCalc = Substitute.For <IPositionCalc>(); var display = Substitute.For <IDisplay>(); displayFormatter = new DisplayFormatter(display, positionCalc, notificationCenter); mapper.Attach(new Airspace(monitor, displayFormatter, log)); var testData = new List <string>(); testData.Add("ATR423;10;10;14000;20151006213456789"); simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); notificationCenter.Received(1).EnqueNotification(Arg.Is <List <string> >(d => d[0] == "ATR423" && d[1] == "ENTERING")); notificationCenter.Received(1).SetNotificationSignalHandle(); }
/// <summary> /// Gather the data available for a single template box. /// </summary> private static Result <DocumentBox?> PrepareBox(DataMapper mapper, TemplateBox box, Dictionary <string, decimal> runningTotals, int pageIndex) { try { if (box.MappingPath is null) { return(Result.Failure <DocumentBox?>("Box has no mapping path")); } var str = mapper.TryFindBoxData(box, pageIndex, runningTotals); if (DataMapper.IsSpecialValue(box, out var type)) { return(Result.Success <DocumentBox?>(new DocumentBox(box) { BoxType = type, RenderContent = str })); } if (str == null) { if (box.IsRequired) { return(Result.Failure <DocumentBox?>($"Required data was not found at [{string.Join(".",box.MappingPath)}]")); } return(Result.Success <DocumentBox?>(null)); // empty data is considered OK } if (box.DisplayFormat != null) { str = DisplayFormatter.ApplyFormat(box.DisplayFormat, str); if (str == null) { return(Result.Failure <DocumentBox?>($"Formatter failed: {box.DisplayFormat.Type} applied on {string.Join(".", box.MappingPath!)}")); } } return(Result.Success <DocumentBox?>(new DocumentBox(box, str))); } catch (Exception ex) { return(Result.Failure <DocumentBox>(ex) !); } }
private void AddFileSystem(string absolutePath) { long freeBytes = FileSystemHelper.GetAvailableFileSystemSizeInBytes(absolutePath); long totalBytes = FileSystemHelper.GetTotalFileSystemSizeInBytes(absolutePath); long usedBytes = totalBytes - freeBytes; string[] freeSize = DisplayFormatter.RenderFileSize(freeBytes).Split(' '); string[] totalSize = DisplayFormatter.RenderFileSize(totalBytes).Split(' '); var view = DriveVolumeInfoViewFactory.GetNewView(ApplicationContext); view.Title = ConvertPathToTitle(absolutePath); view.SetSpace( Convert.ToInt32(ByteConverter.BytesToMegabytes(usedBytes)), Convert.ToInt32(ByteConverter.BytesToMegabytes(totalBytes)), freeSize[0], freeSize[1], totalSize[0], totalSize[1]); Observables?.AddInfoView?.Invoke(this, view.GetView()); }
void DownloadProgressUpdate(object sender, ProgressEventArgs e) { lock (MessageSyncLock) { ISyncItem syncItem = e.UserState as ISyncItem; if (e.ProgressPercentage % 10 == 0) { // only do every 10% var line = string.Format("{0} ({1} of {2}) {3}%", syncItem.EpisodeTitle, DisplayFormatter.RenderFileSize(e.ItemsProcessed), DisplayFormatter.RenderFileSize(e.TotalItemsToProcess), e.ProgressPercentage); Logger.Debug(() => line); Observables.UpdateItemProgress?.Invoke(this, Tuple.Create(syncItem, e.ProgressPercentage)); } if (IsDestinationDriveFull(ControlFile.GetSourceRoot(), ControlFile.GetFreeSpaceToLeaveOnDownload())) { TaskPool?.CancelAllTasks(); } } }
static void Main(string[] args) { // Parse command line options var options = new Options(); string invokedVerb = null; object invokedOptions = null; Parser.Default.ParseArguments(args, options, (verb, suboptions) => { invokedVerb = verb; invokedOptions = suboptions; }); // Check verb specified if (invokedOptions == null) { return; } // Invoke reporter var reporter = new SalaryReporter(); var formatter = new DisplayFormatter(); Console.Write(reporter.RunReport(invokedVerb, options, formatter)); }
private void btnLoadRecipe_Click(object sender, EventArgs e) { try { string fileName = CommonFunctions.Instance.ProductRecipeName + CommonFunctions.RecipeExt; CommonFunctions.Instance.LoadMeasurementTestRecipe(fileName); txtCh1WriterResistanceMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch1WriterResistanceMin.ToString(); txtCh1WriterResistanceMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch1WriterResistanceMax.ToString(); txtCh2TAResistanceMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch2TAResistanceMin.ToString(); txtCh2TAResistanceMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch2TAResistanceMax.ToString(); txtCh3WHResistanceMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch3WHResistanceMin.ToString(); txtCh3WHResistanceMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch3WHResistanceMax.ToString(); txtCh4RHResistanceMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch4RHResistanceMin.ToString(); txtCh4RHResistanceMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch4RHResistanceMax.ToString(); txtCh5R1ResistanceMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch5R1ResistanceMin.ToString(); txtCh5R1ResistanceMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch5R1ResistanceMax.ToString(); txtCh6R2ResistanceMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6R2ResistanceMin.ToString(); txtCh6R2ResistanceMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6R2ResistanceMax.ToString(); txtCh6R2ResistanceMin.Enabled = !CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; txtCh6R2ResistanceMax.Enabled = !CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; txtCh1WriterOpenShortMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch1WriterOpenShortMin.ToString(); txtCh1WriterOpenShortMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch1WriterOpenShortMax.ToString(); txtCh2TAOpenShortMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch2TAOpenShortMin.ToString(); txtCh2TAOpenShortMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch2TAOpenShortMax.ToString(); txtCh3WHOpenShortMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch3WHOpenShortMin.ToString(); txtCh3WHOpenShortMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch3WHOpenShortMax.ToString(); txtCh4RHOpenShortMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch4RHOpenShortMin.ToString(); txtCh4RHOpenShortMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch4RHOpenShortMax.ToString(); txtCh5R1OpenShortMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch5R1OpenShortMin.ToString(); txtCh5R1OpenShortMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch5R1OpenShortMax.ToString(); txtCh6R2OpenShortMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6R2OpenShortMin.ToString(); txtCh6R2OpenShortMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6R2OpenShortMax.ToString(); txtCh6R2OpenShortMin.Enabled = !CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; txtCh6R2OpenShortMax.Enabled = !CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; readerImpedanceSpecR1.Text = CommonFunctions.Instance.MeasurementTestRecipe.ReaderImpedanceR1Spec.ToString(); readerImpedanceSpecR2.Text = CommonFunctions.Instance.MeasurementTestRecipe.ReaderImpedanceR2Spec.ToString(); writerResistanceSpecUP.Text = CommonFunctions.Instance.MeasurementTestRecipe.WriterResistanceSpecUP.ToString(); writerResistanceSpecDN.Text = CommonFunctions.Instance.MeasurementTestRecipe.WriterResistanceSpecDN.ToString(); chkbox_EnableDeltaISI.Checked = CommonFunctions.Instance.MeasurementTestRecipe.DeltaISI_Enable; txtbox_DeltaISISpec1.Text = CommonFunctions.Instance.MeasurementTestRecipe.DeltaISISpec1.ToString();//Load delta ISI spec from measurement recipe txtbox_DeltaISISpec2.Text = CommonFunctions.Instance.MeasurementTestRecipe.DeltaISISpec2.ToString(); textBoxSDETRD2Impedance.Text = CommonFunctions.Instance.MeasurementTestRecipe.OffsetR1HSTSDET.ToString(); textBoxRD2SDETDeltaMoreThan.Text = CommonFunctions.Instance.MeasurementTestRecipe.DeltaR1SpecMoreThan.ToString(); textBoxRD2SDETDeltaLessThan.Text = CommonFunctions.Instance.MeasurementTestRecipe.DeltaR1SpecLessThan.ToString(); txtCh6LDUResistanceMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6LDUResistanceMin.ToString(); txtCh6LDUResistanceMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6LDUResistanceMax.ToString(); txtCh6LDUOpenShortMin.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6LDUOpenShortMin.ToString(); txtCh6LDUOpenShortMax.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6LDUOpenShortMax.ToString(); txtCh6LDUResistanceMin.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; txtCh6LDUResistanceMax.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; txtCh6LDUOpenShortMin.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; txtCh6LDUOpenShortMax.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; //ykl textBoxLEDVoltageLowLimit.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textBoxLEDVoltageUpperLimit.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textBoxRLDULowLimit.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textBoxRLDUUpperLimit.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textBoxIthLowLimit.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textBoxIthUpperLimit.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textBoxVPDMaxLowLimit.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textBoxVPDMaxUpperLimit.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textDeltaIThresholdNegative.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textDeltaIThresholdPositive.Enabled = CommonFunctions.Instance.ConfigurationSetupRecipe.LDUEnable; textBoxLEDVoltageLowLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.PDVoltageMaxSpec.ToString(); textBoxIthLowLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.IThresholdSpecLower.ToString(); textBoxIthUpperLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.IThresholdSpecUpper.ToString(); textBoxRLDULowLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6LDUResistanceMin.ToString(); textBoxRLDUUpperLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.Ch6LDUResistanceMax.ToString(); textBoxLEDVoltageLowLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.LEDInterceptSpecLower.ToString(); textBoxLEDVoltageUpperLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.LEDInterceptSpecUpper.ToString(); textBoxVPDMaxLowLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.PDVoltageMinSpec.ToString(); textBoxVPDMaxUpperLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.PDVoltageMaxSpec.ToString(); textDeltaIThresholdNegative.Text = CommonFunctions.Instance.MeasurementTestRecipe.DeltaIThresholdNegativeSpec.ToString(); textDeltaIThresholdPositive.Text = CommonFunctions.Instance.MeasurementTestRecipe.DeltaIThresholdPositiveSpec.ToString(); textBoxIth_Gompertz_LowLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.Gompertz_IThresholdSpecLower.ToString(); textBoxIth_Gompertz_HighLimit.Text = CommonFunctions.Instance.MeasurementTestRecipe.Gompertz_IThresholdSpecUpper.ToString(); //ykl textBoxETOnDiskTest.Text = CommonFunctions.Instance.MeasurementTestRecipe.SamplingETOnDisk.ToString(); touchscreenTextBoxTSRNumber.Text = CommonFunctions.Instance.MeasurementTestRecipe.TSRNumber; touchscreenTextBoxTSRGroup.Text = CommonFunctions.Instance.MeasurementTestRecipe.TSRGroup; touchscreenTextBoxTSRSpecNo.Text = DisplayFormatter.Round(CommonFunctions.Instance.MeasurementTestRecipe.SpecNumber, DisplayFormatter.DecimalDigits.Three); touchscreenTextBoxTSRSpecVer.Text = CommonFunctions.Instance.MeasurementTestRecipe.SpecVersion; touchscreenTextBoxTSRParamId.Text = CommonFunctions.Instance.MeasurementTestRecipe.ParamID; touchscreenTextBoxTSRScripName.Text = CommonFunctions.Instance.MeasurementTestRecipe.ScriptName; touchscreenTextBoxTSRRadius.Text = DisplayFormatter.Round(CommonFunctions.Instance.MeasurementTestRecipe.Radius, DisplayFormatter.DecimalDigits.Three); touchscreenTextBoxTSRRPM.Text = DisplayFormatter.Round(CommonFunctions.Instance.MeasurementTestRecipe.RPM, DisplayFormatter.DecimalDigits.Zero); touchscreenTextBoxTSRSkewAngle.Text = DisplayFormatter.Round(CommonFunctions.Instance.MeasurementTestRecipe.SkewAngle, DisplayFormatter.DecimalDigits.Three); UpdateGrid(CommonFunctions.Instance.MeasurementTestRecipe.AdjacentPadsList); } catch (Exception ex) { } }
protected override void When() { _result = DisplayFormatter.RenderFileSize(3145728); }
protected override void When() { _result = DisplayFormatter.RenderFileSize(4294967296); }
private ReadOnlyControlFile OpenControlFile(Android.Net.Uri uri) { try { ContentResolver resolver = Application.ContentResolver; var stream = resolver.OpenInputStream(uri); var xml = new XmlDocument(); xml.Load(stream); var control = new ReadOnlyControlFile(xml); var podcasts = control.GetPodcasts(); int count = 0; foreach (var item in podcasts) { count++; } NoOfFeeds = count; AndroidApplication.Logger.Debug(() => $"MainActivity:Control Podcasts {control.GetSourceRoot()}"); AndroidApplication.Logger.Debug(() => $"MainActivity:Control Podcasts {count}"); SetTextViewText(Resource.Id.txtConfigFilePath, $"{uri.ToString()}"); freeBytesNet = GetFreeBytes(control.GetSourceRoot()); freeBytesAndroid = FileSystemHelper.GetAvailableFileSystemSizeInBytes(control.GetSourceRoot()); totalBytesAndroid = FileSystemHelper.GetTotalFileSystemSizeInBytes(control.GetSourceRoot()); var output = $"{count}, {control.GetSourceRoot()}\nFree space (Net): {DisplayFormatter.RenderFileSize(freeBytesNet)}\nFree/total space (Android): {DisplayFormatter.RenderFileSize(freeBytesAndroid)}/{DisplayFormatter.RenderFileSize(totalBytesAndroid)}"; SetTextViewText(Resource.Id.txtOutput, output); return(control); } catch (Exception ex) { AndroidApplication.Logger.LogException(() => $"MainActivity: OpenConfigFile", ex); SetTextViewText(Resource.Id.txtConfigFilePath, $"Error {ex.Message}"); return(null); } }