Exemplo n.º 1
0
        private void configApplication()
        {
            try {
                //Create event log and database trace listeners, and log application as started
                try {
                    ArgixTrace.AddListener(new DBTraceListener((LogLevel)App.Config.TraceLevel, App.Mediator, App.USP_TRACE, App.EventLogName));
                }
                catch {
                    ArgixTrace.AddListener(new DBTraceListener(LogLevel.Debug, App.Mediator, App.USP_TRACE, App.EventLogName));
                    ArgixTrace.WriteLine(new TraceMessage("Log level not found; setting log levels to Debug.", App.EventLogName, LogLevel.Warning, "Log Level"));
                }
                ArgixTrace.WriteLine(new TraceMessage(App.Version, App.EventLogName, LogLevel.Information, "App Started"));

                //Create business objects with configuration values
                App.Mediator.DataStatusUpdate += new DataStatusHandler(OnDataStatusUpdate);
                EnterpriseFactory.Mediator     = App.Mediator;
                EnterpriseFactory.RefreshCache();
                FinanceFactory.Mediator = App.Mediator;
                FinanceFactory.RefreshCache();
                DriverRatingFactory.Mediator = App.Mediator;
                this.stbMain.SetTerminalPanel(EnterpriseFactory.LocalTerminal.TerminalID.ToString(), EnterpriseFactory.LocalTerminal.Description);
                bool createError = App.Config.ReadOnly;
            }
            catch (Exception ex) { throw new ApplicationException("Configuration Failure", ex); }
        }
Exemplo n.º 2
0
        private void configApplication()
        {
            try {
                //Create event log and database trace listeners
                try {
                    ArgixTrace.AddListener(new DBTraceListener((LogLevel)App.Config.TraceLevel, App.Mediator, App.USP_TRACE, App.EventLogName));
                }
                catch {
                    ArgixTrace.AddListener(new DBTraceListener(LogLevel.Debug, App.Mediator, App.USP_TRACE, App.EventLogName));
                }
                ArgixTrace.WriteLine(new TraceMessage(App.Version, App.Product, LogLevel.Information, "App Started"));

                //Create business objects with configuration values
                App.Mediator.DataStatusUpdate           += new DataStatusHandler(OnDataStatusUpdate);
                StationOperator.ScanSize                 = App.Config.ScanSize;
                StationOperator.LabelTypeOverrideRegular = App.Config.LabelOverrideRegular;
                StationOperator.LabelTypeOverrideReturns = App.Config.LabelOverrideReturn;
                StationOperator.ValidateLane             = App.Config.ValidateLane;
                StationOperator.ValidateSmallLane        = App.Config.ValidateSmallLane;
                Carton.LanePrefix     = App.Config.LanePrefix;
                this.mStationOperator = new StationOperator();
                this.mStationOperator.AssignmentChanged      += new EventHandler(this.OnAssignmentChanged);
                this.mStationOperator.CartonCreated          += new CartonEventHandler(OnCartonCreated);
                this.mStationOperator.CartonDeleted          += new CartonEventHandler(OnCartonDeleted);
                this.mStationOperator.Station.PrinterChanged += new EventHandler(this.OnPrinterChanged);
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Configuration Failure", ex); }
        }
Exemplo n.º 3
0
        private void configApplication()
        {
            try {
                //Create event log and database trace listeners, and log application as started
                ArgixTrace.ClearListeners();
                ArgixTrace.AddListener(new DBTraceListener((LogLevel)App.Config.TraceLevel, App.Mediator, App.USP_TRACE, App.EventLogName));

                ArgixTrace.WriteLine(new TraceMessage(App.Version, App.EventLogName, LogLevel.Information, "App Started"));

                //Create business objects with configuration values
                App.Mediator.DataStatusUpdate += new DataStatusHandler(OnDataStatusUpdate);
                this.mLocalTerminal            = new EnterpriseTerminal();
                this.stbMain.SetTerminalPanel(this.mLocalTerminal.TerminalID.ToString(), this.mLocalTerminal.Description);
                SortBMCFactory.Mediator = App.Mediator;
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Configuration Failure", ex); }
        }
Exemplo n.º 4
0
        /// <summary>Creates a new instance of the Tsort.PandA.PandaService class.</summary>
        /// <param name="databaseConnection">An ADO.Net database connection string.</param>
        /// <param name="enableUI">Set to true to have a task tray icon displayed that provides access to the Panda Service user interface.</param>
        /// <exceptions cref="ApplicationException">Thrown for unexpected errors.</exceptions>
        public PandaService(string databaseConnection, bool enableUI)
        {
            //Constructor
            try {
                //Configure user access
                if (enableUI)
                {
                    this.mTrayIcon = new TrayIcon("PandA Library", new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream("Tsort.PandA.panda.ico")));
                    #region Tray Icon Menu Configuration
                    ctxOpen             = new MenuItem("Open", new System.EventHandler(this.OnIconMenuClicked));
                    ctxOpen.Index       = MNU_ICON_OPEN;
                    ctxOpen.Enabled     = true;
                    ctxOpen.DefaultItem = true;
                    this.mTrayIcon.MenuItems.AddRange(new MenuItem[] { ctxOpen });
                    #endregion
                    this.mTrayIcon.DoubleClick += new System.EventHandler(OnIconDoubleClicked);
                }

                //Get configuration
                PandaPacket.ValidateMessageLength = Convert.ToBoolean(DllConfig.AppSettings("ValidateMessageLength"));
                PandaPacket.CartonIDLength        = Convert.ToInt32(DllConfig.AppSettings("CartonIDLength"));
                PandaPacket.LabelDataLength       = Convert.ToInt32(DllConfig.AppSettings("LabelDataLength"));
                if (databaseConnection.Trim().Length == 0)
                {
                    databaseConnection = DllConfig.AppSettings("SQLConnection");
                }
                LogLevel level = (LogLevel)Convert.ToInt32(DllConfig.AppSettings("TraceLevel"));

                //Create objects
                ArgixTrace.AddListener(new ArgixEventLogTraceListener(level, AppLib.PRODUCTNAME));
                this.mOperator = new StationOperator(databaseConnection);
                if (enableUI)
                {
                    this.mPandaUI = new frmPanda(this, level);
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new PandaService instance.", ex); }
        }
Exemplo n.º 5
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            try {
                //Setup Issue Mgt
                try {
                    LogLevel level = App.Config != null ? (LogLevel)App.Config.TraceLevel : LogLevel.None;
                    ArgixTrace.AddListener(new DBTraceListener(level, App.Mediator, App.USP_TRACE, App.EventLogName));
                    IssueInspector.OutlookApp  = this.Application;
                    CRGFactory.TempFolder      = global::Argix.CustomerSvc.Settings.Default.TempFolder;
                    EnterpriseFactory.Mediator = CRGFactory.Mediator = App.Mediator;
                }
                catch (Argix.Data.DataAccessException ex) { App.ReportError(ex, true, LogLevel.Warning); }

                //Set references to Outlook Inspectors
                this.mInspectors = this.Application.Inspectors;
                this.mInspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(OnNewInspector);
                foreach (Outlook.Inspector inspector in this.mInspectors)
                {
                    OnNewInspector(inspector);
                }
            }
            catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); }
        }