/// <summary>
        /// Initialize TimeTableViewer.
        /// </summary>
        /// <param name="ctl">.</param>

        public void InitializeTimeTableViewer()
        {
            string FUNCTION_NAME = "InitializeTimeTableViewer";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Function Entered.");

            DateTime Today = System.DateTime.Today.Date;

            this.datePicker.MaxDate = Today;
            this.datePicker.Value   = Today;

            //minimum date set to 32 days earlier from current date.
            this.datePicker.MinDate      = System.DateTime.Today.Date.AddDays(-TrainTimeTableConst.NUM_EARLIER_DAYS);
            this.startTimePicker.MinDate = Today;
            this.startTimePicker.Value   = Today;
            this.startTimePicker.MaxDate = Today.AddHours(23).AddMinutes(58).AddSeconds(59);
            this.endTimePicker.Value     = Today.AddHours(23).AddMinutes(59).AddSeconds(59);
            this.endTimePicker.MinDate   = System.DateTime.Today.Date.AddMinutes(1);
            this.endTimePicker.MaxDate   = Today.AddHours(23).AddMinutes(59).AddSeconds(59);

            bool bConnected = false;

            try
            {
                DBConnectionStrings.GetInstance().AddConnectionString(ConfigureFileHelper.GetInstance().DBConnectionString);

                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, "Connection String is: " + ConfigureFileHelper.GetInstance().DBConnectionString);

                bConnected = SimpleDatabase.GetInstance().OpenConnection();
            }
            catch (Exception localException)
            {
                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, localException.ToString());
            }

            if (!bConnected)
            {
                MessageBox.Show("Error", "No connection", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "No Connection to Database.");
            }

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Exited");
        }
예제 #2
0
 public void TestSetup()
 {
     ConfigureFileHelper.GetInstance().init();
     bExitApplicationCalled = false;
 }
예제 #3
0
 public void TestInit02()
 {
     //if (encodingChange_str.ToLower() == "true")
     ConfigureFileHelper.GetInstance().init();
 }
예제 #4
0
        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());
            }
        }
예제 #5
0
 public About(string aboutMsg)
 {
     InitializeComponent();
     aboutMsgLabel.Text = ConfigureFileHelper.GetInstance().AboutMessage;
 }
예제 #6
0
        internal static ConfigureFileHelper CreateConfigureFileHelper01()
        {
            ConfigureFileHelper configureFileHelper = ConfigureFileHelper.GetInstance();

            return(configureFileHelper);
        }
예제 #7
0
        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();
        }
예제 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="paramList"> arg[0]: "view-0/view-edit-0/..", arg[1] datapoint, arg[2] marker,arg[3] history, arg[4] formula
        /// </param>
        public void DrawTrendView(ref Form frm, string paramList)
        {
            //get trending data by model
            //call to view for drawing
            string[]  arg         = paramList.Split(new char[] { ',' }, StringSplitOptions.None);
            int       screenWidth = ConfigureFileHelper.GetInstance().ScreenWidth;
            const int OFFSET      = 200;

            if (arg.Length > 0)
            {
                if (arg[0].Trim().ToLower() == "view-edit-0")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = 0 + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-edit-1")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = screenWidth + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-edit-2")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = screenWidth * 2 + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-0")
                {
                    this.accessRight  = "N";
                    this.leftLocation = 0;
                }
                else if (arg[0].Trim().ToLower() == "view-1")
                {
                    this.accessRight  = "N";
                    this.leftLocation = screenWidth + OFFSET;
                }
                else
                {
                    this.accessRight  = "N";
                    this.leftLocation = screenWidth * 2 + OFFSET;
                }
                frm.StartPosition = FormStartPosition.Manual;
                frm.Location      = new Point(leftLocation, 0x9b);
            }
            if (arg.Length > 1)
            {
                if (arg[1].ToString().Trim() != "")
                {
                    DataPointListModel model = new DataPointListModel();
                    m_trendCache.m_dataPointList    = model.GetDPListByGrp(arg[1].Trim());
                    m_trendCache.m_datapointGrpName = arg[1].Trim();
                }
            }
            if (arg.Length > 2)
            {
                if (arg[2].ToString().Trim() != "")
                {
                    MarkerListModel model = new MarkerListModel();
                    m_trendCache.m_markerList    = model.GetMarkerListByGrp(arg[2].Trim());
                    m_trendCache.m_markerGrpName = arg[2].Trim();
                }
            }
            if (arg.Length > 3)
            {
                if (arg[3].ToString().Trim() != "")
                {
                    HistDataPointListModel model = new HistDataPointListModel();
                    m_trendCache.m_histDataPointList    = model.GetHistDListByGrp(arg[3].Trim());
                    m_trendCache.m_histDatapointGrpName = arg[3].Trim();
                }
            }
            if (arg.Length > 4)
            {
                if (arg[4].ToString().Trim() != "")
                {
                    FormulaListModel model = new FormulaListModel();
                    m_trendCache.m_formulaList    = model.GetFormulaListByGrp(arg[4].Trim());
                    m_trendCache.m_formulaGrpName = arg[4].Trim();
                }
            }
            object    sender = null;
            EventArgs e      = null;

            if (arg.Length > 1)
            {
                RealTimeExecuteCmd_Click(sender, e);
            }
        }