Creating an ActivePrinterProfile singleton and starting to move the code from PrinterCommunication into that.

This commit is contained in:
larsbrubaker 2014-02-14 11:54:21 -08:00
parent 999e3ea551
commit 5036b364c0
4 changed files with 56 additions and 10 deletions

51
ActivePrinterProfile.cs Normal file
View file

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Diagnostics;
using System.Text;
using System.IO;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.VectorMath;
using MatterHackers.MatterControl.ContactForm;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl
{
public class ActivePrinterProfile
{
static ActivePrinterProfile globalInstance = null;
// private so that it can only be gotten through the Instance
ActivePrinterProfile()
{
}
public Printer ActivePrinter { get; set; }
public static ActivePrinterProfile Instance
{
get
{
if (globalInstance == null)
{
globalInstance = new ActivePrinterProfile();
}
return globalInstance;
}
set
{
if (globalInstance != value)
{
PrinterCommunication.Instance.Disable();
globalInstance = value;
PrinterCommunication.Instance.OnActivePrinterChanged(null);
}
}
}
}
}