public void RefreshStationAssignments() { //Refresh current station assignments try { //Validate operator state if (!this.mOperatorWorking) { throw new ApplicationException("Station Operator not started for work; call StartWork() before RefreshStationAssignments()."); } //Clear assignment info SortFactory.CreateBrain(null); this.mAssignments.Clear(); //Refresh station assignments; select first assignment as current and select the appropriate Brain this.mAssignments = SortFactory.GetStationAssignments(this.mStation); ArgixTrace.WriteLine(new TraceMessage("Assignments changed... " + this.mAssignments.Count.ToString() + " new assignments...", AppLib.EVENTLOGNAME, LogLevel.Warning, "SortOperator")); if (this.mAssignments.Count > 0) { this.mBrain = SortFactory.CreateBrain(this.mAssignments.Item(0).SortProfile); CurrentInboundLabel = this.mAssignments.Item(0).SortProfile.InboundLabel; } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected error while refreshing station assignments.", ex); } finally { if (this.StationAssignmentsChanged != null) { this.StationAssignmentsChanged(this, EventArgs.Empty); } } }
public StationOperator(string connectionString, bool useConnectionState) { //Constructor - this is done for dll purposes, NEED to think more, maybe move to config file, but will need dll start up try { //Init this object Config._ConnectionString = connectionString; Config._WebSvcUrl = ""; Config._UseWebSvc = false; Config._UseConnState = useConnectionState; AppLib.Mediator.DataStatusUpdate += new DataStatusHandler(OnDataStatusUpdate); EnterpriseFactory.Mediator = FreightFactory.Mediator = SortFactory.Mediator = AppLib.Mediator; Brain.Self = this; this.mBrain = SortFactory.CreateBrain(null); //this.mStation = SortFactory.CreateWorkstation(""); this.mStation = SortFactory.CreateWorkstation(Environment.MachineName); this.mAssignments = new StationAssignments(); this.mSortedItems = new SortedItems(); this.mSetup = new dlgStationSetup(dlgStationSetup.SCALETYPE_AUTOMATIC); } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating Station Operator instance.", ex); } }