Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Globals.Interfaces;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using LogicLayer;
- using Globals.Classes;
- namespace CommitMonitorMain
- {
- public partial class MainForm : Form
- {
- private ILogic Logic;
- private FolderBrowserDialog dlg;
- public MainForm(ILogic logic)
- {
- this.Logic = logic;
- InitializeComponent();
- }
- private void MainForm_Load(object sender, EventArgs e)
- {
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog fileDialog = new FolderBrowserDialog();
- DialogResult select = fileDialog.ShowDialog();
- string path;
- if (select == DialogResult.OK)
- {
- path = fileDialog.SelectedPath;
- Logic.SelectLocalRepo(path);
- textBox1.Text = Logic.CurrentRepoPath;
- if (Logic.CurrentRepoPath.Length == 0)
- {
- textBox1.Text = "invalid path";
- }
- List<AssignmentInfo> sourceAssignment = Logic.AssignmentInfos;
- comboBox1.DataSource = sourceAssignment;
- comboBox1.DisplayMember = "Name";
- try
- {
- UpdateUi();
- }
- catch (Exception err)
- {
- label2.Text = (err.Message + "");
- label2.ForeColor = (Color.Red);
- }
- }
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- var assignment = (AssignmentInfo)comboBox1.SelectedItem;
- Logic.SelectAssignment(assignment);
- textBox2.Text = assignment.Start + " - " + assignment.End;
- try
- {
- UpdateUi();
- }
- catch (Exception err)
- {
- label2.Text = (err.Message + "");
- }
- }
- private void UpdateUi()
- {
- var bitmap = (Bitmap)pictureBox1.Image;
- using (var g = Graphics.FromImage(bitmap)) g.Clear(Color.White);
- Logic.AllCommits.Draw(bitmap);
- this.pictureBox1.Refresh();
- Logic.PersonalCommits.Draw(bitmap);
- this.pictureBox1.Refresh();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement