Ejemplo n.º 1
0
 protected virtual void OnFileUpdated(FileUpdatedEventArgs e)
 {
     if (FileUpdated != null)
     {
         FileUpdated(this, e);
     }
 }
Ejemplo n.º 2
0
 private void FileWatch_Updated(object sender, FileUpdatedEventArgs e)
 {
     this.UpdateFile(e.FullPath);
 }
Ejemplo n.º 3
0
 void Worker_FileUpdated(object sender, FileUpdatedEventArgs e)
 {
     Binding.FireChange(x => x.File);
     UpdateState();
     UpdateSize();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Custom code executed when the file has been updated. Waits 100ms to ensure the file has had chance to close.
        /// Enqueues any newly read values.
        /// </summary>
        /// <param name="source">System.</param>
        /// <param name="e">Updated File arguments.</param>
        private void OnFileUpdateEvent(object source, FileUpdatedEventArgs e)
        {
            Thread.Sleep(100);
            string fileText = ReadFile();
            if (fileText != "")
            {
                _lastIncomingMessage = DateTime.Now;
                string info = "Incoming data received from {0}: '{1}'";
                info = string.Format(info, _fileName, fileText);
                DebugOutput.Print(info);

                EnqueueData(new Value()
                {
                    Type = ValueType.String,
                    EventTime = DateTime.Now,
                    StringValue = fileText,
                    Inbound = true
                });

                //InboundDataQueue.Enqueue(new Value()
                //{
                //    ValueType = ValueType.String,
                //    CommType = CommunicatorType.FlatFile,
                //    EventTime = DateTime.Now,
                //    StringValue = fileText,
                //    Inbound = true
                //});
            }
        }