Beispiel #1
0
 private void Xmds2RequiredFilesCompleted(object sender, RequiredFilesCompletedEventArgs e)
 {
   
         if (e.Error != null)
         {
             Trace.WriteLine(new LogMessage("Schedule - RequiredFilesCompleted", e.Error.Message),
                             LogType.Error.ToString());
             if (e.Error.Message == "This display client is not licensed")
             {
                 Settings.Default.licensed = 0;
             }
             this._xmdsProcessing = false;
         }
         else
         {
             Settings.Default.XmdsLastConnection = DateTime.Now;
             if (Settings.Default.licensed == 0)
             {
                 Settings.Default.licensed = 1;
             }
             try
             {
                 FileCollector collector = new FileCollector(this._cacheManager, e.Result);
                 collector.LayoutFileChanged +=
                     this.FileCollectorLayoutFileChanged;
                 collector.CollectionComplete +=
                     this.FileCollectorCollectionComplete;
                 collector.MediaFileChanged +=
                     this.fileCollector_MediaFileChanged;
                 collector.CompareAndCollect();
             }
             catch (Exception exception)
             {
                 this._xmdsProcessing = false;
                 Trace.WriteLine(
                     new LogMessage("Schedule - RequiredFilesCompleted",
                                    "Error Comparing and Collecting: " + exception.Message),
                     LogType.Error.ToString());
             }
             this._cacheManager.WriteCacheManager();
         }
         CollectingFiles = false;
        
 }
Beispiel #2
0
    /// <summary>
    /// Event Handler for required files being complete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    void Xmds2RequiredFilesCompleted(object sender, RequiredFilesCompletedEventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("RequiredFilesAsync complete.", "Schedule - RequiredFilesCompleted");

        //Dont let this effect the rendering
        //Application.DoEvents();

        if (e.Error != null)
        {
            // There was an error - what do we do?
            System.Diagnostics.Trace.WriteLine(new LogMessage("Schedule - RequiredFilesCompleted", e.Error.Message), LogType.Error.ToString());

            // Is it a "not licensed" error
            if (e.Error.Message == "This display client is not licensed")
            {
                Settings.Default.licensed = 0;
            }

            _xmdsProcessing = false;
        }
        else
        {
            // Set the flag to indicate we have a connection to XMDS
            Settings.Default.XmdsLastConnection = DateTime.Now;

            // Firstly we know we are licensed if we get this far
            if (Settings.Default.licensed == 0)
            {
                Settings.Default.licensed = 1;
            }

            try
            {
                // Load the result into XML
                FileCollector fileCollector = new FileCollector(_cacheManager, e.Result);

                // Bind some events that the fileCollector will raise
                fileCollector.LayoutFileChanged += new FileCollector.LayoutFileChangedDelegate(FileCollectorLayoutFileChanged);
                fileCollector.CollectionComplete += new FileCollector.CollectionCompleteDelegate(FileCollectorCollectionComplete);
                fileCollector.MediaFileChanged += new FileCollector.MediaFileChangedDelegate(fileCollector_MediaFileChanged);

                fileCollector.CompareAndCollect();
            }
            catch (Exception ex)
            {
                _xmdsProcessing = false;

                // Log and move on
                System.Diagnostics.Trace.WriteLine(new LogMessage("Schedule - RequiredFilesCompleted", "Error Comparing and Collecting: " + ex.Message), LogType.Error.ToString());
            }

            _cacheManager.WriteCacheManager();
        }
    }