private SKColor MatchStateStatusToColor(KioskState state, KioskStatus status)
 {
     if (state == CHBackOffice.ApiServices.ChsProxy.KioskState.InService ||
         state == CHBackOffice.ApiServices.ChsProxy.KioskState.ONLINE)
     {
         if (status == CHBackOffice.ApiServices.ChsProxy.KioskStatus.Normal)
         {
             return(Color.FromHex("#63EEB0").ToSKColor());
         }
         else if (status == CHBackOffice.ApiServices.ChsProxy.KioskStatus.Warning)
         {
             return(Color.FromHex("#FEDE76").ToSKColor());
         }
         else
         {
             return(Color.FromHex("#FCA35A").ToSKColor());
         }
     }
     else if (state == CHBackOffice.ApiServices.ChsProxy.KioskState.Offline)
     {
         return(Color.FromHex("#CDCDCD").ToSKColor());
     }
     else if (state == CHBackOffice.ApiServices.ChsProxy.KioskState.OutOfServiceSOP)
     {
         return(Color.FromHex("#62C8F5").ToSKColor());
     }
     else
     {
         return(Color.FromHex("#FD6F82").ToSKColor());
     }
 }
 public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
 {
     FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);
     DGetFee getFee = new DGetFee(this.GetFee);
     getFee.BeginInvoke(null, null);
     return viewGrid;
 }
        public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
        {
            FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);

            action = null;
            //this.TransactionContext.CardPaymentCycleInProgress = false;
            Devices.GetCardReader().SwipeCardEvent += OnSwipeCardEvent;
            Devices.GetCardReader().PaymentConfirmationEvent += OnPaymentConfirmationEvent;
            Devices.GetCardReader().PaymentFailedEvent += OnPaymentFailedEvent;
            Devices.GetCardReader().PaymentConfirmedEvent += OnPaymentConfirmedEvent;
            Devices.GetCardReader().ReceiptEvent += OnReceiptNotifiedEvent;
            Devices.GetCardReader().CardInValid += OnCardInvalid;

            //This Line is commented to disable multiple payments in the transaction
            //Devices.GetCardReader().PaymentAsync(Convert.ToDouble(this.TransactionContext.PaymentAmount));

            using (FileStream stream = new FileStream(@"app001.log", FileMode.Append, FileAccess.Write))
            {
                StreamWriter writer = new StreamWriter(stream);
                writer.WriteLine(string.Format("{0} : State : {1} : Load Xaml Ended", DateTime.Now, this.State.XamlPath));
                writer.Flush();
                writer.Close();
            }

            return viewGrid;
        }
 public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, Infrastructure.ObjectModel.TransactionContextBase transactionContext)
 {
     FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);
     DProcessPayment doPayment = new DProcessPayment(this.DoPayment);
     Devices.GetCashAcceptor().NoteStackedEvent += OnNoteStackedEvent;
     doPayment.BeginInvoke(null, null);
     return viewGrid;
 }
 public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
 {
     timer = new DispatcherTimer();
     FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);
     timer.Tick += OnTimeOut;
     timer.Interval = new TimeSpan(0, 0, state.IdleTimeOut);
     timer.Start();
     return viewGrid;
 }
示例#6
0
 private static void DeleteComponentStatuses(
     KioskBrainsContext dbContext,
     KioskState kioskState,
     KioskStateComponentInfo[] componentStatuses)
 {
     foreach (var componentStatus in componentStatuses)
     {
         dbContext.KioskStateComponentInfos.Remove(componentStatus);
         kioskState.ComponentsStatuses.Remove(componentStatus);
     }
 }
 public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
 {
     FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);
     action = null;
     dblerrUnknown = 0;
     //this.Transaction.CardPaymentCycleInProgress = false;
     Devices.GetCardReader().SwipeCardEvent += OnSwipeCardEvent;
     Devices.GetCardReader().PaymentConfirmationEvent += OnPaymentConfirmationEvent;
     Devices.GetCardReader().PaymentFailedEvent += OnPaymentFailedEvent;
     Devices.GetCardReader().PaymentConfirmedEvent += OnPaymentConfirmedEvent;
     Devices.GetCardReader().ReceiptEvent += OnReceiptNotifiedEvent;
     Devices.GetCardReader().CardInValid += OnCardInvalid;
     Devices.GetCardReader().PaymentAsync(Convert.ToDouble(this.Transaction.AppliedFeeAmount));
     return viewGrid;
 }
        public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
        {
            if (log.IsInfoEnabled) log.InfoFormat("{0} :  Load Xaml Started", DateTime.Now);
            dblerrUnknown = 0;
            FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);

            action = null;
            //this.TransactionContext.CardPaymentCycleInProgress = false;
            Devices.GetCardReader().SwipeCardEvent += OnSwipeCardEvent;
            Devices.GetCardReader().PaymentConfirmationEvent += OnPaymentConfirmationEvent;
            Devices.GetCardReader().PaymentFailedEvent += OnPaymentFailedEvent;
            Devices.GetCardReader().PaymentConfirmedEvent += OnPaymentConfirmedEvent;
            Devices.GetCardReader().ReceiptEvent += OnReceiptNotifiedEvent;
            Devices.GetCardReader().CardInValid += OnCardInvalid;
            Devices.GetCardReader().PaymentAsync(Convert.ToDouble(this.TransactionContext.AppliedFeeAmount));
            TransactionContext.Message = string.Empty;
            return viewGrid;
        }
 public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
 {
     FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);
     this.Transaction.PaymentAmount = string.Empty;
     return viewGrid;
 }
        //private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        public virtual FrameworkElement LoadXaml(KioskState state, TransactionContextBase transactionContext)
        {
            try
            {
                Trace.WriteLine(string.Format("{0} - BaseMethod loadxaml started for {0}..", DateTime.Now, state.Name));
                //MessageBox.Show(state.Name);
                RegisterCommands();
                Trace.WriteLine(string.Format("{0} - RegisterCommands Successful", DateTime.Now, state.Name));
                this.State = state;
                this.transactionContext = transactionContext;

                FrameworkElement root = LoadXamlFile(state.XamlPath);

                if(root==null)
                    Trace.WriteLine(string.Format("{0} - root element is null..", DateTime.Now, state.Name));
                else
                    Trace.WriteLine(string.Format("{0} - root element created", DateTime.Now, state.Name));

                root.BeginInit();
                try
                {
                    root.DataContext = this;
                    root.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(OnPreviewKeyDown);
                }
                catch (Exception ex)
                {
                    // KS TODO: Add log messages.
                    throw ex;
                }
                finally
                {
                    root.EndInit();
                    ViewGrid = root;
                    root.UpdateLayout();
                }
            }
            catch (Exception ex)
            {
                //if (log.IsErrorEnabled) log.Error("Caught exception in LoadXaml method" + ex.Message);
                Trace.TraceError("Exception details: \nSource: {0}\nMessage: {1}\nTrace:", ex.Source, ex.Message, ex.StackTrace);
                throw ex;
            }

            return ViewGrid;
        }
示例#11
0
 public virtual FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
 {
     Trace.WriteLine(string.Format("{0} - Infrastructure PresenterBase loadxaml started for {0}..", DateTime.Now,state.Name));
     Devices = devices;
     FrameworkElement viewGrid = base.LoadXaml(state, transactionContext);
     RestartStateTimer();
     Trace.WriteLine(string.Format("{0} - Infrastructure PresenterBase loadxaml ended for {0}..", DateTime.Now, state.Name));
     return viewGrid;
 }
        public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
        {
            using (FileStream stream = new FileStream(@"app001.log", FileMode.Append, FileAccess.Write))
            {
                StreamWriter writer = new StreamWriter(stream);
                writer.WriteLine(string.Format("{0} - Mawaqif Receipt LoadXaml Started", DateTime.Now));
                writer.Flush();
                writer.Close();
            }

            timer = new DispatcherTimer();

            FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);
            ReceiptPresenterBase<MawaqifTransaction> presenter = new ReceiptPresenterBase<MawaqifTransaction>(this.Transaction);
            isPrintRequestSent = false;

            if (this.Transaction.PostingFailed)
                this.State.ViewContentKey = "transactioncomplete_postingfailedtext";
            else
                if (Transaction.TransactionFailed)
                    this.State.ViewContentKey = "mawaqif_txt_pct_transaction_failed";
                else
                    this.State.ViewContentKey = "transactioncomplete_completionetext";

            if (string.Compare(this.Transaction.SelectedLanguageKey, "arabic", StringComparison.OrdinalIgnoreCase) == 0)
            {
                //receiptElement = presenter.LoadReceiptXaml(@"modules/mawaqif/pages/receipts/mawaqifreceipt_ar.xaml");
                if (!Transaction.CardPayment)
                    receiptElement = presenter.LoadReceiptXaml(@"modules/mawaqif/pages/receipts/mawaqifreceipt.xaml");
                else
                    receiptElement = presenter.LoadReceiptXaml(@"modules/mawaqif/pages/receipts/mawaqifreceipt_card.xaml");
            }
            else
            {
                //receiptElement = presenter.LoadReceiptXaml(@"modules/mawaqif/pages/receipts/mawaqifreceipt.xaml");
                if (!Transaction.CardPayment)
                    receiptElement = presenter.LoadReceiptXaml(@"modules/mawaqif/pages/receipts/mawaqifreceipt.xaml");
                else
                    receiptElement = presenter.LoadReceiptXaml(@"modules/mawaqif/pages/receipts/mawaqifreceipt_card.xaml");
            }

            receiptPrintingCompleted = false;
            stateTimeoutExceeded = false;

            timer.Tick += PrintReceiptOnRenderComplete;
            timer.Interval = new TimeSpan(0, 0, 0, 0, 10);
            timer.Start();
            Console.WriteLine("{0}: receipt notification presenter loaded.", DateTime.Now);
            using (FileStream stream = new FileStream(@"app001.log", FileMode.Append, FileAccess.Write))
            {
                StreamWriter writer = new StreamWriter(stream);
                writer.WriteLine(string.Format("{0}: receipt notification presenter loaded.", DateTime.Now));
                writer.Flush();
                writer.Close();
            }
            return viewGrid;

            using (FileStream stream = new FileStream(@"app001.log", FileMode.Append, FileAccess.Write))
            {
                StreamWriter writer = new StreamWriter(stream);
                writer.WriteLine(string.Format("{0}: Mawaqif Receipt Load Xaml Completed.", DateTime.Now));
                writer.Flush();
                writer.Close();
            }
        }
        public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
        {
            Trace.WriteLine(string.Format("{0} : Load Xaml Started", DateTime.Now));
            FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);
            //WrapPanel t1 = (WrapPanel)this.ViewGrid.FindName("ModuleSelectionPanel");
            //t1.Loaded += new RoutedEventHandler(OnLoad);
            if (log.IsInfoEnabled) log.Info(string.Format("{0} : Kiosk In Idle Mode.", DateTime.Now.ToString()));
            // Added By JK on 01/09/12
            this.Transaction.KioskMode = 1; // Indicating Idle Mode.
            if (!loggedOn)
            {
                Logon();
                LoadUtilities();
            }
            else
            {
                if (connectivityPolling)
                {
                    //if (isMonitored)
                    RestartConnectivityTimer();

                    if (monitorClient != null)
                        monitorClient.CheckBackendConnectivityCompleted += new EventHandler<CheckBackendConnectivityCompletedEventArgs>(monitorClient_CheckBackendConnectivityCompleted);
                }
                if (shutdownCommandActive)
                    RestartShutdownTimer();

            }
               adminkey = string.Empty;
            //this.Transaction.KioskServices = KioskAppConfig.KioskServices;

            return viewGrid;
        }
        public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, TransactionContextBase transactionContext)
        {
            FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);

            List<int> expectedDenominations = new List<int>();
            foreach (string item in this.State.Denomination.Split(','))
            {
                int denomination = 0;
                if (int.TryParse(item, out denomination))
                {
                    expectedDenominations.Add(denomination);
                }
            }

            stackCommandIssued = false;
            submitButtonPressed = false;
            StateTimerTimedOut = false;
            escrowDenomination = -1;

            MaxAmountReached = false;
            Devices.GetCashAcceptor().CashCycleInitiatedEvent += OnCashCycleInitiated;
            Devices.GetCashAcceptor().CashInsertedEvent += OnCashInserted;
            Devices.GetCashAcceptor().NoteStackedEvent += OnNoteStackedEvent;
            Devices.GetCashAcceptor().NoteReturnedEvent += OnNoteReturnedEvent;
            ////Devices.GetCashAcceptor().CashCycleCompletedEvent += OnCashCycleCompletedEvent;
            //Devices.GetCashAcceptor().EnableAsync(expectedDenominations, Double.Parse(this.Transaction.BalanceDue), false);
            //this.Transaction.CashCycleInProgress = false;
            this.State.MinAmount = 0;
            this.State.MaxAmount = Convert.ToDouble(this.Transaction.BalanceDue);
            this.Transaction.AmountDue = this.Transaction.BalanceDue;

            //if ((this.State.MinAmount == -1) && (this.State.MinAmount == -1))
            //    Devices.GetCashAcceptor().EnableAsync(expectedDenominations, Double.Parse(this.Transaction.BalanceDue), this.State.MinAmount, this.State.MaxAmount, false);
            //else
            //
            Devices.GetCashAcceptor().EnableAsync(expectedDenominations, Double.Parse(this.Transaction.BalanceDue), -2, -2, true);
            return viewGrid;
        }
 public void RefreshShellForNewState(KioskState state)
 {
     this.State = state;
     ViewGrid.BeginInit();
     ViewGrid.DataContext = null;
     ViewGrid.DataContext = this;
     ReevaulateIfCommandsCanExecute();
     ViewGrid.EndInit();
     ViewGrid.UpdateLayout();
 }
        public override FrameworkElement LoadXaml(KioskState state, TransactionContextBase transactionContext)
        {
            RegisterCommands();
            this.TransactionContext = transactionContext;
            this.State = state;
            try
            {
                OnPropertyChanged("BackgroundImagePath");
                FrameworkElement root = LoadXamlFile(state.ShellXamlPath);
                root.BeginInit();
                try
                {
                    root.DataContext = this;
                    ReevaulateIfCommandsCanExecute();
                }
                catch (Exception ex)
                {
                    // KS TODO: Add log messages.
                    throw ex;
                }
                finally
                {
                    root.EndInit();
                    ViewGrid = root;
                    root.UpdateLayout();
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception details: \nSource: {0}\nMessage: {1}\nTrace:", ex.Source, ex.Message, ex.StackTrace);
                throw ex;
            }

            return ViewGrid;
        }