Beispiel #1
0
        public FrmMain()
        {
            InitializeComponent();
            _canQuit = false;
            _isClosing = false;

            _settings = Settings.LoadFromFile(Global.SettingsFileName);

            LoadPrintersFromSettings();
            FillOwnerInformation();

            bwServiceNotificationPipe.RunWorkerAsync();
        }
Beispiel #2
0
        public MainWorker()
        {
            try
            {
                _pluginsManager = new PluginsManager();
                _pluginsManager.LoadPlugins();


                _setting = Settings.LoadFromFile(Global.SettingsFileName);

            }
            catch (Exception e)
            {
                Global.Logger.Fatal(e.Message);
            }
        }
Beispiel #3
0
        public static bool PostNotification(Settings settings, string notificatioText)
        {
            var result = false;
            try
            {
                var client = new NotificationClient("BasicHttpBinding_INotification",
                    new EndpointAddress(ServiceUri + "/Notification.svc"));
                result = client.CreateNotification(settings.Customer.RefCode, settings.Customer.RefByCode,
                    notificatioText);

            }
            catch (Exception e)
            {
                Global.Logger.Fatal(e.Message);
            }
            return result;
        }
        public static void NotifYUser(Settings settings, SettingsPrinter printer, List<InkLevel> inkLevel)
        {
            string title = "Printer Ink is at low level";
            string body = "";
            //body += title + "\n\r\n\r";
            body += "Printer Details:\n\r";
            body += printer.Name + "\n\r";

            foreach (var level in inkLevel)
            {
                if (level.Value <= printer.Level)
                {
                    body += string.Format("{0} - {1:00%}\n\r", level.Name, level.Value);
                }
            }
            body += "\n\r\n\r*****";

            try
            {
                var pipeClient = new NamedPipeClientStream("InkMonPipe");

                pipeClient.Connect(3000);

                if (pipeClient.IsConnected)
                {
                    var buf = Encoding.ASCII.GetBytes(body);
                    pipeClient.Write(buf, 0, buf.Length);
                    pipeClient.WaitForPipeDrain();
                    pipeClient.Close();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #5
0
 public static bool LoadFromFile(string fileName, out Settings obj)
 {
     Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
Beispiel #6
0
 /// <summary>
 ///     Deserializes xml markup from file into an Settings object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output Settings object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out Settings obj, out Exception exception)
 {
     exception = null;
     obj = default(Settings);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
Beispiel #7
0
 public static bool Deserialize(string input, out Settings obj)
 {
     Exception exception;
     return Deserialize(input, out obj, out exception);
 }
Beispiel #8
0
 /// <summary>
 ///     Deserializes workflow markup into an Settings object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output Settings object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out Settings obj, out Exception exception)
 {
     exception = null;
     obj = default(Settings);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }