Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. using Globals.Interfaces;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using LogicLayer;
  12. using Globals.Classes;
  13.  
  14. namespace CommitMonitorMain
  15. {
  16. public partial class MainForm : Form
  17. {
  18. private ILogic Logic;
  19. private FolderBrowserDialog dlg;
  20. public MainForm(ILogic logic)
  21. {
  22. this.Logic = logic;
  23. InitializeComponent();
  24. }
  25.  
  26. private void MainForm_Load(object sender, EventArgs e)
  27. {
  28.  
  29. }
  30.  
  31. private void label1_Click(object sender, EventArgs e)
  32. {
  33.  
  34. }
  35.  
  36. private void button1_Click(object sender, EventArgs e)
  37. {
  38. FolderBrowserDialog fileDialog = new FolderBrowserDialog();
  39. DialogResult select = fileDialog.ShowDialog();
  40. string path;
  41. if (select == DialogResult.OK)
  42. {
  43. path = fileDialog.SelectedPath;
  44. Logic.SelectLocalRepo(path);
  45. textBox1.Text = Logic.CurrentRepoPath;
  46. if (Logic.CurrentRepoPath.Length == 0)
  47. {
  48. textBox1.Text = "invalid path";
  49. }
  50. List<AssignmentInfo> sourceAssignment = Logic.AssignmentInfos;
  51. comboBox1.DataSource = sourceAssignment;
  52. comboBox1.DisplayMember = "Name";
  53.  
  54. try
  55. {
  56. UpdateUi();
  57.  
  58. }
  59. catch (Exception err)
  60. {
  61. label2.Text = (err.Message + "");
  62. label2.ForeColor = (Color.Red);
  63. }
  64. }
  65. }
  66.  
  67. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  68. {
  69. var assignment = (AssignmentInfo)comboBox1.SelectedItem;
  70. Logic.SelectAssignment(assignment);
  71. textBox2.Text = assignment.Start + " - " + assignment.End;
  72. try
  73. {
  74. UpdateUi();
  75. }
  76. catch (Exception err)
  77. {
  78. label2.Text = (err.Message + "");
  79. }
  80. }
  81. private void UpdateUi()
  82. {
  83. var bitmap = (Bitmap)pictureBox1.Image;
  84. using (var g = Graphics.FromImage(bitmap)) g.Clear(Color.White);
  85. Logic.AllCommits.Draw(bitmap);
  86. this.pictureBox1.Refresh();
  87. Logic.PersonalCommits.Draw(bitmap);
  88. this.pictureBox1.Refresh();
  89.  
  90.  
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement