Example #1
0
        private static void UpdateDownloadCount()
        {
            NetgearClientServiceSoapClient ngToolTrackingService = null;
            //ErrorTracker errorTrace = new ErrorTracker();
            try
            {
                ngToolTrackingService = new NetgearClientServiceSoapClient();
                ErrorTracker.WriteLog("UpdateDownloadCount() method is invoked.....");

                String uniqueID = string.Empty;

                uniqueID = ClickOnceHelper.GetUserUniqueID();

                ErrorTracker.WriteLog("UpdateDownloadCount() :: uniqueID : " + uniqueID);

                if (string.IsNullOrEmpty(uniqueID))
                {
                    ErrorTracker.WriteLog("UpdateDownloadCount() :: uniqueID not exists.");
                    uniqueID = ngToolTrackingService.GetNetgearToolUniqueID();
                    ErrorTracker.WriteLog("UpdateDownloadCount() :: uniqueID generated : " + uniqueID);

                    UpdateUserUniqueID(uniqueID);
                }
                ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;

                //UpdateCheckInfo info = null;
                //info = deployment.CheckForDetailedUpdate();
                //MessageBox.Show(info.UpdateAvailable.ToString());
                //if (info.UpdateAvailable)
                //{
                //    MessageBox.Show("Application Resatrted");
                //    MessageBox.Show("Application Resatrted");
                //    deployment.Update();
                //}
                //versioninfo = deployment.CurrentVersion.ToString();

                //MessageBox.Show(versioninfo);
                strVersion = deployment.CurrentVersion.ToString();
                Settings.Default.VersionInfo = deployment.CurrentVersion.ToString();
                Settings.Default.Save();

                //ngToolTrackingService.NetgearToolInstallationDetails("fa251d54-ab22-488a-ab2c-966a37458178", "*****@*****.**", "2.0.0.2", DateTime.Now);

                if (deployment.IsFirstRun)
                {
                    ErrorTracker.WriteLog("UpdateDownloadCount() :: Application is Running First Time : CurrentVersion :" + deployment.CurrentVersion.ToString());
                    ngToolTrackingService.NetgearToolInstallationDetails(uniqueID, String.Empty, deployment.CurrentVersion.ToString(), DateTime.Now);
                }
                else
                {
                    ErrorTracker.WriteLog("UpdateDownloadCount() :: Application having updates : CurrentVersion :" + deployment.CurrentVersion.ToString() + " UpdatedVersion : " + deployment.UpdatedVersion.ToString());
                    ngToolTrackingService.NetgearToolCurrentVersionDetails(uniqueID, String.Empty, deployment.CurrentVersion.ToString(), deployment.UpdatedVersion.ToString(), DateTime.Now);
                }

                //if (CheckForUpdateAvailable())
                //{
                //    MessageBox.Show("Update Available");
                //    String gearheadFolder = string.Empty;
                //    gearheadFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                //    gearheadFolder = Path.Combine(gearheadFolder, ConfigSettings.ClientName);

                //    if (Directory.Exists(gearheadFolder))
                //    {
                //        Directory.Delete(gearheadFolder, true);
                //        Directory.CreateDirectory(gearheadFolder);
                //    }
                //    else
                //    {
                //        Directory.CreateDirectory(gearheadFolder);
                //    }
                //}

                
                ////ErrorTracker.WriteLog("UpdateDownloadCount() method is invocation was completed.....");
                //if (deployment.UpdatedVersion > deployment.CurrentVersion)
                //{
                //    //MessageBox.Show("Entered");
                //    String gearheadFolder = string.Empty;
                //    gearheadFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                //    gearheadFolder = Path.Combine(gearheadFolder, ConfigSettings.ClientName);

                //    if (Directory.Exists(gearheadFolder))
                //    {
                //        Directory.Delete(gearheadFolder, true);
                //        Directory.CreateDirectory(gearheadFolder);
                //    }
                //    else
                //    {
                //        Directory.CreateDirectory(gearheadFolder);
                //    }
                //}

                ngToolTrackingService = null;
            }
            catch (Exception ex)
            {
                ErrorTracker.WriteErrorLog("Activei :Program.cs", "UpdateDownloadCount()", "", ex.Message, ex.StackTrace, "Error");
            }
            finally
            {
                ngToolTrackingService = null;
                //errorTrace = null;
            }

        }