public Form1() { InitializeComponent(); samples = SamplesManager.GetSamples(SamplePlatforms.iOS).ToList(); sampleGroups = Enum.GetValues(typeof(SampleCategories)) .Cast <SampleCategories>() .Select(c => new GroupedSamples(c, samples.Where(s => s.Category.HasFlag(c)))) .Where(g => g.Samples.Count > 0) .OrderBy(g => g.Category == SampleCategories.Showcases ? string.Empty : g.Name) .ToList(); SamplesInitializer.Init(); foreach (var category in sampleGroups) { // create the menu item var menu = new ToolStripMenuItem(category.Name); foreach (var sample in category.Samples) { // create the sample item var menuItem = new ToolStripMenuItem(sample.Title, null, OnSampleSelected) { Tag = sample }; menu.DropDownItems.Add(menuItem); } // add to the menu bar samplesMenu.DropDownItems.Add(menu); } SetSample(samples.First(s => s.Category.HasFlag(SampleCategories.Showcases))); }
protected override void OnTapped() { base.OnTapped(); // display to the user SamplesManager.OnOpenFile(path); }
protected override async Task OnInit() { await base.OnInit(); // create the folder for this sample root = SamplesManager.EnsureTempDataDirectory("CreatePdfSample"); }
public SamplesController(LimsContext db, ILoggerFactory logFactory, UserManager <LimsUser> userMgr, SamplesManager sampleService) { this.db = db; this.logger = logFactory.CreateLogger("SamplesLogger"); this.userMgr = userMgr; this.sampleService = sampleService; }
protected override async Task OnInit() { await base.OnInit(); // create the folder for this sample var root = SamplesManager.EnsureTempDataDirectory("CreateXpsSample"); path = Path.Combine(root, $"{Guid.NewGuid():N}.xps"); }
public AppDelegate() { samples = SamplesManager.GetSamples(SamplePlatforms.OSX).ToList(); sampleGroups = Enum.GetValues(typeof(SampleCategories)) .Cast <SampleCategories>() .Select(c => new GroupedSamples(c, samples.Where(s => s.Category.HasFlag(c)))) .Where(g => g.Samples.Count > 0) .OrderBy(g => g.Category == SampleCategories.Showcases ? string.Empty : g.Name) .ToList(); }
public void GetSamplesList() { using (AppDbContext db = new AppDbContext()) { // Arrange var sm = new SamplesManager(db); // Act var result = sm.getSamplesList(); // Assert Assert.NotNull(result); Assert.IsType <Task <List <SampleToJson> > >(result); } }
protected override void OnTapped() { base.OnTapped(); var path = Path.Combine(root, $"{Guid.NewGuid().ToString("N")}.xps"); using (var stream = new SKFileWStream(path)) using (var document = SKDocument.CreateXps(stream)) using (var paint = new SKPaint()) { if (document == null) { xpsSupported = false; Refresh(); return; } paint.TextSize = 64.0f; paint.IsAntialias = true; paint.Color = (SKColor)0xFF9CAFB7; paint.IsStroke = true; paint.StrokeWidth = 3; paint.TextAlign = SKTextAlign.Center; var width = 840; var height = 1188; // draw page 1 using (var xpsCanvas = document.BeginPage(width, height)) { // draw contents xpsCanvas.DrawText("...XPS 1/2...", width / 2, height / 4, paint); document.EndPage(); } // draw page 2 using (var xpsCanvas = document.BeginPage(width, height)) { // draw contents xpsCanvas.DrawText("...XPS 2/2...", width / 2, height / 4, paint); document.EndPage(); } // end the doc document.Close(); } // display to the user SamplesManager.OnOpenFile(path); }
public void GetCustomSamplesList() { using (AppDbContext db = new AppDbContext()) { // Arrange var sm = new SamplesManager(db); var selection = new SamplesSelectionModel { StartPulse = 60, EndPulse = 90 }; // Act var result = sm.getCustomSamplesList(selection); // Assert Assert.NotNull(result); Assert.IsType <Task <List <SampleToJson> > >(result); } }
public MainViewModel(SamplesManager samplesManager, IViewResolver viewResolver, IRegionService regionService) { Categories = samplesManager.Categories; Categories .SelectMany(c => c.Samples) .ForEach(s => { s.ViewSampleHandler = sample => { SelectedSample = sample; regionService.GetKnownRegionManager <MainView>() .GetRegion <IContentRegion>("SampleContentRegion") .Content = viewResolver.GetView(SelectedSample.ViewType); }; }); }
private static SampleBase[] GetPlatformSamples() { switch (Device.RuntimePlatform) { case Device.iOS: return(SamplesManager.GetSamples(SamplePlatforms.iOS).ToArray()); case Device.Android: return(SamplesManager.GetSamples(SamplePlatforms.Android).ToArray()); case Device.UWP: return(SamplesManager.GetSamples(SamplePlatforms.UWP).ToArray()); default: return(SamplesManager.GetSamples(SamplePlatforms.All).ToArray()); } }
private static SampleBase[] GetPlatformSamples() { switch (Device.OS) { case TargetPlatform.iOS: return(SamplesManager.GetSamples(SamplePlatforms.iOS).ToArray()); case TargetPlatform.Android: return(SamplesManager.GetSamples(SamplePlatforms.Android).ToArray()); case TargetPlatform.Windows: return(SamplesManager.GetSamples(SamplePlatforms.UWP).ToArray()); default: return(SamplesManager.GetSamples(SamplePlatforms.All).ToArray()); } }
protected override void OnTapped() { base.OnTapped(); var path = Path.Combine(root, $"{Guid.NewGuid().ToString("N")}.pdf"); using (var stream = new SKFileWStream(path)) using (var document = SKDocument.CreatePdf(stream)) using (var paint = new SKPaint()) { paint.TextSize = 64.0f; paint.IsAntialias = true; paint.Color = (SKColor)0xFF9CAFB7; paint.IsStroke = true; paint.StrokeWidth = 3; paint.TextAlign = SKTextAlign.Center; var width = 840; var height = 1188; // draw page 1 using (var pdfCanvas = document.BeginPage(width, height)) { pdfCanvas.DrawText("...PDF 1/2...", width / 2, height / 4, paint); document.EndPage(); } // draw page 2 using (var pdfCanvas = document.BeginPage(width, height)) { pdfCanvas.DrawText("...PDF 2/2...", width / 2, height / 4, paint); document.EndPage(); } // end the doc document.Close(); } // display to the user SamplesManager.OnOpenFile(path); }
public override void ViewDidLoad() { base.ViewDidLoad(); canvas.PaintSurface += OnPaintSample; // initialize all the samples SamplesInitializer.Init(); // get our samples var samples = SamplesManager.GetSamples(SamplePlatforms.tvOS).ToArray(); // the "moving" button frame var frame = new CGRect( Spacing, Padding + Spacing, scrollview.Bounds.Width - (Spacing * 2), ButtonHeight); foreach (var sample in samples) { // create and add the sample button var button = new UIButton(UIButtonType.RoundedRect); button.Frame = frame; button.SetTitle(sample.Title, UIControlState.Normal); button.PrimaryActionTriggered += (sender, e) => OnSampleSelected(sample); scrollview.AddSubview(button); // prepare for next button frame.Y += ButtonHeight + Spacing; } // set the scroll bounds frame.Y += Spacing + Padding; scrollview.ContentSize = new CGSize(scrollview.Bounds.Width, frame.Bottom); // select the "first" sample var showcase = samples.First(s => s.Category.HasFlag(SampleCategories.Showcases)); OnSampleSelected(showcase); }
public MainWindow() { InitializeComponent(); samples = SamplesManager.GetSamples(SamplePlatforms.WindowsDesktop).ToList(); sampleGroups = Enum.GetValues(typeof(SampleCategories)) .Cast <SampleCategories>() .Select(c => new GroupedSamples(c, samples.Where(s => s.Category.HasFlag(c)))) .Where(g => g.Samples.Count > 0) .OrderBy(g => g.Category == SampleCategories.Showcases ? string.Empty : g.Name) .ToList(); SamplesInitializer.Init(); foreach (var category in sampleGroups) { // create the menu item var menu = new MenuItem { Header = category.Name }; foreach (var sample in category.Samples) { // create the sample item var menuItem = new MenuItem { Header = sample.Title, Tag = sample }; menuItem.Click += OnSampleSelected; menu.Items.Add(menuItem); } // add to the menu bar samplesMenu.Items.Add(menu); } SetSample(samples.First(s => s.Category.HasFlag(SampleCategories.Showcases))); }
public MainPage() { this.InitializeComponent(); if (ApiInformation.IsTypePresent(typeof(StatusBar).FullName)) { var statusBar = StatusBar.GetForCurrentView(); statusBar.BackgroundColor = XamarinLightBlue; statusBar.ForegroundColor = Colors.White; statusBar.BackgroundOpacity = 1; } if (ApiInformation.IsTypePresent(typeof(ApplicationViewTitleBar).FullName)) { var titlebar = ApplicationView.GetForCurrentView().TitleBar; titlebar.BackgroundColor = XamarinLightBlue; titlebar.ForegroundColor = Colors.White; titlebar.ButtonBackgroundColor = XamarinLightBlue; titlebar.ButtonForegroundColor = Colors.White; titlebar.ButtonHoverBackgroundColor = XamarinDarkBlue; titlebar.ButtonHoverForegroundColor = Colors.White; } samples = SamplesManager.GetSamples(SamplePlatforms.iOS).ToList(); sampleGroups = Enum.GetValues(typeof(SampleCategories)) .Cast <SampleCategories>() .Select(c => new GroupedSamples(c, samples.Where(s => s.Category.HasFlag(c)))) .Where(g => g.Count > 0) .OrderBy(g => g.Category == SampleCategories.Showcases ? string.Empty : g.Name) .ToList(); SamplesInitializer.Init(); samplesViewSource.Source = sampleGroups; SetSample(samples.First(s => s.Category.HasFlag(SampleCategories.Showcases))); }
protected override void OnTapped() { base.OnTapped(); var path = Path.Combine(root, $"{Guid.NewGuid().ToString("N")}.pdf"); var metadata = new SKDocumentPdfMetadata { Author = "Cool Developer", Creation = DateTime.Now, Creator = "Cool Developer Library", Keywords = "SkiaSharp, Sample, PDF, Developer, Library", Modified = DateTime.Now, Producer = "SkiaSharp", Subject = "SkiaSharp Sample PDF", Title = "Sample PDF", }; using (var stream = new SKFileWStream(path)) using (var document = SKDocument.CreatePdf(stream, metadata)) using (var paint = new SKPaint()) { paint.TextSize = 64.0f; paint.IsAntialias = true; paint.Color = (SKColor)0xFF9CAFB7; paint.IsStroke = true; paint.StrokeWidth = 3; paint.TextAlign = SKTextAlign.Center; var width = 840; var height = 1188; // draw page 1 using (var pdfCanvas = document.BeginPage(width, height)) { // draw button var nextPagePaint = new SKPaint { IsAntialias = true, TextSize = 16, Color = SKColors.OrangeRed }; var nextText = "Next Page >>"; var btn = new SKRect(width - nextPagePaint.MeasureText(nextText) - 24, 0, width, nextPagePaint.TextSize + 24); pdfCanvas.DrawText(nextText, btn.Left + 12, btn.Bottom - 12, nextPagePaint); // make button link pdfCanvas.DrawLinkDestinationAnnotation(btn, "next-page"); // draw contents pdfCanvas.DrawText("...PDF 1/2...", width / 2, height / 4, paint); document.EndPage(); } // draw page 2 using (var pdfCanvas = document.BeginPage(width, height)) { // draw link destintion pdfCanvas.DrawNamedDestinationAnnotation(SKPoint.Empty, "next-page"); // draw contents pdfCanvas.DrawText("...PDF 2/2...", width / 2, height / 4, paint); document.EndPage(); } // end the doc document.Close(); } // display to the user SamplesManager.OnOpenFile(path); }
public PurchaseOrderRequestsController(ILogger <PurchaseOrderRequestsController> logger, SamplesManager samples, LimsContext db) { this.samples = samples; this.logger = logger; this.Db = db; }