private IDbConnection GetDbConnection(string connectionString)
        {
            LOG.Debug("GetDbConnection: Returning database connection: {0}", connectionString);
            SqlConnection sqlConnection = new SqlConnection(connectionString);

            return(sqlConnection);
        }
Example #2
0
 /// <summary>
 /// 根据被试阀流量选择需要使用的调节阀
 /// </summary>
 /// <param name="flow">被试阀额定流量</param>
 public void decideOnAdjPropValve(float flow)
 {
     LOG.Debug("decideOnAdjPropValve开始");
     //Group["是否启用阀13"] = false;
     //Group["是否启用阀14_2"] = false;
     //Group["是否启用阀14_1"] = false;
     //if (flow * 1.2f <= 125f)
     //{
     //    Group["是否启用阀13"] = true;
     //}
     //else if (flow * 1.2f > 125f && flow * 1.2f <= 200f)
     //{
     //    Group["是否启用阀14_1"] = true;//14_1和14_2任选一个
     //}
     //else if (flow * 1.2f > 200f && flow * 1.2f <= 325f)
     //{
     //    Group["是否启用阀13"] = true;
     //    Group["是否启用阀14_1"] = true;//14_1和14_2任选一个
     //}
     //else if (flow * 1.2f > 325f && flow * 1.2f <= 400f)
     //{
     //    Group["是否启用阀14_2"] = true;
     //    Group["是否启用阀14_1"] = true;
     //}
     //else if (flow * 1.2f > 400f)
     //{
     //    Group["是否启用阀13"] = true;
     //    Group["是否启用阀14_2"] = true;
     //    Group["是否启用阀14_1"] = true;
     //}
     LOG.Debug("decideOnAdjPropValve结束");
 }
Example #3
0
 public void Start(_t8435InBlock inBlock, Action action)
 {
     LOG.Debug("t8435 start");
     _action  = action;
     _inBlock = inBlock;
     InBlock();
 }
Example #4
0
        /// <summary>
        /// Helper method to create a temp image file
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public static string SaveToTmpFile(ISurface surface, SurfaceOutputSettings outputSettings, string destinationPath)
        {
            string tmpFile = Path.GetRandomFileName() + "." + outputSettings.Format.ToString();

            // Prevent problems with "other characters", which could cause problems
            tmpFile = Regex.Replace(tmpFile, @"[^\d\w\.]", "");
            if (destinationPath == null)
            {
                destinationPath = Path.GetTempPath();
            }
            string tmpPath = Path.Combine(destinationPath, tmpFile);

            LOG.Debug("Creating TMP File : " + tmpPath);

            try
            {
                Save(surface, tmpPath, true, outputSettings, false);
                tmpFileCache.Add(tmpPath, tmpPath);
            }
            catch (Exception)
            {
                return(null);
            }
            return(tmpPath);
        }
Example #5
0
 public void SetProgress(float progress)
 {
     Bar.value = (float)Progress.Instance.progress / 100;
     LOG.Debug("progress :" + Bar.value);
     ProgressLabel.text = Progress.Instance.progress + "%";
     Tips.text          = Progress.Instance.Tips;
 }
Example #6
0
 protected void DownloadAllTempFiles(string url, string downloadDirectoryPath,
                                     NetworkUtils.DownloadProgressHandler progressCallback,
                                     object callbackParam)
 {
     try
     {
         LOG.Debug("DownloadAllTempFiles: Attempting to download files from url: {0}", url);
         string tempZipFile = MakeTempFilePath();
         NetworkUtils.DownloadFile(url, tempZipFile);
         try
         {
             _zipHelper.UncompressDirectory(tempZipFile, downloadDirectoryPath, _downloadedContentPassword);
         }
         finally
         {
             FileUtils.SafeDeleteFile(tempZipFile);
         }
         LOG.Debug("DownloadAllTempFiles: Downloaded files from url: {0}", url);
     }
     catch (Exception e)
     {
         LOG.Error("DownloadAllTempFiles: Failed to download data from url: {0}", e, url);
         throw;
     }
 }
Example #7
0
 public void Start(Action action)
 {
     LOG.Debug("t8436 start");
     _action        = action;
     _inBlock.gubun = "0";
     InBlock();
 }
 public void Start()
 {
     lock (_lockObject) {
         if (_thread == null)
         {
             try {
                 Interlocked.Exchange(ref _stopRequested, 0);
                 if (_startProcessingImmediately)
                 {
                     _processingIntervalEvent.Set();
                 }
                 else
                 {
                     _processingIntervalEvent.Reset();
                 }
                 _thread = new Thread(ThreadProc);
                 _thread.Start();
                 LOG.Debug("Start() succeeded.");
             }
             catch (Exception e) {
                 LOG.Error("Start() failed.", e);
                 _thread = null;
                 throw;
             }
         }
     }
 }
Example #9
0
        /// <summary>
        /// Crops the capture to the specified rectangle (with Bitmap coordinates!)
        /// </summary>
        /// <param name="cropRectangle">Rectangle with bitmap coordinates</param>
        public bool Crop(Rectangle cropRectangle)
        {
            LOG.Debug("Cropping to: " + cropRectangle.ToString());
            if (ImageHelper.Crop(ref image, ref cropRectangle))
            {
                location = cropRectangle.Location;
                // Change mouse location according to the cropRegtangle (including screenbounds) offset
                MoveMouseLocation(-cropRectangle.Location.X, -cropRectangle.Location.Y);
                // Move all the elements
                // TODO: Enable when the elements are usable again.
                // MoveElements(-cropRectangle.Location.X, -cropRectangle.Location.Y);

                // Remove invisible elements
                List <ICaptureElement> newElements = new List <ICaptureElement>();
                foreach (ICaptureElement captureElement in elements)
                {
                    if (captureElement.Bounds.IntersectsWith(cropRectangle))
                    {
                        newElements.Add(captureElement);
                    }
                }
                elements = newElements;

                return(true);
            }
            return(false);
        }
Example #10
0
        /// <summary>
        /// Create a tmpfile which has the name like in the configured pattern.
        /// Used e.g. by the email export
        /// </summary>
        /// <param name="surface"></param>
        /// <param name="captureDetails"></param>
        /// <param name="outputSettings"></param>
        /// <returns>Path to image file</returns>
        public static string SaveNamedTmpFile(ISurface surface, ICaptureDetails captureDetails, SurfaceOutputSettings outputSettings)
        {
            string pattern = conf.OutputFileFilenamePattern;

            if (pattern == null || string.IsNullOrEmpty(pattern.Trim()))
            {
                pattern = "greenshot ${capturetime}";
            }
            string filename = FilenameHelper.GetFilenameFromPattern(pattern, outputSettings.Format, captureDetails);

            // Prevent problems with "other characters", which causes a problem in e.g. Outlook 2007 or break our HTML
            filename = Regex.Replace(filename, @"[^\d\w\.]", "_");
            // Remove multiple "_"
            filename = Regex.Replace(filename, @"_+", "_");
            string tmpFile = Path.Combine(Path.GetTempPath(), filename);

            LOG.Debug("Creating TMP File: " + tmpFile);

            // Catching any exception to prevent that the user can't write in the directory.
            // This is done for e.g. bugs #2974608, #2963943, #2816163, #2795317, #2789218
            try
            {
                Save(surface, tmpFile, true, outputSettings, false);
                tmpFileCache.Add(tmpFile, tmpFile);
            }
            catch (Exception e)
            {
                // Show the problem
                MessageBox.Show(e.Message, "Error");
                // when save failed we present a SaveWithDialog
                tmpFile = SaveWithDialog(surface, captureDetails);
            }
            return(tmpFile);
        }
        public void GenerateReport()
        {
            LOG.Info("正在写入基础信息...");
            Dictionary <string, string> Pict = new Dictionary <string, string>();
            WordHelper helper = SetReportBasicInfo(true);

            //选择试验生成图片
            //MessageBox.Show("HI");
            if (File.Exists(图片路径))
            {
                if (MainForm.test == 6)
                {
                    //string key = "位移时间曲线";

                    Pict.Add("$动态油缸位移时间曲线$", 图片路径);
                    helper.Insertpicture(Pict);
                    LOG.Debug("正在写入图片");
                    helper.SaveDocument(保存路径);
                }
                else if (MainForm.test == 8)
                {
                    // string key = "负载效率曲线";
                    Pict.Add("$动态油缸负载效率试验曲线$", 图片路径);
                    helper.Insertpicture(Pict);
                    LOG.Debug("正在写入图片");
                    helper.SaveDocument(保存路径);
                }
            }
            else
            {
                LOG.Error("因为本次实验没有保存图片,无法生成试验报告");
            }
            MessageBox.Show("本次试验报告文档保存在项目MainProj的report中,请查收");
        }
        protected override void RunTest(TestType testType)
        {
            LOG.Debug("RunTest");
            if (!TestTypeName.Contains(testType))
            {
                TestTypeName.Add(testType);
            }
            switch (testType)
            {
            case TestType.耐压试验:
                this.EndurationTest();
                break;

            case TestType.稳态压差流量特性试验:
                this.SteadystatePreeesure();
                LOG.Debug("RunTest");
                break;

            case TestType.液控单向阀最小控制压力:
                this.MinControlPreTest();
                break;

            case TestType.液控单向阀泄漏量试验:
                this.HyConLeakageTest();
                break;

            default:
                throw new TestTypeNotSupportedException();
            }
        }
 // do nothing. this make forbid subclass to override.
 protected void OnDestroy()
 {
     LOG.Debug("***** {0} OnDestroy", this.GetType().Name);
     if (disposables.Count > 0)
     {
         disposables.Dispose();
     }
 }
Example #14
0
        private void LogTabs_TabRemoved(object?sender, TabRemovedEventArgs e)
        {
            LOG.Debug($"{nameof( LogTabs_TabRemoved )} - Tab: {e.Tab}");

            this.RemoveLogProcess(e.Tab.Controller().Process, false);

            CheckIfLastTab();
        }
        public void Start(Action action)
        {
            LOG.Debug("t4203 start");
            _action = action;
            codes   = Constants.CodeSectors.Select(code0 => code0.Value.Code).ToList();
            var code = codes.ElementAt(_codeIdx);

            InBlock(code);
        }
Example #16
0
        static void Main()
        {
            //The First call to any LOG function will create a default Logger printing to Standard Out.

            //This Message will only be printed if the application is build in debug mode.
            LOG.Debug("DebugMessage");
            // This Message will always be printed.
            LOG.Error("Stuff gone wrong");
        }
Example #17
0
        protected override void InBlock(string shcode, bool isNext = false)
        {
            var szTrCode = _resModel.Name;

            LOG.Debug($"trCountLimit : {_query.GetTRCountLimit(szTrCode)}, trCountRequest : {_query.GetTRCountRequest(szTrCode)}, trCountBaseSec : {_query.GetTRCountBaseSec(szTrCode)}, trCountPerSec : {_query.GetTRCountPerSec(szTrCode)}");
            if (_query.GetTRCountLimit(szTrCode) != 0)
            {
                while (_query.GetTRCountLimit(szTrCode) <= _query.GetTRCountRequest(szTrCode))
                {
                    LOG.Debug($"sleep {szTrCode} {_query.GetTRCountLimit(szTrCode)}, {_query.GetTRCountRequest(szTrCode)}");
                    Thread.Sleep(10000);
                }
            }
            if (isNext == false)
            {
                fi = new FileInfo(Settings.Default.data_path + "\\xing\\" + szTrCode + "-" + shcode + ".csv");
                if (fi.Directory != null && !fi.Directory.Exists)
                {
                    System.IO.Directory.CreateDirectory(fi.DirectoryName);
                }
                fi.Delete();
                var today = DateTime.Now;
                _inBlock = new _t4201InBlock()
                {
                    shcode = shcode,
                    gubun  = "0",
                    ncnt   = 1,
                    qrycnt = 500,
                    tdgb   = "0",
                    sdate  = today.AddDays(-5).ToString("yyyyMMdd"),
                    edate  = today.ToString("yyyyMMdd"),
                };
            }

            var block = _resModel.Blocks[szTrCode + "InBlock"];

            _query.SetFieldData(block.Name, "shcode", 0, _inBlock.shcode);
            _query.SetFieldData(block.Name, "gubun", 0, _inBlock.gubun);
            _query.SetFieldData(block.Name, "ncnt", 0, _inBlock.ncnt.ToString());
            _query.SetFieldData(block.Name, "qrycnt", 0, _inBlock.qrycnt.ToString());
            _query.SetFieldData(block.Name, "tdgb", 0, _inBlock.tdgb);
            _query.SetFieldData(block.Name, "sdate", 0, _inBlock.sdate);
            _query.SetFieldData(block.Name, "edate", 0, _inBlock.edate);
            _query.SetFieldData(block.Name, "cts_date", 0, _inBlock.cts_date);
            _query.SetFieldData(block.Name, "cts_time", 0, _inBlock.cts_time);
            _query.SetFieldData(block.Name, "cts_daygb", 0, _inBlock.cts_daygb);
            _query.Request(isNext);
            LOG.Info("s==============InBlock=================");
            LOG.Info("===========  GetTrCode");
            LOG.Info(_query.GetTrCode());
            LOG.Info("===========  GetTrDesc");
            LOG.Info(_query.GetTrDesc());
            LOG.Info("===========  InBlock Data");
            LOG.Info(PrintUtil.PrintProperties(_inBlock));
            LOG.Info("e==============InBlock=================");
        }
Example #18
0
 public void Print(params object[] val)
 {
     if (val != null)
     {
         foreach (object obj in val)
         {
             LOG.Debug(obj);
         }
     }
 }
Example #19
0
 public MaCrossStrategy(Int64 ix) : base(ix)
 {
     LOG.Debug("MaCrossStrategy() called");
     srStopLoss         = new SRStopLoss(this);
     fixedPipTakeProfit = new FixedPipTakeProfit(this, 10);
     percentRiskProfile = new PercentRiskProfile(this, 0, 0.02, 5);
     breakEvenStopLoss  = new BreakEvenStopLoss(this, 5, 1);
     timeOfDayFilter    = new TimeOfDayFilter(this, new LocalTime(9, 0), new LocalTime(23, 0));
     maCross            = new MACross(this);
 }
        protected override Version DoFullRefresh(UpdateApplicationManifest appManifest,
                                                 out bool applicationCloseRequired)
        {
            string programParentPath = Path.GetDirectoryName(_programExeFilePath);

            if (!FileUtils.IsWritableDirectory(programParentPath))
            {
                LOG.Debug("DoFullRefresh: Cannot write to folder: {0}", programParentPath);
                throw new UnauthorizedAccessException(string.Format("Cannot write to directory \"{0}\"",
                                                                    programParentPath));
            }

            LOG.Debug("DoFullRefresh: Attempting to download updater file");
            string tempUpdaterFilePath = MakeTempFilePath();

            string statusString = string.Format("Downloading updater content for version {0}.{1}.{2} ...",
                                                appManifest.CurrentApplicationVersion.Major.ToString(),
                                                appManifest.CurrentApplicationVersion.Minor.ToString(),
                                                appManifest.CurrentApplicationVersion.Build.ToString());

            DoStatusCallback(0, statusString);

            DownloadFile(appManifest.ApplicationDownloadUrl, tempUpdaterFilePath,
                         delegate(int percentComplete, object callbackParam)
            {
                DoStatusCallback(percentComplete, callbackParam.ToString());
                return(!_cancelUpdate);
            },
                         statusString);

            try
            {
                CheckToCancel();

                DoStatusCallback(-1, "Launching updater application ...");

                tempUpdaterFilePath = FileUtils.ChangeFileExtension(tempUpdaterFilePath, ".exe");

                CheckToCancel();

                ProcessStartInfo info = new ProcessStartInfo(tempUpdaterFilePath);
                info.UseShellExecute = true;
                using (Process process = Process.Start(info))
                {
                }
                applicationCloseRequired = true;
            }
            catch (Exception)
            {
                FileUtils.SafeDeleteFile(tempUpdaterFilePath);
                throw;
            }
            return(appManifest.CurrentApplicationVersion);
        }
Example #21
0
 public void Load(string filename)
 {
     if (File.Exists(filename))
     {
         using (Cursor fileCursor = new Cursor(filename))
         {
             Cursor = fileCursor;
             LOG.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width);
         }
     }
 }
Example #22
0
 public void Load(string filename)
 {
     if (File.Exists(filename))
     {
         using (Icon fileIcon = new Icon(filename))
         {
             Icon = fileIcon;
             LOG.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width);
         }
     }
 }
Example #23
0
        private void ThreadWorkProc()
        {
            Exception    resultException          = null;
            UpdateAction updateAction             = UpdateAction.Undefined;
            Version      currentVersion           = null;
            bool         applicationCloseRequired = false;

            // Do the work
            try
            {
                CheckToCancel();

                UpdateApplicationManifest appManifest = GetApplicationManifest();

                CheckToCancel();

                DoStatusCallback(-1, "Determining update actions ...");
                Version existingVersion;
                updateAction   = GetUpdateAction(appManifest, out existingVersion);
                currentVersion = existingVersion;

                if (updateAction == UpdateAction.None)
                {
                    LOG.Debug("ThreadWorkProc: Exiting thread, updateAction == UpdateAction.None");
                }
                else
                {
                    CheckToCancel();
                    LOG.Debug("ThreadWorkProc: Performing {0} from version {1} to version {2}",
                              updateAction.ToString(), (existingVersion == null) ? "Unknown" :
                              existingVersion.ToString(),
                              (appManifest.CurrentDatabaseVersion == null) ? "Not specified" :
                              appManifest.CurrentDatabaseVersion.ToString());

                    if (EnumUtils.IsFlagSet(updateAction, UpdateAction.FullRefresh))
                    {
                        currentVersion = DoFullRefresh(appManifest, out applicationCloseRequired);
                    }
                    if (!applicationCloseRequired && EnumUtils.IsFlagSet(updateAction, UpdateAction.VersionUpdate))
                    {
                        currentVersion = DoVersionUpdate(appManifest, currentVersion, out applicationCloseRequired);
                    }
                }
            }
            catch (Exception e)
            {
                resultException = e;
                LOG.Error("ThreadWorkProc: Failed to run thread", e);
            }

            _isRunning = false;

            DoCompleteCallback(updateAction, currentVersion, applicationCloseRequired, resultException);
        }
Example #24
0
        protected UpdateApplicationManifest GetApplicationManifest()
        {
            LOG.Debug("GetApplicationManifest: Attempting to download application manifest");
            string statusString = "Retrieving update manifest file from server, please wait ...";

            DoStatusCallback(-1, statusString);
            byte[] manifestData = DownloadData(_manifestDownloadUrl,
                                               delegate(int percentComplete, object callbackParam)
            {
                DoStatusCallback(percentComplete, callbackParam.ToString());
                return(!_cancelUpdate);
            }, statusString
                                               );

            LOG.Debug("GetApplicationManifest: Attempting to deserialize application manifest");
            UpdateApplicationManifest appManifest = _serializationUtils.Deserialize <UpdateApplicationManifest>(manifestData);

            appManifest.CurrentDatabaseVersion    = VersionFromString(appManifest.CurrentDatabaseVersionStr);
            appManifest.LastFullUpdateVersion     = VersionFromString(appManifest.LastFullUpdateVersionStr);
            appManifest.CurrentApplicationVersion = VersionFromString(appManifest.CurrentApplicationVersionStr);
            if ((appManifest.CurrentDatabaseVersion != null) || (appManifest.LastFullUpdateVersion != null))
            {
                if ((appManifest.CurrentDatabaseVersion == null) || (appManifest.LastFullUpdateVersion == null))
                {
                    throw new InvalidDataException("Manifest file contains a unspecified database versions");
                }
                if (appManifest.CurrentDatabaseVersion < appManifest.LastFullUpdateVersion)
                {
                    throw new InvalidDataException(string.Format("Manifest file contains a current database version that is less than the last full update version: CurrentDatabaseVersion({0}) and LastFullUpdateVersion({1})",
                                                                 appManifest.CurrentDatabaseVersion.ToString(), appManifest.LastFullUpdateVersion.ToString()));
                }
                if (string.IsNullOrEmpty(appManifest.DatabaseFileDownloadUrl))
                {
                    throw new InvalidDataException("Manifest file does not contain DatabaseFileDownloadUrl");
                }
                if (string.IsNullOrEmpty(appManifest.DatabaseScriptsDownloadUrl))
                {
                    throw new InvalidDataException("Manifest file does not contain DatabaseScriptsDownloadUrl");
                }
            }
            if (appManifest.CurrentApplicationVersion != null)
            {
                if (string.IsNullOrEmpty(appManifest.ApplicationDownloadUrl))
                {
                    throw new InvalidDataException("Manifest file does not contain ApplicationDownloadUrl");
                }
            }
            LOG.Debug("GetApplicationManifest: Got application manifest: CurrentDatabaseVersion({0}) and LastFullUpdateVersion({1}) and CurrentApplicationVersion({2})",
                      (appManifest.CurrentDatabaseVersion == null) ? "Unspecified" : appManifest.CurrentDatabaseVersion.ToString(),
                      (appManifest.LastFullUpdateVersion == null) ? "Unspecified" : appManifest.LastFullUpdateVersion.ToString(),
                      (appManifest.CurrentApplicationVersion == null) ? "Unspecified" : appManifest.CurrentApplicationVersion.ToString());

            return(appManifest);
        }
Example #25
0
 public static string LoadTextAsset(string path)
 {
     try {
         UnityEngine.TextAsset asset = Resources.Load(path) as UnityEngine.TextAsset;
         string text = asset.text;
         Resources.UnloadAsset(asset);
         return(text);
     } catch (Exception e) {
         LOG.Debug("**** {0} ", e.ToString());
         return("");
     }
 }
        public void Start(Action action)
        {
            LOG.Debug("t8414 start");
            _action = action;
            var fucodes = Constants.CodeFutures.Select(code0 => code0.Value.Code).ToList();
            var opcodes = Constants.CodeOptions.Select(code0 => code0.Value.Code).ToList();

            codes = fucodes.Concat(opcodes).ToList();
            var code = codes.ElementAt(_codeIdx);

            InBlock(code);
        }
Example #27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="filename"></param>
 public void Load(string filename)
 {
     if (File.Exists(filename))
     {
         // Always make sure ImageHelper.LoadBitmap results are disposed some time,
         // as we close the bitmap internally, we need to do it afterwards
         using (Image tmpImage = ImageHelper.LoadImage(filename))
         {
             Image = tmpImage;
         }
         LOG.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width);
     }
 }
Example #28
0
        public void Debug()
        {
            using (ILOGInstance instance = new AsyncLOGInstance(true, SyncType.EventWaitHandle, true, new[] { new TestOutputter() }, new[] { new KeyValuePair <string, string>("SessionID", "TestSession") }))
            {
                _testingAdditionalfields.Add("SessionID", "TestSession");

                _testingMessage  = "test DEBUG message";
                _testingTag      = "DEBUG";
                _testingSeverity = LogSeverity.Debug;
                instance.Debug(_testingMessage, _testingTag);
                LOG.Debug(_testingMessage, _testingTag);
            }
        }
        private async void TabbedAnythingForm_VisibleChanged(object sender, EventArgs e)
        {
            LOG.DebugFormat("Visible Changed - Visible: {0}", this.Visible);
            if (this.Visible)
            {
                DateTime lastUpdatePromptTime = Settings.Default.LastUpdatePromptTime;
                DateTime now        = DateTime.Now;
                TimeSpan difference = now - lastUpdatePromptTime;
                var      inject     = new {
                    lastUpdatePromptTime = lastUpdatePromptTime,
                    now        = now,
                    difference = difference
                };
                LOG.DebugInject("Visible Changed - Last Update Prompt Time: {lastUpdatePromptTime} - Now: {now} - Difference: {difference}", inject);
                if (difference >= TimeSpan.FromDays(1))
                {
                    Version newestVersion = await TabbedAnythingUtil.IsUpToDate();

                    if (newestVersion != null)
                    {
                        LOG.DebugFormat("Newest Version: {0}", newestVersion);

                        if (DialogResult.Yes == MessageBox.Show("A new version of Tabbed Anything is available. Update now?\n\nNote: This will exit Tabbed Anything.", "New Update", MessageBoxButtons.YesNo))
                        {
                            LOG.Debug("Update Prompt: Yes");
                            Settings.Default.LastUpdatePromptTime = DateTime.MinValue;
                            Settings.Default.Save();

                            if (await TabbedAnythingUtil.UpdateApplication(newestVersion))
                            {
                                LOG.Debug("Update - Exiting Application");
                                Application.Exit();
                            }
                            else
                            {
                                LOG.Debug("Update - Error occurred");
                                MessageBox.Show("There was an error updating Tabbed Anything. Try again later.");
                            }
                        }
                        else
                        {
                            LOG.Debug("Update Prompt: No");
                            Settings.Default.LastUpdatePromptTime = now;
                            Settings.Default.Save();

                            MessageBox.Show("To update Tabbed Anything at a later date, go to Options->About and click Update.", "New Update", MessageBoxButtons.OK);
                        }
                    }
                }
            }
        }
Example #30
0
        /// <summary>
        /// 根据额定流量选择流量计
        /// </summary>
        /// <param name="flow">被试阀额定流量</param>
        public void SetOfSelectFlowMeter(float flow)
        {
            LOG.Debug("SetOfSelectFlowMeter开始");
            //Group["阀3_2左控缓存"] = true;
            //Group["阀台当前Pa压力"] = 10f;
            //if (flow <= 600f && flow > 160f)
            //{
            //    Group["阀2_11左控缓存"] = true;
            //    Group["阀2_11右控缓存"] = false;
            //    Group["阀2_12左控缓存"] = false;
            //    Group["阀2_12右控缓存"] = true;
            //    Group["阀15控制缓存"] = false;
            //}
            //else if (flow <= 160f && flow > 16f)
            //{
            //    Group["阀2_11右控缓存"] = true;
            //    Group["阀2_11左控缓存"] = false;
            //    Group["阀2_12左控缓存"] = true;
            //    Group["阀2_12右控缓存"] = false;
            //    Group["阀15控制缓存"] = false;
            //}
            //else if (flow <= 16f)
            //{
            //    Group["阀2_11右控缓存"] = true;
            //    Group["阀2_11左控缓存"] = false;
            //    Group["阀2_12右控缓存"] = true;
            //    Group["阀2_12左控缓存"] = false;
            //    Group["阀15控制缓存"] = true;
            //}
            //int timeout = 80;
            //while (timeout-- > 0)
            //{
            //     LOG.Debug(String.Format("timeout为:{0:F}", timeout));
            //    System.Threading.Thread.Sleep(1000);
            //    if ((Group["阀2_11综合状态"] == 3 && Group["阀2_12综合状态"] == 12 && Group["阀15控制缓存"] == false)
            //        || (Group["阀2_12综合状态"] == 3 && Group["阀2_11综合状态"] == 12 && Group["阀15控制缓存"] == false)
            //        || (Group["阀15控制缓存"] == true && Group["阀2_12综合状态"] == 12 && Group["阀2_11综合状态"] == 12))
            //    {
            //        Group["阀3_2左控缓存"] = false;
            //        LOG.Debug(String.Format("timeout1为:{0:F}", timeout));
            //        break;
            //    }

            //    if (timeout < 0)
            //    {
            //        throw new BallValveOperateTimeOutException();
            //    }

            //}
            LOG.Debug("SetOfSelectFlowMeter结束");
        }