Skip to main content
Code Review

Return to Question

added 3 characters in body; edited tags
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Imagine that I need a color palette formfor my Winforms application to have a consistent look.

What I did was create a static helper class, and helper methods that I can call from anywhere in my code, and invoke what I need from the App.settings file.

Here for example, I am getting the school name from the App.config file, so I can sell this application to other schools with minimal changes on my part.

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

Are there any glaring mistakes I'm making by choosing this type of architecture?

Imagine that I need a color palette form my Winforms application to have a consistent look.

What I did was create a static helper class, and helper methods that I can call from anywhere in my code and invoke what I need from the App.settings file.

Here for example, I am getting the school name from the App.config file, so I can sell this application to other schools with minimal changes on my part.

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

Are there any glaring mistakes I'm making by choosing this type of architecture?

Imagine that I need a color palette for my Winforms application to have a consistent look.

What I did was create a static helper class and helper methods that I can call from anywhere in my code, and invoke what I need from the App.settings file.

Here for example, I am getting the school name from the App.config file, so I can sell this application to other schools with minimal changes on my part.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

Are there any glaring mistakes I'm making by choosing this type of architecture?

Added syntax highlighting for XML language (https://meta.stackexchange.com/a/184109/346987), added configuration tag, improved formatting.
Source Link

Imagine that I need a color palette form my Winforms application to have a consistent look.

What I did was create a static helper class, and helper methods that I can call from anywhere in my code and invoke what I need from the App.settingsApp.settings file.

Here for example, I am getting the school name from the App.configApp.config file, so I can sell this application to other schools with minimal changes on my part.

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

Are there any glaring mistakes I'm making by choosing this type of architecture?

Imagine that I need a color palette form my Winforms application to have a consistent look.

What I did was create a static helper class, and helper methods that I can call from anywhere in my code and invoke what I need from the App.settings file.

Here for example, I am getting the school name from the App.config file, so I can sell this application to other schools with minimal changes on my part.

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

Are there any glaring mistakes I'm making by choosing this type of architecture?

Imagine that I need a color palette form my Winforms application to have a consistent look.

What I did was create a static helper class, and helper methods that I can call from anywhere in my code and invoke what I need from the App.settings file.

Here for example, I am getting the school name from the App.config file, so I can sell this application to other schools with minimal changes on my part.

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

Are there any glaring mistakes I'm making by choosing this type of architecture?

added 13 characters in body; edited title
Source Link
Heslacher
  • 50.9k
  • 5
  • 83
  • 177

Getting/setting default values from my App.config.

Imagine that I need a color palette form my Winforms application to have a consistent look.

What I did was create a static helper class, and helper methods that I can call from anywhere in my code and invoke what I need from the App.settings file.

Here for example, I am getting the school name from the App.config file, so I can sell this application to other schools with minimal changes on my part.

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

AnyAre there any glaring mistakes I'm making by choosing this type of architecture?

Getting/setting default values from my App.config.

Imagine that I need a color palette form my Winforms application to have a consistent look.

What I did was create a static helper class, and helper methods that I can call from anywhere in my code and invoke what I need from the App.settings file.

Here for example, I getting the school name from the App.config file, so I can sell this application to other schools with minimal changes on my part.

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

Any glaring mistakes I'm making by choosing this type of architecture?

Getting/setting default values from my App.config

Imagine that I need a color palette form my Winforms application to have a consistent look.

What I did was create a static helper class, and helper methods that I can call from anywhere in my code and invoke what I need from the App.settings file.

Here for example, I am getting the school name from the App.config file, so I can sell this application to other schools with minimal changes on my part.

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings>
 <add key="schoolName" value="Uboldi"/>
 </appSettings>
</configuration>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Uboldi.Helpers
{
 public static class CustomizationHelper
 {
 public static string GetSchoolName()
 {
 return ConfigurationManager.AppSettings["schoolName"];
 }
 }
}

Usage:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Uboldi.Helpers;
namespace Uboldi
{
 public partial class MainForm : Form
 {
 public MainForm()
 {
 InitializeComponent();
 LoadFormTitle();
 }
 private void LoadFormTitle()
 {
 var schoolName = CustomizationHelper.GetSchoolName();
 this.Text = String.Format("Sistema {0} - Pagina Principal", schoolName);
 }
 }
}

Are there any glaring mistakes I'm making by choosing this type of architecture?

Question Protected by Jamal
Loading
Tweeted twitter.com/#!/StackCodeReview/status/99822013010546688
Source Link
Sergio Tapia
Sergio Tapia
Loading
lang-cs

AltStyle によって変換されたページ (->オリジナル) /