Exemple #1
0
        private void Settings_button_Click(object sender, EventArgs e)
        {
            SettingsForm SettingsForm         = new SettingsForm();
            DialogResult SettingsDialogResult = new DialogResult();

            SettingsDialogResult = SettingsForm.ShowDialog(this);

            if (SettingsDialogResult == DialogResult.OK) // ok - other settings where changed.
            {
                if (Properties.Settings.Default.AutoSaving)
                {
                    AutoSaveTimer.Start();
                }
                else
                {
                    AutoSaveTimer.Stop();
                }
            }
            if (SettingsDialogResult == DialogResult.Yes) // yes - authentification values where changed.
            {
                // reconnect to server.
                if (BuisinessLogicClass.Connect() == 2)
                {
                    Properties.Settings.Default.Connection = true;
                    OldCommits();
                    BuisinessLogicClass.Update();
                    Search_others_button.Enabled = true;
                }
            }
        }
Exemple #2
0
        private void SetIssueList()
        {
            GridContents   = BuisinessLogicClass.GetAllIssues();
            AmountOfIssues = GridContents.Length;
            Issue_list_GridView.Rows.Clear();
            DataStructureClass.DataStructure GridLine = new DataStructureClass.DataStructure();
            for (int x = 0; x < AmountOfIssues; x++)  //adding rows into GridView
            {
                GridLine = GridContents[x];
                string startDate = "";
                string dueDate   = "";
                if (GridLine._startDateCh)
                {
                    startDate = BuisinessLogicClass.ConvertDate(GridLine._startDate);
                }
                if (GridLine._dueDateCh)
                {
                    dueDate = BuisinessLogicClass.ConvertDate(GridLine._dueDate);
                }

                string donePercent = Convert.ToString(GridLine._percentDone + "%");

                Issue_list_GridView.Rows.Add(GridLine._id, GridLine._subjectName, startDate, dueDate, donePercent);

                if (GridLine._description != null)
                {
                    Issue_list_GridView.Rows[x].Cells[1].ToolTipText = GridLine._subjectName + "\r\n" + BuisinessLogicClass.NormalizeText(GridLine._description, 120);
                }
                Issue_list_GridView.Rows[x].Cells[0].ToolTipText = "double click opens the edit window.";
            }
            try { Issue_list_GridView.Rows[0].Cells[0].Selected = true; } catch { }
            Selection_changed();
        }
Exemple #3
0
 private void Selection_changed()
 {
     try {
         Start_timer_button.Enabled = true;
         if (NewIssueSelectionAvailability)
         {
             CurrentIssueName = Convert.ToString(Issue_list_GridView.SelectedRows[0].Cells[1].Value);
             CurrentIssueId   = Convert.ToInt32(Issue_list_GridView.SelectedRows[0].Cells[0].Value);
             BuisinessLogicClass.SuperIssueId = CurrentIssueId;
             CurrentIssueDataGridRowId        = Issue_list_GridView.SelectedRows[0].Index;
             DataStructureClass.DataStructure data = BuisinessLogicClass.GetOneIssue(CurrentIssueId);
             TimerTicks = data._notCommittedWorkingTime;
             UpdateTimerLabel();
         }
         for (int i = 0; i < 5; i++)
         {
             Issue_list_GridView.Rows[MouseSelectedRow].Cells[i].Style.BackColor = Color.WhiteSmoke;
         }
         MouseSelectedRow = Issue_list_GridView.SelectedRows[0].Index;
         Issue_list_GridView.BackgroundColor = Color.WhiteSmoke;
         for (int i = 0; i < 5; i++)
         {
             Issue_list_GridView.Rows[CurrentIssueDataGridRowId].Cells[i].Style.BackColor = Color.DarkGray;
         }
     }
     catch { }
 }
Exemple #4
0
        public MainForm()
        {
            InitializeComponent();
            // start
            SplashThread = new Thread(SplashScrean);
            SplashThread.Start();

            BuisinessLogicClass.Init();
            Console.SetOut(new StreamWriter(new FileStream(Path.Combine(Environment.ExpandEnvironmentVariables(@"%APPDATA%\RedmineClient20"), "log.txt"), FileMode.Append))); // console output to file
            Console.WriteLine("\r\n\r\n" + DateTime.Now + ": Application starts" + "\r\n");

            CheckForIllegalCrossThreadCalls = false;
            if (BuisinessLogicClass.Connect() == 2)
            {
                Search_others_button.Enabled = true;
                BuisinessLogicClass.Update();
                OldCommits();
            }

            ModifyGridViewData();

            notifyIcon.Text             = "Redmine Client";
            notifyIcon.BalloonTipIcon   = ToolTipIcon.Info;
            notifyIcon.BalloonTipTitle  = "REDMINE CLIENT";
            notifyIcon.ContextMenuStrip = contextMenuStrip;

            CurrentIssueTimer.Interval = 1000;
            AutoSaveTimer.Interval     = 30000;

            Issue_list_GridView.EnableHeadersVisualStyles = false;
        }
Exemple #5
0
 private void AsynchronousSearch()
 {
     while (true)
     {
         if (NewNumber != OldNumber)
         {
             if (SearchTaskTextBox.Text.Length != 0)
             {
                 ResultForSearchLabel.Text = BuisinessLogicClass.NormalizeText(BuisinessLogicClass.FindIssue(Convert.ToInt32(SearchTaskTextBox.Text)), 30);
             }
             if (ResultForSearchLabel.Text.Length > 0)
             {
                 AcceptButton.Enabled = true;
             }
             else
             {
                 AcceptButton.Enabled = false;
             }
             OldNumber           = NewNumber;
             pictureBox1.Visible = false;
         }
         else
         {
             Thread.Sleep(100);
         }
     }
 }
Exemple #6
0
 private void ExitApplication()
 {
     CurrentIssueTimer.Stop();
     CurrentIssueTimerTicking = false;
     AutoSaveTimer.Stop();
     SaveTimeTicked(NewTicksAfterAutoSave);
     BuisinessLogicClass.CleanUpIssuesFile(); // move all time to comments and empty time in main file.
     notifyIcon.Visible = false;
 }
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (username != UserNameTextBox.Text | pass != PasswordTextBox.Text | url != ServerAddrTextBox.Text | api != ApiKeyTextBox.Text | usernamePassCh != LoginPassRadioButton.Checked)
            {
                if (Properties.Settings.Default.OldCommits)
                {
                    DialogResult result = MessageBox.Show("If you save the new user settings your local commits\r\nwill be discarded. Continue?", "Local time commits left", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (result == DialogResult.Yes)
                    {
                        BuisinessLogicClass.OldCommits(false);
                    }
                    else
                    {
                        return;
                    }
                }
                DialogResult = DialogResult.Yes;
            }
            else
            {
                DialogResult = DialogResult.OK;
            }

            int counter = 0;

            for (int x = 0; x < ServerAddrTextBox.Text.Length; x++)
            {
                if (ServerAddrTextBox.Text.Substring(x, 1) == "/")
                {
                    counter++;
                }
                if (counter == 4)
                {
                    ServerAddrTextBox.Text = ServerAddrTextBox.Text.Remove(x, ServerAddrTextBox.Text.Length - x);
                    break;
                }
            }

            Properties.Settings.Default.RedmineAddress = ServerAddrTextBox.Text;
            Properties.Settings.Default.LoginType      = false;
            if (LoginPassRadioButton.Checked)
            {
                Properties.Settings.Default.LoginType = true;
            }
            Properties.Settings.Default.UserName     = UserNameTextBox.Text;
            Properties.Settings.Default.Password     = PasswordTextBox.Text;
            Properties.Settings.Default.ApiKey       = ApiKeyTextBox.Text;
            Properties.Settings.Default.RunAtStartUp = RunStartupCheckBox.Checked;
            Properties.Settings.Default.AutoSaving   = DataSavingCheckBox.Checked;

            Properties.Settings.Default.Save();

            Close();
        }
Exemple #8
0
        public CommitForm()
        {
            InitializeComponent();
            string[,] activitys = BuisinessLogicClass.GetVariables(5);
            BindingList <KeyValuePair <string, int> > m_items = new BindingList <KeyValuePair <string, int> >();

            for (int i = 0; i < activitys.GetLength(0); i++)
            {
                m_items.Add(new KeyValuePair <string, int> (activitys[i, 0], Convert.ToInt32(activitys[i, 1])));
            }
            ComboBoxActivity.DisplayMember = "Key";
            ComboBoxActivity.ValueMember   = "Value";
            ComboBoxActivity.DataSource    = m_items;

            FillData();
        }
Exemple #9
0
 private void OldCommits()
 {
     if (BuisinessLogicClass.CheckForOldCommits())
     {
         DialogResult result = MessageBox.Show("Local commits left\r\nYES - send 'em to server\r\nNO - delete 'em\r\nCANCEL - work offline", "Local time commits", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
         if (result == DialogResult.Yes)
         {
             BuisinessLogicClass.OldCommits(true);
             MessageBox.Show("The commits where succesfully logged to " + Properties.Settings.Default.RedmineAddress, "Local time commits", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         if (result == DialogResult.No)
         {
             BuisinessLogicClass.OldCommits(false);
             MessageBox.Show("The commits where deleted.", "Local time commits", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         if (result == DialogResult.Cancel)
         {
             Properties.Settings.Default.Connection = false;
         }
     }
 }
Exemple #10
0
        private void AcceptButton_Click(object sender, EventArgs e)
        {
            try
            {
                NewStructure = OldStructure;

                if (ProjectSelectComboBox.Text.Length < 2)
                {
                    throw new ArgumentException("Project");
                }
                NewStructure._projectName = ProjectSelectComboBox.Text;
                NewStructure._projectId   = Convert.ToInt32(ProjectSelectComboBox.SelectedValue);

                if (SubjectNameTextBox.Text.Length < 1)
                {
                    throw new ArgumentException("Subject");
                }
                NewStructure._subjectName = SubjectNameTextBox.Text;

                NewStructure._percentDone = PercentDonecomboBox.SelectedIndex * 10;

                if (PrioritycomboBox.Text.Length < 2)
                {
                    throw new ArgumentException("Priority");
                }
                NewStructure._priority   = PrioritycomboBox.Text;
                NewStructure._priorityId = Convert.ToInt32(PrioritycomboBox.SelectedValue);

                NewStructure._assignedTo   = AssignedToComboBox.Text;
                NewStructure._assignedToId = Convert.ToInt32(AssignedToComboBox.SelectedValue);

                if (StatusComboBox.Text.Length < 2)
                {
                    throw new ArgumentException("Status");
                }
                NewStructure._status   = StatusComboBox.Text;
                NewStructure._statusId = Convert.ToInt32(StatusComboBox.SelectedValue);

                if (TrackerComboBox.Text.Length < 2)
                {
                    throw new ArgumentException("Tracker");
                }
                NewStructure._tracker   = TrackerComboBox.Text;
                NewStructure._trackerId = Convert.ToInt32(TrackerComboBox.SelectedValue);

                NewStructure._description = DescriptionRichTextBox.Text;
                NewStructure._notes       = NotesRichTextBox.Text;

                if (EstimTimeTextBox.Text.Length > 0)
                {
                    NewStructure._estimHours = Convert.ToInt32(EstimTimeTextBox.Text);
                }

                if (StartDateCheckBox.Checked)
                {
                    NewStructure._startDate   = StartDateDateTimePicker.Value;
                    NewStructure._startDateCh = true;
                }
                else
                {
                    NewStructure._startDate   = new DateTime(1, 1, 1);
                    NewStructure._startDateCh = false;
                }
                if (DueDateCheckBox.Checked)
                {
                    NewStructure._dueDate   = DueDateDateTimePicker.Value;
                    NewStructure._dueDateCh = true;
                }
                else
                {
                    NewStructure._dueDate   = new DateTime(1, 1, 1);
                    NewStructure._dueDateCh = false;
                }
            }
            catch (ArgumentException err)
            {
                MessageBox.Show($"{err.Message} should be selected.", "Wrong values", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (TypeCreate)
            {
                BuisinessLogicClass.CreateIssue(NewStructure);
            }
            else
            {
                BuisinessLogicClass.EditIssue(NewStructure);
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Exemple #11
0
        public EditIssueForm()
        {
            InitializeComponent();
            if (BuisinessLogicClass.EditIssueId == -1234)
            {
                TypeCreate = true;
                Text       = "Creat issue";
            }
            OldStructure = BuisinessLogicClass.GetOneIssue(BuisinessLogicClass.EditIssueId);

            {
                string[,] projects = BuisinessLogicClass.GetVariables(1);
                ProjectSelectComboBox.Items.Clear();

                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();

                int x = 0;
                while (x < projects.GetLength(0))
                {
                    items.Add(new KeyValuePair <string, int>(projects[x, 0], Convert.ToInt32(projects[x, 1])));
                    x++;
                }
                ProjectSelectComboBox.DisplayMember = "Key";
                ProjectSelectComboBox.ValueMember   = "Value";
                ProjectSelectComboBox.DataSource    = items;
                ProjectSelectComboBox.Text          = OldStructure._projectName;
            } // projects

            {
                string[,] trackers = BuisinessLogicClass.GetVariables(2);
                TrackerComboBox.Items.Clear();

                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();

                int x = 0;
                while (x < trackers.GetLength(0))
                {
                    items.Add(new KeyValuePair <string, int>(trackers[x, 0], Convert.ToInt32(trackers[x, 1])));
                    x++;
                }
                TrackerComboBox.DisplayMember = "Key";
                TrackerComboBox.ValueMember   = "Value";
                TrackerComboBox.DataSource    = items;
                TrackerComboBox.Text          = OldStructure._tracker;
            } // trackers

            {
                // сделать зависимость от типа пользователя.
                string[,] statuses = BuisinessLogicClass.GetVariables(3);
                StatusComboBox.Items.Clear();
                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();
                if ((OldStructure._statusId != 7 || OldStructure._statusId != 2) & OldStructure._statusId != 0)
                {
                    items.Add(new KeyValuePair <string, int>(OldStructure._status, OldStructure._statusId));
                }
                else if (OldStructure._statusId == 7 || OldStructure._statusId == 2)
                {
                    int x = 0;
                    while (x < statuses.GetLength(0))
                    {
                        if (OldStructure._status == statuses[x, 0])
                        {
                            items.Add(new KeyValuePair <string, int>(statuses[x, 0], Convert.ToInt32(statuses[x, 1])));
                            items.Add(new KeyValuePair <string, int>(statuses[x + 1, 0], Convert.ToInt32(statuses[x + 1, 1])));
                        }
                        x++;
                    }
                }
                else
                {
                    items.Add(new KeyValuePair <string, int>(statuses[0, 0], Convert.ToInt32(statuses[0, 1])));
                    items.Add(new KeyValuePair <string, int>(statuses[1, 0], Convert.ToInt32(statuses[1, 1])));
                }

                StatusComboBox.DisplayMember = "Key";
                StatusComboBox.ValueMember   = "Value";
                StatusComboBox.DataSource    = items;
                TrackerComboBox.Text         = OldStructure._tracker;
            } // statuses

            {
                string[,] prioritys = BuisinessLogicClass.GetVariables(4);
                PrioritycomboBox.Items.Clear();
                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();

                int x = 0;
                while (x < prioritys.GetLength(0))
                {
                    items.Add(new KeyValuePair <string, int>(prioritys[x, 0], Convert.ToInt32(prioritys[x, 1])));
                    x++;
                }
                PrioritycomboBox.DisplayMember = "Key";
                PrioritycomboBox.ValueMember   = "Value";
                PrioritycomboBox.DataSource    = items;
                PrioritycomboBox.Text          = OldStructure._priority;
            } // prioritys

            {
                string[,] users = BuisinessLogicClass.GetVariables(6);
                AssignedToComboBox.Items.Clear();

                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();

                int x = 0;
                while (x < users.GetLength(0))
                {
                    items.Add(new KeyValuePair <string, int>(users[x, 0], Convert.ToInt32(users[x, 1])));
                    x++;
                }
                AssignedToComboBox.DisplayMember = "Key";
                AssignedToComboBox.ValueMember   = "Value";
                AssignedToComboBox.DataSource    = items;
                AssignedToComboBox.Text          = OldStructure._assignedTo;

                AssignedToComboBox.Text = OldStructure._assignedTo;
            } // users

            if (!TypeCreate)
            {
                Fill_data();
            }
        }
Exemple #12
0
 private void SaveTimeTicked(int time)
 {
     BuisinessLogicClass.SaveTimeTicked(CurrentIssueId, time);
 }
Exemple #13
0
 private void Accept()
 {
     BuisinessLogicClass.AddIssueByItsId(Convert.ToInt32(SearchTaskTextBox.Text));
     DialogResult = DialogResult.OK;
     Close();
 }
Exemple #14
0
 private void CommitButton_Click(object sender, EventArgs e)
 {
     BuisinessLogicClass.CommitOneTimeEntry(BuisinessLogicClass.SuperIssueId, CommentRichTextBox.Text, Convert.ToInt32(ComboBoxActivity.SelectedValue.ToString()));
     DialogResult = DialogResult.OK;
     Close();
 }