private void statusBarUpdate(object sender, ListArgs e) { if (Convert.ToDecimal(e._list[0]) > Convert.ToDecimal(bubble.version)) { statusStrip.BackColor = Color.LemonChiffon; StatusStripLabel.ForeColor = Color.Black; StripStatusLabel.Text = "TeboCam - Version " + bubble.version + " - TeboWeb " + bubble.versionDt + " :::: Most recent version " + e._list[0].ToString() + " available as auto-install"; } else { statusStrip.BackColor = System.Drawing.SystemColors.Control; StatusStripLabel.ForeColor = Color.Black; StripStatusLabel.Text = "TeboCam - Version " + bubble.version + " - Copyright TeboWeb " + bubble.versionDt; } }
private void preferences_Load(object sender, EventArgs e) { installationClean(); CameraRig.camSelInit(); publishCams publishCams = new publishCams(9); bubble.devMachine = File.Exists(Application.StartupPath + bubble.devMachineFile); bubble.databaseConnect = File.Exists(Application.StartupPath + bubble.dbaseConnectFile); if (bubble.devMachine) { bttInstallUpdateAdmin.Visible = true; bttnUpdateFooter.Visible = true; } else { tabControl1.TabPages.Remove(Test); } if (!bubble.databaseConnect) tabControl1.TabPages.Remove(Online); ; //updaterUpdate(); update.updateMe(bubble.updaterPrefix, Application.StartupPath + @"\"); ThumbsPrepare(); bttInstallUpdateAdmin.Visible = false; bttnUpdateFooter.Visible = false; bubble.Loading = true; statusUpdate += new ListPubEventHandler(statusBarUpdate); bubble.LogAdded += new EventHandler(log_add); bubble.TimeChange += new EventHandler(time_change); publishSwitch += new EventHandler(publish_switch); bubble.redrawGraph += new EventHandler(drawGraph); bubble.pingGraph += new EventHandler(drawGraphPing); bubble.motionLevelChanged += new EventHandler(drawLevel); bubble.motionDetectionActivate += new EventHandler(motionDetectionActivate); bubble.motionDetectionInactivate += new EventHandler(motionDetectionInactivate); filesInit(); if (FileManager.readXmlFile("config", false)) { FileManager.backupFile("config"); } else { FileManager.readXmlFile("config", true); } if (FileManager.readXmlFile("log", false)) { FileManager.backupFile("log"); } else { FileManager.readXmlFile("log", true); } profileListRefresh(bubble.profileInUse); bubble.connectedToInternet = bubble.internetConnected(config.getProfile(bubble.profileInUse).internetCheck); notConnected.Visible = !bubble.connectedToInternet; //Apply command line values enumCommandLine commlineResults = commandLine(); pnlStartupOptions.Visible = commlineResults <= enumCommandLine.alert; if (commlineResults == enumCommandLine.close) { CloseAllTeboCamPocesses(); Close(); return; } if (FileManager.readXmlFile("graph", false)) { FileManager.backupFile("graph"); } else { FileManager.readXmlFile("graph", true); } //clear out thumb nail images FileManager.clearFiles(bubble.thumbFolder); levelDraw(0); bubble.moveStatsInitialise(); Graph.updateGraphHist(time.currentDate(), bubble.movStats); drawGraph(this, null); bubble.logAddLine("Starting TeboCam"); FileManager.clearLog(); if (config.getProfile(bubble.profileInUse).webcam != null) { cw.DoWork -= new DoWorkEventHandler(waitForCam); cw.DoWork += new DoWorkEventHandler(waitForCam); cw.WorkerSupportsCancellation = true; cw.RunWorkerAsync(); } bubble.keepWorking = true; bubble.workInit(true); string test = time.currentTime(); bubble.Loading = false; lblCurVer.Text += bubble.version; List<string> updateDat = new List<string>(); updateDat = check_for_updates(); string onlineVersion = Double.Parse(updateDat[1], new System.Globalization.CultureInfo("en-GB")).ToString(); if (decimal.Parse(onlineVersion) == 0) { lblVerAvail.Text = "Unable to determine the most up-to-date version."; } else { if (decimal.Parse(bubble.version) >= decimal.Parse(onlineVersion)) { lblVerAvail.Text = "You have the most up-to-date version."; } else { lblVerAvail.Text = "Most recent version available: " + onlineVersion; bttInstallUpdateAdmin.Visible = true; bttnUpdateFooter.Visible = true; } bubble.upd_url = updateDat[2]; bubble.upd_file = updateDat[3]; } //pass the version of the update available to statusUpdate ListArgs a = new ListArgs(); List<object> b = new List<object>(); b.Add(onlineVersion); a.list = b; statusUpdate(null, a); if (config.getProfile(bubble.profileInUse).logsKeepChk) clearOldLogs(); if (!config.getProfile(bubble.profileInUse).AlertOnStartup && config.getProfile(bubble.profileInUse).updatesNotify && bubble.connectedToInternet && Convert.ToDecimal(onlineVersion) > Convert.ToDecimal(bubble.version) && !config.getProfile(bubble.profileInUse).startTeboCamMinimized ) { string tmpStr = ""; //Name Spaces Required ////http://msdn.microsoft.com/en-us/library/aa984408(v=vs.71).aspx //System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("tebocam.preferences", this.GetType().Assembly); //tmpStr = resourceManager.GetString("updateAvailableMessage"); //You do not have the most recent version available. //The most recent version can installed automatically //by clicking on the update button at the bottom of the screen //or on the Admin tab. //To stop this message appearing in future uncheck the //'Notify when updates are available' box in the Admin tab. tmpStr = "You do not have the most recent version available" + Environment.NewLine + Environment.NewLine; tmpStr += "This version: " + bubble.version + Environment.NewLine; tmpStr += "Most recent version available: " + onlineVersion + Environment.NewLine + Environment.NewLine; tmpStr += "The most recent version can be installed automatically" + Environment.NewLine; tmpStr += "by clicking on the update button at the bottom of the screen or on the Admin tab" + Environment.NewLine + Environment.NewLine + Environment.NewLine; tmpStr += "To stop this message appearing in future - uncheck the" + Environment.NewLine; tmpStr += "'Notify when updates are available' box in the Admin tab."; MessageBox.Show(tmpStr, "Update Available"); } plSnd.Enabled = config.getProfile(bubble.profileInUse).soundAlert != ""; if (config.getProfile(bubble.profileInUse).freezeGuard) { decimal intervalRatio = 1m / 0.75m;//gives a result of 1.33333... string restartCommand = bttnMotionActive.Checked ? "restart active" : "restart inactive"; decimal checkInterval = config.getProfile(bubble.profileInUse).pulseFreq / intervalRatio; pulse = new Pulse(config.getProfile(bubble.profileInUse).pulseFreq,//1m, checkInterval,// 0.75m, bubble.tmpFolder, "pulse.xml", bubble.processToEnd, Application.StartupPath + @"\TeboCam.exe", bubble.pulseApp, bubble.logFolder, restartCommand, bubble.pulseRestart); } cw = null; worker.WorkerSupportsCancellation = true; worker.DoWork -= new DoWorkEventHandler(workerProcess); worker.DoWork += new DoWorkEventHandler(workerProcess); worker.RunWorkerAsync(); }