static void Main(string[] args) { LogHelper.setLogFile("../logs/Log_OPCSampleGrpConfig.txt"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { OPCSampleGrpConfig.Common.FormCaptionHelper.GetInstance().AddCaptionsToStringHelper(); ConfigureFileHelper.GetInstance().init(); //Connect to central database DBConnectionStrings.GetInstance().AddConnectionString(ConfigureFileHelper.GetInstance().ConnectionStringConfig); //set the language and encoding change LanguageType type = LanguageTypeHelper.GetInstance().GetLanTypeByLanStr(ConfigureFileHelper.GetInstance().LanguageStr); LanguageTypeHelper.GetInstance().SetLanaguageType(type); DAOHelper.SetEncodingChange(ConfigureFileHelper.GetInstance().EncodingChange); ViewManager.GetInstance().RegisterViewFactory(new OPCSampleGrpConfigViewFactory()); IView view = ViewManager.GetInstance().GetView(OPCSampleGrpConfigStart.OPCSAMPLEGRPCONFIGSTARTFRM); Form frm = (Form)view; if (args.Length > 0) { OPCSampleGrpConfigStartController sampleGrpController = (OPCSampleGrpConfigStartController)view.getController(); sampleGrpController.SetSampleGrpConfigLocation(ref frm, args[0]); } Application.Run(frm); } catch (Exception localExecption) { Console.WriteLine(localExecption.ToString()); } DBConnectionStrings.GetInstance().TerminateMonitorThread(); }
public void TestInitializeIntervalConfigDataGridView02() { //testing for Chinese Language using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { //Test Procedure Call LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.Chinese); Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); oPCSampleGrpConfigStartAccessor.Call("InitializeIntervalConfigDataGridView"); #region PostConditionCheck //Post Condition Check Accessor opcStartaccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); System.Windows.Forms.DataGridView gridCtrl = (System.Windows.Forms.DataGridView)opcStartaccessor.GetField("intervalConfigDataGridView"); //Column count Assert.AreEqual(12, gridCtrl.ColumnCount); //column names Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPID_COL_NAME, gridCtrl.Columns[0].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPNAME_COL_NAME, gridCtrl.Columns[1].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME, gridCtrl.Columns[2].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEINTERVAL_COL_NAME, gridCtrl.Columns[3].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEINTERVALTYPE_COL_NAME, gridCtrl.Columns[4].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLESTARTTIME_COL_NAME, gridCtrl.Columns[5].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEDELTAVAL_COL_NAME, gridCtrl.Columns[6].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLELOCATION_COL_NAME, gridCtrl.Columns[7].Name); Assert.AreEqual("", gridCtrl.Columns[8].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_EDITCOLUMN_NAME, gridCtrl.Columns[9].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_DELETECOL_NAME, gridCtrl.Columns[10].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_CONFIGCOL_NAME, gridCtrl.Columns[11].Name); //column header English text Assert.AreEqual(opcStartaccessor.GetField("OPCSAMPLEGRPID_COL_TEXT"), gridCtrl.Columns[0].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DATA_GROUP_NAME, gridCtrl.Columns[1].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DESCRIPTION, gridCtrl.Columns[2].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_TIME_SPAN, gridCtrl.Columns[3].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_TIME_FRAME, gridCtrl.Columns[4].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_START_TIME, gridCtrl.Columns[5].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_DELTA_VALUE, gridCtrl.Columns[6].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_LOCATION, gridCtrl.Columns[7].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DISABLE, gridCtrl.Columns[8].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_EDIT, gridCtrl.Columns[9].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_DELETE, gridCtrl.Columns[10].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_CONFIG, gridCtrl.Columns[11].HeaderText); //column width Assert.AreEqual(50, gridCtrl.Columns[0].Width); Assert.AreEqual(250, gridCtrl.Columns[1].Width); Assert.AreEqual(220, gridCtrl.Columns[2].Width); Assert.AreEqual(60, gridCtrl.Columns[3].Width); Assert.AreEqual(95, gridCtrl.Columns[4].Width); Assert.AreEqual(80, gridCtrl.Columns[5].Width); Assert.AreEqual(92, gridCtrl.Columns[6].Width); Assert.AreEqual(80, gridCtrl.Columns[7].Width); Assert.AreEqual(70, gridCtrl.Columns[8].Width); Assert.AreEqual(50, gridCtrl.Columns[9].Width); Assert.AreEqual(50, gridCtrl.Columns[10].Width); Assert.AreEqual(50, gridCtrl.Columns[11].Width); LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); #endregion } }
public void FixtureSetUp() { OPCSampleGrpConfig.Common.FormCaptionHelper.GetInstance().AddCaptionsToStringHelper(); TrendingHelper.ConfigureFileHelper.GetInstance().init(); LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); DBConnectionStrings.GetInstance().AddConnectionString(TrendingHelper.ConfigureFileHelper.GetInstance().ConnectionStringConfig); }
public void TestTranslateCaption01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { //Test 1 --- testing for english language setting //Test Procedure call oPCSampleGrpConfigStart.TranslateCaption(); #region PostConditionCheck //Post Condition Check Accessor opcStartaccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.DP_GRP_NAME, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label1")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.DP_GRP_DES, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label2")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.START_TIME, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label3")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.DELTA_VALUE, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label4")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.INTERVAL_UNIT, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label6")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.INTERVAL_LENGTH, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label7")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.DISABLE, ((System.Windows.Forms.CheckBox)opcStartaccessor.GetField("disableCheckBox")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.CANCLE, ((System.Windows.Forms.Button)opcStartaccessor.GetField("cancelMsgCmd")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.SAVE, ((System.Windows.Forms.Button)opcStartaccessor.GetField("saveMsgCmd")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.TOTAL_PAGE, ((System.Windows.Forms.ToolStripLabel)opcStartaccessor.GetField("TotalPage_Tlbl")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.TITLE, oPCSampleGrpConfigStart.Text); System.Windows.Forms.ComboBox intervalCombo = (System.Windows.Forms.ComboBox)opcStartaccessor.GetField("intervalTypeBox"); Assert.AreEqual(3, intervalCombo.Items.Count); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.HOUR, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_HOUR_INDEX]); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.MINITE, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_MINUTE_INDEX]); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.SECOND, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_SECOND_INDEX]); #endregion //Test2 --- testing chinese language settings. LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.Chinese); oPCSampleGrpConfigStart.TranslateCaption(); #region PostConditionCheck //Post Condition Check opcStartaccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DP_GRP_NAME, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label1")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DP_GRP_DES, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label2")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.START_TIME, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label3")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DELTA_VALUE, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label4")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.INTERVAL_UNIT, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label6")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.INTERVAL_LENGTH, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label7")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DISABLE, ((System.Windows.Forms.CheckBox)opcStartaccessor.GetField("disableCheckBox")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.CANCLE, ((System.Windows.Forms.Button)opcStartaccessor.GetField("cancelMsgCmd")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.SAVE, ((System.Windows.Forms.Button)opcStartaccessor.GetField("saveMsgCmd")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.TOTAL_PAGE, ((System.Windows.Forms.ToolStripLabel)opcStartaccessor.GetField("TotalPage_Tlbl")).Text); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.TITLE, oPCSampleGrpConfigStart.Text); intervalCombo = (System.Windows.Forms.ComboBox)opcStartaccessor.GetField("intervalTypeBox"); Assert.AreEqual(3, intervalCombo.Items.Count); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.HOUR, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_HOUR_INDEX]); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.MINITE, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_MINUTE_INDEX]); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.SECOND, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_SECOND_INDEX]); LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); #endregion } }
public void FixtureSetUp() { OPCSampleGrpConfig.Common.FormCaptionHelper.GetInstance().AddCaptionsToStringHelper(); TrendingHelper.ConfigureFileHelper.GetInstance().init(); //Connect to central database DAO.Trending.Common.DBConnectionStrings.GetInstance().AddConnectionString(TrendingHelper.ConfigureFileHelper.GetInstance().ConnectionStringConfig); LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); ViewManager.GetInstance().RegisterViewFactory(new OPCSampleGrpConfigViewFactory()); ((OPCSampleGrpConfigStart)ViewManager.GetInstance().GetView(OPCSampleGrpConfigStart.OPCSAMPLEGRPCONFIGSTARTFRM)).TranslateCaption(); }
static void Main(string[] args) { string Function_Name = "Main"; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += new ThreadExceptionEventHandler(Program.UIThreadExceptionHandler); try { ConfigureFileHelper.GetInstance().init(); //LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); LanguageType type = LanguageTypeHelper.GetInstance().GetLanTypeByLanStr(ConfigureFileHelper.GetInstance().LanguageStr); LanguageTypeHelper.GetInstance().SetLanaguageType(type); DAOHelper.SetEncodingChange(ConfigureFileHelper.GetInstance().EncodingChange); LanguageHelper.InitAllStrings(); string eventName = CreateWin32EventAndSetLogFile(); ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.TrendView); //viewID is "" Form frm = (Form)view; if (args.Length > 0) { TrendViewController trendController = (TrendViewController)view.getController(); trendController.DrawTrendView(ref frm, args[0]); } Application.Run(frm); //event will be closed automatically. LogHelper.Info(CLASS_NAME, Function_Name, "Closed Event:" + eventName); } catch (Exception localExecption) { LogHelper.Error("TrendViewer.Program", Function_Name, localExecption.ToString()); } }
public static LanguageTypeHelper CreateLanguageTypeHelper01() { LanguageTypeHelper languageTypeHelper = LanguageTypeHelper.GetInstance(); return(languageTypeHelper); }
public void TestGetInstance01() { LanguageTypeHelper languageTypeHelper = LanguageTypeHelper.GetInstance(); }