{"id":23553099,"url":"https://github.com/rhildred/csharpprojectsolutions1","last_synced_at":"2025-08-01T20:11:25.031Z","repository":{"id":14138792,"uuid":"16844351","full_name":"rhildred/CSharpProjectSolutions1","owner":"rhildred","description":"examples from introductory C# class 2014","archived":false,"fork":false,"pushed_at":"2014-04-09T15:27:05.000Z","size":1420,"stargazers_count":1,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T10:11:30.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhildred.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-14T17:32:02.000Z","updated_at":"2015-12-14T08:42:34.000Z","dependencies_parsed_at":"2022-08-26T17:42:13.265Z","dependency_job_id":null,"html_url":"https://github.com/rhildred/CSharpProjectSolutions1","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2FCSharpProjectSolutions1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2FCSharpProjectSolutions1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2FCSharpProjectSolutions1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2FCSharpProjectSolutions1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhildred","download_url":"https://codeload.github.com/rhildred/CSharpProjectSolutions1/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251321988,"owners_count":21570834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-26T11:14:02.503Z","updated_at":"2025-04-28T13:48:19.835Z","avatar_url":"https://github.com/rhildred.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"CSharpProjectSolutions1\n======================\n\nexamples from introductory C# class 2014\n\nAdding Machine\n--------------\n\nSimple XAML WPF app, taken from [Rob Miles' C# Yellow book](http://www.robmiles.com/c-yellow-book/).\n\nDispatcher Timer\n----------------\n\nThought I would break down the main idea of sprite animation into timer and added on WriteableBitmap code.\n\nSprite Animation\n----------------\n\nTurns out that there are no simple examples of Sprite Animation using WPF/XAML. I wrote one that I think is pretty straightforward.\n\nXAML\n\n    \u003cWindow\u003e\n            xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n            xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n            xmlns:Properties=\"clr-namespace:SpriteAnimation.Properties\" x:Class=\"SpriteAnimation.MainWindow\"\n            Title=\"MainWindow\" Height=\"400\" Width=\"555\"\u003e\n        \u003cGrid\u003e\n            \u003cImage x:Name=\"ImageControl\" HorizontalAlignment=\"Left\" Height=\"300\" Margin=\"0,0,0,0\" VerticalAlignment=\"Top\" Width=\"555\"/\u003e\n        \u003c/Grid\u003e\n    \u003c/Window\u003e\n  \nCS\n\n      namespace SpriteAnimation\n      {\n          /// \u003csummary\u003e\n          /// Interaction logic for MainWindow.xaml\n          /// \u003c/summary\u003e\n          public partial class MainWindow : Window\n          {\n              WriteableBitmap writeableBitmap = null;\n              BitmapImage bi = null;\n              public MainWindow()\n              {\n                  InitializeComponent();\n                  // DispatcherTimer setup\n                  DispatcherTimer dispatcherTimer = new DispatcherTimer();\n                  dispatcherTimer.Tick += new EventHandler(enterFrame);\n                  dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 50);\n                  dispatcherTimer.Start();\n      \n                  writeableBitmap = new WriteableBitmap(\n                       (int)ImageControl.Width,\n                       (int)ImageControl.Height,\n                       96,\n                       96,\n                       PixelFormats.Pbgra32,\n                       null);\n                  ImageControl.Source = writeableBitmap;\n                  bi = new BitmapImage(new Uri(\"pack://application:,,,/filmstrip.png\"));\n      \n              }\n              int nY = 0;\n              private void enterFrame(object sender, EventArgs e)\n              {\n                  // Calculate stride of source\n                  int nRowBytes = bi.PixelWidth * (bi.Format.BitsPerPixel / 8);\n      \n                  // Create data array to hold source pixel data\n                  byte[] data = new byte[nRowBytes * 300];\n      \n                  // Copy source image pixels to the data array\n                  bi.CopyPixels(new Int32Rect(0, nY*300, bi.PixelWidth, 300), data, nRowBytes, 0);\n                  writeableBitmap.WritePixels(\n                      new Int32Rect(0, 0, bi.PixelWidth, 300),\n                      data, nRowBytes, 0);\n                  if (++nY == 100) nY = 0;\n              }\n          }\n      }\n\nTDD Application\n---------------\n\nSimple TDD application using nUnit. The main example is TaxTest.cs and CanadianTax.cs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhildred%2Fcsharpprojectsolutions1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhildred%2Fcsharpprojectsolutions1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhildred%2Fcsharpprojectsolutions1/lists"}