Esempio n. 1
0
 private string callRegister(xmds.xmds xmds, HardwareKey key)
 {
     return(xmds.RegisterDisplay(
                ApplicationSettings.Default.ServerKey,
                key.Key,
                ApplicationSettings.Default.DisplayName,
                "windows",
                ApplicationSettings.Default.ClientVersion,
                ApplicationSettings.Default.ClientCodeVersion,
                Environment.OSVersion.ToString(),
                key.MacAddress,
                key.Channel,
                key.getXmrPublicKey()));
 }
Esempio n. 2
0
        private void buttonSaveSettings_Click(object sender, EventArgs e)
        {
            tbStatus.ResetText();
            try
            {
                tbStatus.AppendText("Saving with CMS... Please wait...");

                // Simple settings
                ApplicationSettings.Default.ServerKey   = textBoxServerKey.Text;
                ApplicationSettings.Default.LibraryPath = textBoxLibraryPath.Text.TrimEnd('\\');
                ApplicationSettings.Default.ServerUri   = textBoxXmdsUri.Text;
                ApplicationSettings.Default.HardwareKey = tbHardwareKey.Text;

                // Also tweak the address of the xmds1
                xmds1.Url = ApplicationSettings.Default.XiboClient_xmds_xmds + "&method=registerDisplay";

                // Proxy Settings
                ApplicationSettings.Default.ProxyUser     = textBoxProxyUser.Text;
                ApplicationSettings.Default.ProxyPassword = maskedTextBoxProxyPass.Text;
                ApplicationSettings.Default.ProxyDomain   = textBoxProxyDomain.Text;

                // Change the default Proxy class
                OptionForm.SetGlobalProxy();

                // Client settings
                ApplicationSettings.Default.SplashOverride = splashOverride.Text;

                // Commit these changes back to the user settings
                ApplicationSettings.Default.Save();

                // Call register
                xmds1.RegisterDisplayAsync(
                    ApplicationSettings.Default.ServerKey,
                    ApplicationSettings.Default.HardwareKey,
                    ApplicationSettings.Default.DisplayName,
                    "windows",
                    ApplicationSettings.Default.ClientVersion,
                    ApplicationSettings.Default.ClientCodeVersion,
                    Environment.OSVersion.ToString(),
                    _hardwareKey.MacAddress,
                    _hardwareKey.Channel,
                    _hardwareKey.getXmrPublicKey());
            }
            catch (Exception ex)
            {
                tbStatus.AppendText(ex.Message);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Runs the agent
        /// </summary>
        public void Run()
        {
            Trace.WriteLine(new LogMessage("RegisterAgent - Run", "Thread Started"), LogType.Info.ToString());

            while (!_forceStop)
            {
                lock (_locker)
                {
                    try
                    {
                        // If we are restarting, reset
                        _manualReset.Reset();

                        HardwareKey key = new HardwareKey();

                        Trace.WriteLine(new LogMessage("RegisterAgent - Run", "Thread Woken and Lock Obtained"), LogType.Info.ToString());

                        using (xmds.xmds xmds = new xmds.xmds())
                        {
                            xmds.Credentials           = null;
                            xmds.Url                   = ApplicationSettings.Default.XiboClient_xmds_xmds + "&method=registerDisplay";
                            xmds.UseDefaultCredentials = false;

                            // Store the XMR address
                            string xmrAddress = ApplicationSettings.Default.XmrNetworkAddress;

                            RegisterAgent.ProcessRegisterXml(xmds.RegisterDisplay(
                                                                 ApplicationSettings.Default.ServerKey,
                                                                 key.Key,
                                                                 ApplicationSettings.Default.DisplayName,
                                                                 "windows",
                                                                 ApplicationSettings.Default.ClientVersion,
                                                                 ApplicationSettings.Default.ClientCodeVersion,
                                                                 Environment.OSVersion.ToString(),
                                                                 key.MacAddress,
                                                                 key.Channel,
                                                                 key.getXmrPublicKey()));

                            // Set the flag to indicate we have a connection to XMDS
                            ApplicationSettings.Default.XmdsLastConnection = DateTime.Now;

                            // Has the XMR address changed?
                            if (xmrAddress != ApplicationSettings.Default.XmrNetworkAddress)
                            {
                                OnXmrReconfigure();
                            }

                            // Is the timezone empty?
                            if (string.IsNullOrEmpty(ApplicationSettings.Default.DisplayTimeZone))
                            {
                                reportTimezone();
                            }
                        }
                    }
                    catch (WebException webEx)
                    {
                        // Increment the quantity of XMDS failures and bail out
                        ApplicationSettings.Default.IncrementXmdsErrorCount();

                        // Log this message, but dont abort the thread
                        Trace.WriteLine(new LogMessage("RegisterAgent - Run", "WebException in Run: " + webEx.Message), LogType.Info.ToString());
                    }
                    catch (Exception ex)
                    {
                        // Log this message, but dont abort the thread
                        Trace.WriteLine(new LogMessage("RegisterAgent - Run", "Exception in Run: " + ex.Message), LogType.Info.ToString());
                    }
                }

                // Sleep this thread until the next collection interval
                _manualReset.WaitOne((int)(ApplicationSettings.Default.CollectInterval * ApplicationSettings.Default.XmdsCollectionIntervalFactor() * 1000));
            }

            Trace.WriteLine(new LogMessage("RegisterAgent - Run", "Thread Stopped"), LogType.Info.ToString());
        }
Esempio n. 4
0
        /// <summary>
        /// Runs the agent
        /// </summary>
        public void Run()
        {
            Trace.WriteLine(new LogMessage("RegisterAgent - Run", "Thread Started"), LogType.Info.ToString());

            while (!_forceStop)
            {
                lock (_locker)
                {
                    try
                    {
                        // If we are restarting, reset
                        _manualReset.Reset();

                        HardwareKey key = new HardwareKey();

                        Trace.WriteLine(new LogMessage("RegisterAgent - Run", "Thread Woken and Lock Obtained"), LogType.Info.ToString());

                        using (xmds.xmds xmds = new xmds.xmds())
                        {
                            xmds.Credentials = null;
                            xmds.Url = ApplicationSettings.Default.R23SignageClient_xmds_xmds;
                            xmds.UseDefaultCredentials = false;

                            // Store the XMR address
                            string xmrAddress = ApplicationSettings.Default.XmrNetworkAddress;

                            RegisterAgent.ProcessRegisterXml(xmds.RegisterDisplay(
                                ApplicationSettings.Default.ServerKey, 
                                key.Key, 
                                ApplicationSettings.Default.DisplayName, 
                                "windows", 
                                ApplicationSettings.Default.ClientVersion, 
                                ApplicationSettings.Default.ClientCodeVersion, 
                                Environment.OSVersion.ToString(), 
                                key.MacAddress,
                                key.Channel,
                                key.getXmrPublicKey()));

                            // Set the flag to indicate we have a connection to XMDS
                            ApplicationSettings.Default.XmdsLastConnection = DateTime.Now;

                            // Has the XMR address changed?
                            if (xmrAddress != ApplicationSettings.Default.XmrNetworkAddress)
                            {
                                OnXmrReconfigure();
                            }
                        }
                    }
                    catch (WebException webEx)
                    {
                        // Increment the quantity of XMDS failures and bail out
                        ApplicationSettings.Default.IncrementXmdsErrorCount();

                        // Log this message, but dont abort the thread
                        Trace.WriteLine(new LogMessage("RegisterAgent - Run", "WebException in Run: " + webEx.Message), LogType.Error.ToString());
                    }
                    catch (Exception ex)
                    {
                        // Log this message, but dont abort the thread
                        Trace.WriteLine(new LogMessage("RegisterAgent - Run", "Exception in Run: " + ex.Message), LogType.Error.ToString());
                    }
                }

                // Sleep this thread until the next collection interval
                _manualReset.WaitOne((int)(ApplicationSettings.Default.CollectInterval * ApplicationSettings.Default.XmdsCollectionIntervalFactor() * 1000));
            }

            Trace.WriteLine(new LogMessage("RegisterAgent - Run", "Thread Stopped"), LogType.Info.ToString());
        }