Ejemplo n.º 1
0
 public override bool Load(string versionReuired)
 {
     try
     {
         byte[] buffer;
         TrainGraphCacheStorage storage = new TrainGraphCacheStorage();
         if (storage.Load(out buffer, out this.LastError))
         {
             TrainGraphCache cache = DCSerializer.DeserializeWithDCSMS(typeof(TrainGraphCache), buffer) as TrainGraphCache;
             base.CacheTime = cache.CacheTime;
             base.Curves = cache.Curves;
             base.Markers = cache.Markers;
             this.LastTrainGraphTime = cache.LastTrainGraphTime;
             this.OperationDate = cache.OperationDate;
             this.ServerTime = cache.ServerTime;
             base.TimeStart = cache.TimeStart;
             base.TimeStop = cache.TimeStop;
             base.Version = cache.Version;
             if (!cache.IsValid(versionReuired, out this.LastError))
             {
                 return false;
             }
             return true;
         }
     }
     catch (Exception exception)
     {
         base.LastError = exception.Message;
     }
     return false;
 }
Ejemplo n.º 2
0
 public override bool Load(string versionReuired)
 {
     try
     {
         byte[] buffer;
         TrainGraphCacheStorage storage = new TrainGraphCacheStorage();
         if (storage.Load(out buffer, out this.LastError))
         {
             TrainGraphCache cache = DCSerializer.DeserializeWithDCSMS(typeof(TrainGraphCache), buffer) as TrainGraphCache;
             base.CacheTime          = cache.CacheTime;
             base.Curves             = cache.Curves;
             base.Markers            = cache.Markers;
             this.LastTrainGraphTime = cache.LastTrainGraphTime;
             this.OperationDate      = cache.OperationDate;
             this.ServerTime         = cache.ServerTime;
             base.TimeStart          = cache.TimeStart;
             base.TimeStop           = cache.TimeStop;
             base.Version            = cache.Version;
             if (!cache.IsValid(versionReuired, out this.LastError))
             {
                 return(false);
             }
             return(true);
         }
     }
     catch (Exception exception)
     {
         base.LastError = exception.Message;
     }
     return(false);
 }
Ejemplo n.º 3
0
 private void buttonClearCache_Click(object sender, RoutedEventArgs e)
 {
     bool flag = true;
     string str = "";
     TrainsCacheStorage storage = new TrainsCacheStorage();
     if (!storage.Clear())
     {
         flag = false;
         str = str + string.Format("\n\r {0}", storage.LastError);
     }
     TrainGraphCacheStorage storage2 = new TrainGraphCacheStorage();
     if (!storage2.Clear())
     {
         flag = false;
         str = str + string.Format("\n\r {0}", storage2.LastError);
     }
     LayoutCacheStorage storage3 = new LayoutCacheStorage();
     if (!storage3.Clear())
     {
         flag = false;
         str = str + string.Format("\n\r {0}", storage3.LastError);
     }
     if (flag)
     {
         MessageBox.Show("Cache removed successfully");
     }
     else
     {
         MessageBox.Show("Cache removing failed..." + str);
     }
 }
Ejemplo n.º 4
0
        private void buttonClearCache_Click(object sender, RoutedEventArgs e)
        {
            bool               flag    = true;
            string             str     = "";
            TrainsCacheStorage storage = new TrainsCacheStorage();

            if (!storage.Clear())
            {
                flag = false;
                str  = str + string.Format("\n\r {0}", storage.LastError);
            }
            TrainGraphCacheStorage storage2 = new TrainGraphCacheStorage();

            if (!storage2.Clear())
            {
                flag = false;
                str  = str + string.Format("\n\r {0}", storage2.LastError);
            }
            LayoutCacheStorage storage3 = new LayoutCacheStorage();

            if (!storage3.Clear())
            {
                flag = false;
                str  = str + string.Format("\n\r {0}", storage3.LastError);
            }
            if (flag)
            {
                MessageBox.Show("Cache removed successfully");
            }
            else
            {
                MessageBox.Show("Cache removing failed..." + str);
            }
        }
Ejemplo n.º 5
0
        public override bool Save()
        {
            TrainGraphCacheStorage storage = new TrainGraphCacheStorage();

            byte[] data = DCSerializer.SerializeWithDCSMS(this);
            storage.Clear();
            return(storage.Save(data, out this.LastError));
        }
Ejemplo n.º 6
0
 public override bool Save()
 {
     TrainGraphCacheStorage storage = new TrainGraphCacheStorage();
     byte[] data = DCSerializer.SerializeWithDCSMS(this);
     storage.Clear();
     return storage.Save(data, out this.LastError);
 }