LinkerPleaseInclude.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System.Collections.Specialized;
  2. using System.Windows.Input;
  3. using Android.App;
  4. using Android.Views;
  5. using Android.Widget;
  6. namespace FormulaOneApp.Classic.Android
  7. {
  8. // This class is never actually executed, but when Xamarin linking is enabled it does how to ensure types and properties
  9. // are preserved in the deployed app
  10. public class LinkerPleaseInclude
  11. {
  12. public void Include(Button button)
  13. {
  14. button.Click += (s,e) => button.Text = button.Text + "";
  15. }
  16. public void Include(CheckBox checkBox)
  17. {
  18. checkBox.CheckedChange += (sender, args) => checkBox.Checked = !checkBox.Checked;
  19. }
  20. public void Include(Switch @switch)
  21. {
  22. @switch.CheckedChange += (sender, args) => @switch.Checked = !@switch.Checked;
  23. }
  24. public void Include(View view)
  25. {
  26. view.Click += (s, e) => view.ContentDescription = view.ContentDescription + "";
  27. }
  28. public void Include(TextView text)
  29. {
  30. text.TextChanged += (sender, args) => text.Text = "" + text.Text;
  31. text.Hint = "" + text.Hint;
  32. }
  33. public void Include(CheckedTextView text)
  34. {
  35. text.TextChanged += (sender, args) => text.Text = "" + text.Text;
  36. text.Hint = "" + text.Hint;
  37. }
  38. public void Include(CompoundButton cb)
  39. {
  40. cb.CheckedChange += (sender, args) => cb.Checked = !cb.Checked;
  41. }
  42. public void Include(SeekBar sb)
  43. {
  44. sb.ProgressChanged += (sender, args) => sb.Progress = sb.Progress + 1;
  45. }
  46. public void Include(Activity act)
  47. {
  48. act.Title = act.Title + "";
  49. }
  50. public void Include(INotifyCollectionChanged changed)
  51. {
  52. changed.CollectionChanged += (s,e) => { var test = string.Format("{0}{1}{2}{3}{4}", e.Action,e.NewItems, e.NewStartingIndex, e.OldItems, e.OldStartingIndex); } ;
  53. }
  54. public void Include(ICommand command)
  55. {
  56. command.CanExecuteChanged += (s, e) => { if (command.CanExecute(null)) command.Execute(null); };
  57. }
  58. public void Include(Cirrious.CrossCore.IoC.MvxPropertyInjector injector)
  59. {
  60. injector = new Cirrious.CrossCore.IoC.MvxPropertyInjector ();
  61. }
  62. public void Include(System.ComponentModel.INotifyPropertyChanged changed)
  63. {
  64. changed.PropertyChanged += (sender, e) => {
  65. var test = e.PropertyName;
  66. };
  67. }
  68. }
  69. }