Skip to content

Commit

Permalink
Merge pull request soygul#18 from rftd/master
Browse files Browse the repository at this point in the history
Custom Submission Method
  • Loading branch information
soygul committed Jul 19, 2013
2 parents 5bc1613 + 3aec3f6 commit 775047f
Show file tree
Hide file tree
Showing 85 changed files with 1,664 additions and 1,575 deletions.
26 changes: 12 additions & 14 deletions GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


using System;
using System.Reflection;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCompany("")]
Expand All @@ -23,22 +22,22 @@

/*
* Basic rules to become CLS compilant is below:
* 1. Unsigned types should not be part of the public interface of the class. What this means is public fields should not
* have unsigned types like uint or ulong, public methods should not return unsigned types, parameters passed to public
* 1. Unsigned types should not be part of the public interface of the class. What this means is public fields should not
* have unsigned types like uint or ulong, public methods should not return unsigned types, parameters passed to public
* function should not have unsigned types. However unsigned types can be part of private members.
* 2. Unsafe types like pointers should not be used with public members. However they can be used with private members.
* 3. Class names and member names should not differ only based on their case. For example we cannot have two methods
* 3. Class names and member names should not differ only based on their case. For example we cannot have two methods
* named MyMethod and MYMETHOD.
* 4. Only properties and methods may be overloaded, Operators should not be overloaded.
*/
[assembly: CLSCompliant(true)]

// Version information for an assembly consists of the following four values:
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1")]
Expand All @@ -47,15 +46,14 @@
// Standard Way: [major].[minor].[bugfix].[build]
// .NET Convention: Third digit is the auto-incremented build version. Fourth digit is revision, which is service pack no
[assembly: AssemblyFileVersion("1.1.2.0")]

/*
* AssemblyVersion should only be changed for major changes or breaking changes since any change to the
* AssemblyVersion would force every .NET application referencing the assembly to re-compile against the
/*
* AssemblyVersion should only be changed for major changes or breaking changes since any change to the
* AssemblyVersion would force every .NET application referencing the assembly to re-compile against the
* new version!
*
*
* Do not change the AssemblyVersion for a servicing release which is intended to be backwards compatible.
* Do change the AssemblyVersion for a release that you know has breaking changes.
*
* Remember that it’s the AssemblyFileVersion that contains all the interesting servicing information
*
* Remember that it’s the AssemblyFileVersion that contains all the interesting servicing information
* (it’s the Revision part of this version that tells you what Service Pack you’re on)
*/

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@

namespace NBug.Configurator
{
using NBug.Core.Reporting.Info;
using NBug.Core.UI;
using System;
using System.Drawing;
using System.Windows.Forms;
using NBug.Core.UI;
using NBug.Core.Reporting.Info;

internal partial class Normal : Form
internal partial class CustomPreviewForm : Form
{
private UIDialogResult uiDialogResult;

internal Normal()
internal CustomPreviewForm()
{
InitializeComponent();
InitializeComponent();
}

internal UIDialogResult ShowDialog(Report report)
Expand All @@ -43,4 +42,4 @@ private void QuitButton_Click(object sender, EventArgs e)
this.Close();
}
}
}
}
File renamed without changes.
1,775 changes: 873 additions & 902 deletions NBug.Configurator/MainForm.Designer.cs

Large diffs are not rendered by default.

81 changes: 62 additions & 19 deletions NBug.Configurator/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@

namespace NBug.Configurator
{
using NBug.Configurator.SubmitPanels;
using NBug.Enums;
using NBug.Core.Util;
using NBug.Core.Submission;

/* Dear maintainer:
*
* Once you are done trying to 'optimize' this file, and have realized what a terrible mistake that was,
* please increment the following counter as a warning to the next guy:
*
* total_hours_wasted_here = 20
*/
*
* Once you are done trying to 'optimize' this file, and have realized what a terrible mistake that was,
* please increment the following counter as a warning to the next guy:
*
* total_hours_wasted_here = 20
*/

using System;
using System.Collections.Generic;
Expand All @@ -22,13 +27,9 @@ namespace NBug.Configurator
using System.Linq;
using System.Windows.Forms;


using NBug.Configurator.SubmitPanels;
using NBug.Enums;

public partial class MainForm : Form
{
private ICollection<PanelLoader> panelLoaders = new Collection<PanelLoader>();
private readonly ICollection<PanelLoader> panelLoaders = new Collection<PanelLoader>();

private FileStream settingsFile;

Expand All @@ -39,14 +40,15 @@ public MainForm()
NBug.Settings.CustomUIEvent += Settings_CustomUIEvent;
this.openFileDialog.InitialDirectory = Environment.CurrentDirectory;
this.createFileDialog.InitialDirectory = Environment.CurrentDirectory;
panelLoaders.Add(this.panelLoader1);
NBug.Settings.Destinations.Clear();
}

void Settings_CustomUIEvent(object sender, CustomUIEventArgs e)
private void Settings_CustomUIEvent(object sender, CustomUIEventArgs e)
{
var Form = new Normal();
var Form = new CustomPreviewForm();
e.Result = Form.ShowDialog(e.Report);
}

/// <summary>
/// Enables disabled controls and fills in combo boxes using related enumerations. Resets all values to defaults.
/// </summary>
Expand Down Expand Up @@ -80,7 +82,7 @@ private void InitializeControls()
{
loader.UnloadPanel();
}

this.sleepBeforeSendNumericUpDown.Maximum = decimal.MaxValue;
this.maxQueuedReportsNumericUpDown.Maximum = decimal.MaxValue;
this.stopReportingAfterNumericUpDown.Maximum = decimal.MaxValue;
Expand All @@ -103,7 +105,7 @@ private void LoadSettingsFile(bool createNew)
this.InitializeControls();

this.fileTextBox.Text = createNew == false ? this.openFileDialog.FileName : this.createFileDialog.FileName;

// Read application settings
this.uiProviderComboBox.SelectedItem = Settings.UIProvider;
this.uiModeComboBox.SelectedItem = Settings.UIMode; // Should come after uiProviderComboBox = ...
Expand Down Expand Up @@ -147,11 +149,14 @@ private void LoadSettingsFile(bool createNew)
{
mainTabs.TabPages.RemoveAt(2);
}

panelLoaders.Clear();

// Read connection strings
foreach (var destination in Settings.Destinations.Take(5))
foreach (var destination in Settings.Destinations)
{
var loader = new PanelLoader();
loader.RemoveDestination += loader_RemoveDestination;
loader.LoadPanel(destination.ConnectionString);
panelLoaders.Add(loader);
var tabPage = new TabPage(string.Format("Submit #{0}", panelLoaders.Count));
Expand Down Expand Up @@ -195,12 +200,12 @@ private void SaveButton_Click(object sender, EventArgs e)
Settings.StoragePath = this.storagePathComboBox.Text == "Custom" ? this.customStoragePathTextBox.Text : this.storagePathComboBox.Text;

Settings.Destinations.Clear();

// Save connection strings
foreach (var connectionString in panelLoaders
.Where(p => p.Controls.Count == 2)
.Select(p => ((ISubmitPanel)p.Controls[0]).ConnectionString)
.Where(s => !string.IsNullOrEmpty(s)))

{
Settings.AddDestinationFromConnectionString(connectionString);
}
Expand Down Expand Up @@ -409,10 +414,48 @@ private void UIProviderComboBox_SelectedIndexChanged(object sender, EventArgs e)
private void AddDestinationButton_Click(object sender, EventArgs e)
{
var loader = new PanelLoader();
loader.RemoveDestination += loader_RemoveDestination;
panelLoaders.Add(loader);
var tabPage = new TabPage(string.Format("Submit #{0}", panelLoaders.Count));
tabPage.Controls.Add(loader);
mainTabs.TabPages.Add(tabPage);
}

void loader_RemoveDestination(object sender, EventArgs e)
{
var loader = sender as PanelLoader;
var idx = 2;
idx += (panelLoaders.ToList<PanelLoader>()).IndexOf(loader);

if (!string.IsNullOrEmpty(loader.connString))
{
var protocol = ConnectionStringParser.Parse(loader.connString)["Type"];
IProtocol dest = null;

if (protocol == typeof(Core.Submission.Web.Mail).Name || protocol.ToLower() == "email" || protocol.ToLower() == "e-mail")
{
dest = new Core.Submission.Web.Mail(loader.connString);
}
else if (protocol == typeof(Core.Submission.Tracker.Redmine).Name)
{
dest = new Core.Submission.Tracker.Redmine(loader.connString);
}
else if (protocol == typeof(Core.Submission.Web.Ftp).Name)
{
dest = new Core.Submission.Tracker.Redmine(loader.connString);
}
else if (protocol == typeof(Core.Submission.Web.Http).Name)
{
dest = new Core.Submission.Tracker.Redmine(loader.connString);
}

if (dest != null)
Settings.Destinations.Remove(dest);
}

panelLoaders.Remove(loader);
mainTabs.TabPages.RemoveAt(idx);
return;
}
}
}
}
2 changes: 1 addition & 1 deletion NBug.Configurator/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,4 @@ just to log and submit exceptions but not interfering with the application execu
AADwDwAA8A8AAA==
</value>
</data>
</root>
</root>
10 changes: 5 additions & 5 deletions NBug.Configurator/NBug.Configurator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Normal.cs">
<Compile Include="CustomPreviewForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Normal.Designer.cs">
<DependentUpon>Normal.cs</DependentUpon>
<Compile Include="CustomPreviewForm.Designer.cs">
<DependentUpon>CustomPreviewForm.cs</DependentUpon>
</Compile>
<Compile Include="PreviewForm.cs">
<SubType>Form</SubType>
Expand Down Expand Up @@ -158,8 +158,8 @@
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Normal.resx">
<DependentUpon>Normal.cs</DependentUpon>
<EmbeddedResource Include="CustomPreviewForm.resx">
<DependentUpon>CustomPreviewForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PreviewForm.resx">
<DependentUpon>PreviewForm.cs</DependentUpon>
Expand Down
9 changes: 4 additions & 5 deletions NBug.Configurator/PreviewForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@

namespace NBug.Configurator
{
using System;
using System.IO;
using System.Windows.Forms;

using NBug.Core.Reporting.Info;
using NBug.Core.UI.Console;
using NBug.Core.UI.WinForms;
using NBug.Core.UI.WPF;
using NBug.Core.Util.Serialization;
using NBug.Enums;
using System;
using System.IO;
using System.Windows.Forms;

internal partial class PreviewForm : Form
{
Expand Down Expand Up @@ -64,4 +63,4 @@ private void CloseButton_Click(object sender, EventArgs e)
this.Close();
}
}
}
}
2 changes: 1 addition & 1 deletion NBug.Configurator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public static void Main()
Application.Run(new MainForm());
}
}
}
}
11 changes: 5 additions & 6 deletions NBug.Configurator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NBug.Configurator")]
[assembly: AssemblyDescription("NBug Configurator Application created by Teoman Soygul.")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

Expand All @@ -20,10 +19,10 @@
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
2 changes: 1 addition & 1 deletion NBug.Configurator/SubmitPanels/ISubmitPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ internal interface ISubmitPanel
{
string ConnectionString { get; set; }
}
}
}
Loading

0 comments on commit 775047f

Please sign in to comment.