Пример #1
0
        public async Task LoadImageOnInkCanvas()
        {
            try
            {
                var inkCanvas = FindChild <InkCanvas>(null, "inkCanvas");

                if (inkCanvas == null)
                {
                    return;
                }

                var filePath = await StorageFile.GetFileFromApplicationUriAsync(new Uri(_signatureFilePath));

                if (filePath != null)
                {
                    try
                    {
                        using (IRandomAccessStream stream = await filePath.OpenReadAsync())
                        {
                            await inkCanvas.InkPresenter.StrokeContainer.LoadAsync(stream);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Info(ex.Message, ex);
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Info(ex.Message, ex);
            }
        }
Пример #2
0
 public LineDisplay(string portNumber)
 {
     try
     {
         _lineDisplay = new LineDisplayServer(portNumber);
     }
     catch (Exception ex)
     {
         _log.Info(ex.Message, ex);
         throw new LineDisplayException("No Customer Display Available!");
     }
 }
Пример #3
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            var myGrid = (DataGrid)this.FindName("GridSale");

            myGrid.Visibility = Visibility.Visible;

            var endTime = DateTime.Now;

            _log.Info("------------==========================--------------------------");
            _log.Info(string.Format("Time taken in Sale Grid loading is {0}ms ", (endTime - _startTime).TotalMilliseconds));
            _log.Info("------------==========================--------------------------");
        }
Пример #4
0
 public OPOSLineDisplay(string deviceName)
 {
     try
     {
         _lineDisplay = new OPOSLineDisplayServer(deviceName);
     }
     catch (Exception ex)
     {
         _log.Info(ex.Message, ex);
         throw new LineDisplayException("No Customer Display Available!");
     }
 }
Пример #5
0
 public void PlaySoundFile(SoundTypes fileName, string fileNumber)
 {
     try
     {
         var file = GetFileWithFileNumber(fileName, fileNumber);
         SetFileToMediaElement(file);
     }
     catch (Exception ex)
     {
         _log.Info(ex.Message);
     }
 }
Пример #6
0
        private async void SetLoginPolicy()
        {
            LoadingService.ShowLoadingStatus(true);
            var startTime = DateTime.Now;

            _log.Info("SetLoginPolicy method call started");
            try
            {
                CacheBusinessLogic.IpAddress = GetLocalIp();
                var loginPolicy = await _loginBussinessLogic.GetLoginPolicyAsync();

                var registerNumber = await new Helper().GetRegisterNumber();
                CacheBusinessLogic.RegisterNumber = (byte)registerNumber;
                NavigateService.Instance.NavigateToLogin();
            }
            catch (InternalServerException ex)
            {
                ShowNotification(ex.Error.Message, ShutDownApplication, ShutDownApplication, ApplicationConstants.ButtonWarningColor);
            }
            catch (ApiDataException ex)
            {
                _log.Warn(ex);
                ShowNotification(ex.Error.Message, ShutDownApplication, ShutDownApplication
                                 , ApplicationConstants.ButtonWarningColor);
            }
            catch (NullReferenceException ex)
            {
                _log.Warn(ex);

                ShowNotification(ApplicationConstants.ApiNotConnected, ShutDownApplication, ShutDownApplication,
                                 ApplicationConstants.ButtonWarningColor);
            }
            catch (ArgumentException ex)
            {
                _log.Warn(ex);

                ShowNotification(ApplicationConstants.LanguageNotSupported, ShutDownApplication, ShutDownApplication,
                                 ApplicationConstants.ButtonWarningColor);
            }
            catch (Exception ex)
            {
                _log.Warn(ex);
                ShowNotification(ApplicationConstants.SomethingBadHappned, ShutDownApplication, ShutDownApplication,
                                 ApplicationConstants.ButtonWarningColor);
            }
            finally
            {
                LoadingService.ShowLoadingStatus(false);
                var endTime = DateTime.Now;
                _log.Info(string.Format("Time Taken In Login Page is {0}ms", (endTime - startTime).TotalMilliseconds));
            }
        }
Пример #7
0
        /// <summary>
        /// Call this function to perform work of this task
        /// </summary>
        /// <returns></returns>
        public async Task Perform()
        {
            AttemptCount++;
            ResponseValue = null;

            _log.Info(string.Format("Performing {0} Attempt={1}", Name, AttemptCount));

            ResponseValue = await OnPerform();
        }
Пример #8
0
 private static InitalizeFuelPumpContract DeseralizePumpStatus(string pumpStatus)
 {
     _log.Info("Deseralizing pump message");
     InitalizeFuelPumpContract fuelPumpsContract;
     var bytes = Encoding.Unicode.GetBytes(pumpStatus);
     using (var stream = new MemoryStream(bytes))
     {
         var serializer = new DataContractJsonSerializer(typeof(InitalizeFuelPumpContract));
         fuelPumpsContract = (InitalizeFuelPumpContract)serializer.ReadObject(stream);
     }
     return fuelPumpsContract;
 }
Пример #9
0
 public OPOSCashDrawer(string deviceName)
 {
     try
     {
         _cashDrawer = new OPOSCashDrawerServer(deviceName);
     }
     catch (Exception ex)
     {
         _log.Info(ex.Message, ex);
         throw new CashDrawerException("No Cash Drawer Available!");
     }
 }
Пример #10
0
        public async Task <HttpResponseMessage> GetAsync(string url, string authToken = null)
        {
            _log.Info(string.Format("Making HTTP GET Request to: {0}", url));
            _tracker.Restart();
            var client = GenerateClient();

            using (client)
            {
                SetAuthToken(client, authToken);
                var response = await client.GetAsync(url);

                _log.Info(string.Format("HTTP GET Response from URL: {0}", url));
                var data = await response.Content.ReadAsStringAsync();

                _log.Info(data);
                _tracker.Stop();
                _log.Info(string.Format("Duration Of API {0} is {1}ms", url, _tracker.Elapsed.TotalMilliseconds));
                return(response);
            };
        }
Пример #11
0
        internal void ResetLogin()
        {
            var startTime = DateTime.Now;

            _log.Info("ResetLogin method call started");
            LoginModel.UserName = string.Empty;
            LoginModel.Password = string.Empty;
            LoginModel.TillNumbers?.Clear();
            LoginModel.Shifts?.Clear();
            Shifts?.Clear();
            IsUserNameEnabled = true;
            IsPasswordEnabled = true;

            var endTime = DateTime.Now;

            _log.Info(string.Format("ResetLogin method call ended in {0}ms",
                                    (endTime - startTime).TotalMilliseconds));
        }
Пример #12
0
 private void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
 {
     _log.Info("Unhandled Exception", e.Exception);
 }
Пример #13
0
 public void ReleasePrinter()
 {
     VMBase.OposPrinter?.Dispose();
     VMBase.OposPrinter = null;
     _log.Info("Releasing the printer is done");
 }