Ejemplo n.º 1
0
        public static void testDisplayOrder(CloverConnector cloverConnector, TestConnectorListener connListener)
        {
            DisplayOrder order = DisplayFactory.createDisplayOrder();

            order.title               = "Get Ready!";
            order.note                = "Here is the note field";
            order.serviceChargeName   = "Gonna Getcha";
            order.serviceChargeAmount = "$2,123.34";

            DisplayLineItem lineItem = DisplayFactory.createDisplayLineItem();

            lineItem.name  = "My Item Name";
            lineItem.price = "$123.43";

            order.addDisplayLineItem(lineItem);

            DisplayDiscount discount = DisplayFactory.createDisplayDiscount();

            discount.amount = "$543.21";
            discount.name   = "Nice Guy discount";

            order.addDisplayDiscount(discount);

            cloverConnector.ShowDisplayOrder(order);

            DisplayLineItem line2 = DisplayFactory.createDisplayLineItem();

            line2.name      = "another item";
            line2.price     = "$4.68";
            line2.quantity  = "2";
            line2.unitPrice = "$2.34";
            order.addDisplayLineItem(line2);

            cloverConnector.ShowDisplayOrder(order);
        }
Ejemplo n.º 2
0
        ////////////////// UI Events and UI Management //////////////////////

        private void StoreItems_ItemSelected(object sender, EventArgs e)
        {
            POSItem     item     = ((StoreItem)((Control)sender).Parent).Item;
            POSLineItem lineItem = Store.CurrentOrder.AddItem(item, 1);

            DisplayLineItem displayLineItem = null;

            posLineItemToDisplayLineItem.TryGetValue(lineItem, out displayLineItem);
            if (displayLineItem == null)
            {
                displayLineItem = DisplayFactory.createDisplayLineItem();
                posLineItemToDisplayLineItem[lineItem] = displayLineItem;
                displayLineItem.quantity = "1";
                displayLineItem.name     = lineItem.Item.Name;
                displayLineItem.price    = (lineItem.Item.Price / 100.0).ToString("C2");
                DisplayOrder.addDisplayLineItem(displayLineItem);
                UpdateDisplayOrderTotals();
                cloverConnector.DisplayOrderLineItemAdded(DisplayOrder, displayLineItem);
            }
            else
            {
                displayLineItem.quantity = lineItem.Quantity.ToString();
                UpdateDisplayOrderTotals();
                cloverConnector.DisplayOrder(DisplayOrder);
            }

            UpdateUI();
        }
Ejemplo n.º 3
0
        private void CreateDisplay()
        {
            this.PrintFunctionName("CreateDisplay");
            var displayCollection = DisplayFactory.CreateDisplays(ControlSystem.Configs.Config.Displays);

            ProAvControlSystem.Displays.Add(displayCollection);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            string      FileNamePathToWrite;
            ILogger     logger       = LogFactory.CreatLogger();
            IMessage    errorMessage = MessageFactory.CreatMessage(Message.MessageType.Error);
            IDisplay    display;
            NamesFile   file;
            List <Name> names;

            try
            {
                //
                //Get file name/path from app.config
                //
                FileNamePathToWrite = ConfigurationManager.AppSettings["FileNamePathToWrite"];

                //
                //create screen display object from the factory
                //
                display = DisplayFactory.CreatDisplay();

                //
                //get file name and path for reading names from command parameter; file name and path for writing names to is set by program
                //
                file = FileInfoValidator.GetFile(args, FileNamePathToWrite);

                //
                //only proceed further if file is available
                //
                if (file != null)
                {
                    //
                    // get list of name object by reading
                    //
                    names = ReadNamesHelper.ReadNamesFromStorage(file);

                    //
                    //do sorting on names
                    //
                    names = NameSorter.Sort(names);

                    //
                    //writing sorted names to a storage
                    //
                    WriteNamesHelper.WriteNamesToStorage(file, names);


                    //
                    //display sorted name list on screen
                    //
                    display.DisplayName(names);
                }
            }
            catch (Exception ex)
            {
                logger.Log(ex.Message);
                errorMessage.DisplayMessage(ex.Message);
            }
        }
        public void TestIfSinglePrimaryMonitorExists()
        {
            var displayModel = DisplayFactory.GetDisplayModel();
            var primary      = displayModel
                               .GetActiveDisplays()
                               .Single(x => x.IsPrimary);

            Assert.AreNotEqual(primary, null);
        }
        public void TestIfResolutionChangingWorks()
        {
            IDisplayModel displayModel = DisplayFactory.GetDisplayModel();
            Display       primary      = displayModel.GetPrimaryDisplay();

            var newResolution = new Size(800, 600);

            Assert.IsTrue(primary.SetResolution(newResolution));

            Assert.AreEqual(newResolution, primary.Resolution);
        }
        public void TestIfActiveAndDeActiveWorks()
        {
            IDisplayModel displayModel = DisplayFactory.GetDisplayModel();
            Display       primary      = displayModel.GetPrimaryDisplay();

            Assert.IsTrue(primary.IsActive);

            primary.SetDeactive();

            Assert.IsFalse(primary.IsActive);

            primary.SetActive();

            Assert.IsTrue(primary.IsActive);
        }
Ejemplo n.º 8
0
		public Flash(string path, DisplayFactory aFactory){
			displayFactory = aFactory;
			string ext = Path.GetExtension (path);
			if(ext!=null && ext.Length>0)
				path = path.Replace (ext, "");
			TextAsset asset = Resources.Load<TextAsset> (path);
			NSUtils.Assert (asset != null, "BBGamelib:flash:{0} file not found!", path);

			byte[] data = asset.bytes;

			Cursor cursor = new Cursor ();
			readHeader (data, cursor);
			readDefines (data, cursor);
			Resources.UnloadAsset (asset);
		}
        public void TestRotation()
        {
            IDisplayModel displayModel = DisplayFactory.GetDisplayModel();
            Display       primary      = displayModel.GetPrimaryDisplay();

            var currentOrientation = primary.Rotation;

            // yeah, the orientation is default currently.
            Assert.AreEqual(DisplayRotation.Default, currentOrientation);

            // set the rotation to 180.
            Assert.IsTrue(primary.SetRotation(DisplayRotation.Rotated180));

            // see if the change worked
            Assert.AreEqual(DisplayRotation.Rotated180, primary.Rotation);
        }
Ejemplo n.º 10
0
        private void NewOrder()
        {
            Store.CreateOrder();
            StoreItems.BringToFront();
            StoreDiscounts.BringToFront();

            DisplayOrder       = DisplayFactory.createDisplayOrder();
            DisplayOrder.title = Guid.NewGuid().ToString();
            posLineItemToDisplayLineItem.Clear();

            cloverConnector.ShowWelcomeScreen();
            //cloverConnector.DisplayOrder(DisplayOrder); // want the welcome screen until something is added to the order

            PayButton.Enabled  = true;
            StoreItems.Enabled = true;
            TabControl.Enabled = true;

            RegisterTabs.SelectedIndex = 0;

            UpdateUI();
        }
Ejemplo n.º 11
0
        public Flash(string path, DisplayFactory aFactory)
        {
            displayFactory = aFactory;
            string ext = Path.GetExtension(path);

            if (ext != null && ext.Length > 0)
            {
                path = path.Replace(ext, "");
            }
            TextAsset asset = Resources.Load <TextAsset> (path);

            NSUtils.Assert(asset != null, "BBGamelib:flash:{0} file not found!", path);

            byte[] data = asset.bytes;

            Cursor cursor = new Cursor();

            readHeader(data, cursor);
            readDefines(data, cursor);
            Resources.UnloadAsset(asset);
        }
Ejemplo n.º 12
0
        private void ExamFrm_Load(object sender, EventArgs e)
        {
            if (_pracConfig == null)
            {
                MessageBox.Show("ExamConfig属性未赋值。");
                this.Close();
                return;
            }

            if (IsExam)
            {
                this.Text = "考试窗口";
            }
            else
            {
                this.Text = "练习窗口";
            }

            //
            //读取设置文件,准备环境设置
            //
            //用哪个setting
            SettingPair sp = new SettingPair();

            sp.ImplementClass = AssemblyInfoFactory.GetType(PracticeConfig.Setting.ClsFilePath, PracticeConfig.Setting.ClsName);
            sp.FilePath       = PracticeConfig.Setting.ConfigFilePath;

            ISettings setting  = new CSetup(sp).Settings;
            CSettings csetting = setting as CSettings;

            //
            //创建Monitor,Translator,StateManager。
            //准备考试核心引擎
            //
            //用哪个monitor
            AssemblyInfoPair monInfo = AssemblyInfoFactory.GetAssemblyInfo(PracticeConfig.Monitor.ClsFilePath, PracticeConfig.Monitor.ClsName);

            mon = SignalMonitorFactory.CreateSignalMonitor(monInfo, setting);

            //用哪个translator
            AssemblyInfoPair transInfo = AssemblyInfoFactory.GetAssemblyInfo(PracticeConfig.Translator.ClsFilePath, PracticeConfig.Translator.ClsName);

            translator = TranslatorFactory.CreateTranslater(transInfo, mon);

            //用哪个statemanager
            AssemblyInfoPair stateMgrInfo = AssemblyInfoFactory.GetAssemblyInfo(PracticeConfig.StateManager.ClsFilePath, PracticeConfig.StateManager.ClsName);

            stateMgr = StateManagerFactory.CreateStateManager(stateMgrInfo, translator, setting);

            //
            //创建考试启动停止控件
            //实现单会合考试
            examCtrl.Anchor = AnchorStyles.None;
            examCtrl.Dock   = DockStyle.Fill;
            this.paneExamCtrl.Controls.Add(examCtrl);

            //ExamCtrl控件必须先被add到其父窗口中,然后再进行Initialize
            examCtrl.InitializeExamComponent(setting, mon, translator, stateMgr);

            //初始化声音控件(基础声音控件类)
            SoundCtrl soundCtrl = new SoundCtrl();


            //初始化显示牌控件
            SettingPair spDisplay = new SettingPair();

            spDisplay.ImplementClass = AssemblyInfoFactory.GetType(PracticeConfig.LEDConfig.ClsFilePath, PracticeConfig.LEDConfig.ClsName);
            spDisplay.FilePath       = PracticeConfig.LEDConfig.ConfigFilePath;

            ISettings     dissettings    = new CSetup(spDisplay).Settings;
            DisplayConfig dispalySetting = dissettings as DisplayConfig;

            displaycomm = DisplayFactory.CreateDisplay(PracticeConfig.LED.ClsFilePath, PracticeConfig.LED.ClsName, dispalySetting);

            //初始化摄像头
            Camera camera = new Camera(0);

            camera.Anchor = AnchorStyles.None;
            camera.Dock   = DockStyle.Fill;
            this.groupPanelVideo.Controls.Add(camera);
            this.Move        += new EventHandler(camera.Camera_Move);
            this.FormClosing += new FormClosingEventHandler(camera.Camera_Closing);

            if (IsExam)
            {
                string[] cxs = ExamConfig.LicenseList.Split(new char[] { ';' });
                //初始化车型列表
                List <string> cxList = new List <string>(cxs);

                //用哪个Candidate Infomation Panel
                CandExamCtrl candExamPane;

                if (ExamConfig.HasQueue)
                {
                    //初始化排队列表
                    CandidateQuery candQuery = new CandidateQuery();
                    candQuery.Anchor = AnchorStyles.None;
                    candQuery.Dock   = DockStyle.Fill;
                    this.paneXQueueList.Controls.Add(candQuery);

                    candExamPane = (CandExamCtrl)CreateModule(ExamConfig.ExamCtrl.ClsFilePath, ExamConfig.ExamCtrl.ClsName, new object[] { candQuery });
                }
                else
                {
                    candExamPane = (CandExamCtrl)CreateModule(ExamConfig.ExamCtrl.ClsFilePath, ExamConfig.ExamCtrl.ClsName, new object[] { });
                }

                candExamPane.Dock = DockStyle.Fill;
                candExamPane.InitializeCandExamCtrlComponent(examCtrl, csetting, cxList);
                this.groupPanelCandInfo.Controls.Add(candExamPane);

                //结果显示控件
                ExamResultPanel resultPanel = new ExamResultPanel();
                resultPanel.Anchor            = AnchorStyles.None;
                resultPanel.Dock              = DockStyle.Fill;
                candExamPane.ExamResultReady += new ExamResultDelegate(resultPanel.SetResultText);
                this.paneXResult.Controls.Add(resultPanel);

                candExamPane.SoundChange         += new MessageDelegate(soundCtrl.PlayText);   //注册candExamCtrl的声音变化事件回调函数
                candExamPane.LEDDisplayChange    += new MessageDelegate(displaycomm.ShowText); //注册candExamCtrl的显示牌变化事件回调函数
                candExamPane.CameraChannelChange += new IntegerDelegate(camera.SetChannel);    //注册candExamCtrl的摄像头变化事件回调函数
            }

            //创建考试状态显示面板
            //单会合考试级别扩展功能
            ExamStatusDisplayPanel statePane = new ExamStatusDisplayPanel();

            statePane.Anchor = AnchorStyles.None;
            statePane.InitializeExamComponent(stateMgr);
            this.paneXStatus.Controls.Add(statePane);

            //创建信号显示面板
            SignalDisplay signaldisplay = new SignalDisplay(mon);

            signaldisplay.Anchor = AnchorStyles.None;
            signaldisplay.Dock   = DockStyle.Fill;
            this.paneXSignalDisp.Controls.Add(signaldisplay);

            //用哪个DisplayPanel
            BaseModelDisplayPanel modelDisplayPane = (BaseModelDisplayPanel)CreateModule(PracticeConfig.ModelDisplay.ClsFilePath, PracticeConfig.ModelDisplay.ClsName, new object[] { });

            modelDisplayPane.Anchor = AnchorStyles.None;
            modelDisplayPane.InitializeExamComponent(csetting, mon, stateMgr);
            this.groupPanelModelDisp.Controls.Add(modelDisplayPane);
        }