Added UpdateForceCheck parameter
authorPanagiotis Kanavos <pkanavos@gmail.com>
Wed, 7 Mar 2012 16:34:44 +0000 (18:34 +0200)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Wed, 7 Mar 2012 16:34:44 +0000 (18:34 +0200)
trunk/Pithos.Client.WPF/Configuration/PithosSettings.cs
trunk/Pithos.Client.WPF/Properties/Settings.Designer.cs
trunk/Pithos.Client.WPF/Properties/Settings.settings
trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs
trunk/Pithos.Client.WPF/app.config
trunk/Pithos.Core.Test/NetworkAgentTest.cs
trunk/Pithos.Core/Agents/FileAgent.cs
trunk/Pithos.Core/PithosMonitor.cs

index 2d6d677..22ecf36 100644 (file)
@@ -231,6 +231,11 @@ namespace Pithos.Client.WPF.Configuration
             get { return _settings.FileIdleTimeout; }
         }
 
+        public bool UpdateForceCheck
+        {
+            get { return _settings.UpdateForceCheck; }
+        }
+
         public void Save()
         {
             _settings.Save();
index 3986c5e..3037f90 100644 (file)
@@ -361,5 +361,14 @@ namespace Pithos.Client.WPF.Properties {
                 return ((global::System.TimeSpan)(this["FileIdleTimeout"]));
             }
         }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("True")]
+        public bool UpdateForceCheck {
+            get {
+                return ((bool)(this["UpdateForceCheck"]));
+            }
+        }
     }
 }
index 052e337..cb30908 100644 (file)
@@ -92,5 +92,8 @@
     <Setting Name="FileIdleTimeout" Type="System.TimeSpan" Scope="Application">
       <Value Profile="(Default)">00:00:10</Value>
     </Setting>
+    <Setting Name="UpdateForceCheck" Type="System.Boolean" Scope="Application">
+      <Value Profile="(Default)">True</Value>
+    </Setting>
   </Settings>
 </SettingsFile>
\ No newline at end of file
index fd4cf83..da70074 100644 (file)
@@ -187,7 +187,7 @@ namespace Pithos.Client.WPF {
             //Must delay opening the upgrade window
             //to avoid Windows Messages sent by the TaskbarIcon
             TaskEx.Delay(5000).ContinueWith(_=>
-                Execute.OnUIThread(()=> _sparkle.StartLoop(true,true,Settings.UpdateCheckInterval)));
+                Execute.OnUIThread(()=> _sparkle.StartLoop(true,Settings.UpdateForceCheck,Settings.UpdateCheckInterval)));
 
 
                        StartMonitoring();                    
index e5840e4..7317223 100644 (file)
    <setting name="FileIdleTimeout" serializeAs="String">
     <value>00:00:10</value>
    </setting>
+   <setting name="UpdateForceCheck" serializeAs="String">
+    <value>True</value>
+   </setting>
   </Pithos.Client.WPF.Properties.Settings>
        </applicationSettings>
        <log4net>
index 6c11e91..fb8838c 100644 (file)
@@ -70,12 +70,10 @@ namespace Pithos.Core.Test
         [Test]
         public void TestDownload()
         {
-            var fileAgent = new FileAgent(100) {CachePath = @"e:\pithos\.pithos.cache"};
-
             var agent = new NetworkAgent();
 
-            var account = "890329@vho.grnet.gr";
-            var apiKey = "24989dce4e0fcb072f8cb60c8922be19";
+            var account = "";
+            var apiKey = "";
             var client = new CloudFilesClient(account,apiKey)
             {
                 AuthenticationUrl = @"https://pithos.dev.grnet.gr",
index d6a5560..8b5c612 100644 (file)
@@ -76,10 +76,8 @@ namespace Pithos.Core.Agents
         
         private FileEventIdleBatch _eventIdleBatch;
 
-        public FileAgent(int idleTimeout)
-        {            
-            _eventIdleBatch=new FileEventIdleBatch(idleTimeout,ProcessBatchedEvents);
-        }
+        public TimeSpan IdleTimeout { get; set; }
+
 
         private void ProcessBatchedEvents(Dictionary<string, FileSystemEventArgs[]> fileEvents)
         {
@@ -127,10 +125,15 @@ namespace Pithos.Core.Agents
                 throw new ArgumentNullException("rootPath");
             if (!Path.IsPathRooted(rootPath))
                 throw new ArgumentException("rootPath must be an absolute path","rootPath");
+            if (IdleTimeout == null)
+                throw new InvalidOperationException("IdleTimeout must have a valid value");
             Contract.EndContractBlock();
 
             AccountInfo = accountInfo;
             RootPath = rootPath;
+
+            _eventIdleBatch = new FileEventIdleBatch((int)IdleTimeout.TotalMilliseconds, ProcessBatchedEvents);
+
             _watcher = new FileSystemWatcher(rootPath) {IncludeSubdirectories = true,InternalBufferSize=8*4096};
             _adapter = new FileSystemWatcherAdapter(_watcher);
 
index 76a15ea..a81428f 100644 (file)
@@ -164,8 +164,7 @@ namespace Pithos.Core
 
         public PithosMonitor()
         {
-            FileAgent = new FileAgent((int)Settings.FileIdleTimeout.TotalMilliseconds);
-
+            FileAgent = new FileAgent();
         }
         private bool _started;
 
@@ -409,7 +408,8 @@ namespace Pithos.Core
                 Log.DebugFormat("Start Folder Monitoring [{0}]",RootPath);
 
             AgentLocator<FileAgent>.Register(FileAgent,RootPath);
-
+            
+            FileAgent.IdleTimeout = Settings.FileIdleTimeout;
             FileAgent.StatusKeeper = StatusKeeper;
             FileAgent.StatusNotification = StatusNotification;
             FileAgent.Workflow = Workflow;