Exemple #1
0
 private void resetStatusStrip()
 {
     ToolStripStatusLabel1.Text      = "";
     ToolStripStatusLabel1.ForeColor = Color.Black;
     StatusStrip1.Refresh();
     ErrorRichTextBox.ResetText();
 }
Exemple #2
0
 private void mViewer_OnStatus(string msg, int index, int max)
 {
     lblStatus.Text   = msg;
     Progress.Maximum = max;
     Progress.Value   = index;
     StatusStrip1.Refresh();
 }
Exemple #3
0
        private void showStatusError(string message)
        {
            string displayMessage = "Exception: " + message;

            ToolStripStatusLabel1.Text      = displayMessage;
            ToolStripStatusLabel1.ForeColor = Color.Red;
            StatusStrip1.Refresh();
            //MessageBox.Show(displayMessage, "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
            ErrorRichTextBox.ResetText();
            ErrorRichTextBox.AppendText(displayMessage);
        }
Exemple #4
0
        private void SaveListToTextFile(object sender, EventArgs e)
        {
            if (ObjectList.SelectedObjects.Count <= 0)
            {
                Utils.ShowError(NoReplaysSelected);
                return;
            }

            SaveFileDialog1.DefaultExt = "txt";
            SaveFileDialog1.Filter     = "Text document (*.txt)|*.txt";
            if (SaveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            statusLabel.Text = "Saving... ";
            StatusStrip1.Refresh();
            const int columnWidth = 2;
            var       file        = new StreamWriter(SaveFileDialog1.FileName);

            file.WriteLine($"{ObjectList.SelectedObjects.Count} replays");
            file.WriteLine();
            // Find out order of columns
            var cols = ObjectList.AllColumns.Select((x, i) => (x.DisplayIndex, i)).ToList();

            cols.Sort((x, y) => x.DisplayIndex.CompareTo(y.DisplayIndex));
            var columnOrder = cols.Select(x => x.i).ToList();
            // Get maximum text length for each column
            var maxColTextLength = new int[columnOrder.Count];

            for (var i = 0; i < columnOrder.Count; i++)
            {
                maxColTextLength[i] = 0;
                foreach (ListViewItem j in ObjectList.SelectedItems)
                {
                    maxColTextLength[i] = Math.Max(maxColTextLength[i], j.SubItems[columnOrder[i]].Text.Length);
                }
            }

            for (var i = 0; i < columnOrder.Count; i++)
            {
                if (maxColTextLength[i] > 0)
                {
                    file.Write($" - {ObjectList.Columns[columnOrder[i]].Text}");
                }
            }
            file.Write(" - ");
            file.WriteLine();
            ToolStripProgressBar1.Value   = 0;
            ToolStripProgressBar1.Maximum = ObjectList.SelectedObjects.Count;
            foreach (ListViewItem i in ObjectList.SelectedItems)
            {
                for (var j = 0; j < columnOrder.Count; j++)
                {
                    if (maxColTextLength[j] <= 0)
                    {
                        continue;
                    }
                    file.Write(i.SubItems[columnOrder[j]].Text);
                    for (var k = 0; k < maxColTextLength[j] - i.SubItems[columnOrder[j]].Text.Length; k++)
                    {
                        file.Write(' ');
                    }
                    if (j < columnOrder.Count - 1)
                    {
                        for (var k = 0; k < columnWidth; k++)
                        {
                            file.Write(' ');
                        }
                    }
                }

                file.WriteLine();
                ToolStripProgressBar1.Value++;
            }

            file.WriteLine();
            file.Write("Total time: ");
            var totalTime = GetTotalTimeOfSelected();

            file.Write(totalTime.ToTimeString(Global.AppSettings.ReplayManager.NumDecimals));

            statusLabel.Text            = "Ready";
            ToolStripProgressBar1.Value = 0;
            file.Close();
        }