Ejemplo n.º 1
0
 private void MBtnNext_Click(object sender, EventArgs e)
 {
     if (GlobalVariables.mCurrentSelectedPricingType == "RUNR")
     {
         if (GlobalVariables.mHasSelectedCustomerOnCheckout)
         {
             if (!mDialogShown) //avoid double click
             {
                 mDialogShown = true;
                 Intent intent = new Intent(this, typeof(CheckoutFragmentPaymentNumpadActivity));
                 intent.PutExtra("isInitialCall", true);
                 intent.PutExtra("isPaymentModeCash", mIsCashSelectedPaymentMode);
                 intent.PutExtra("totalSaleAmount", mTotalSaleAmount);
                 StartActivityForResult(intent, 24);
             }
         }
         else
         {
             DialogMessageService.MessageBox(this, "No runner selected", "Please select a runner first.");
         }
     }
     else
     {
         if (!mDialogShown)
         {
             mDialogShown = true;
             Intent intent = new Intent(this, typeof(CheckoutFragmentPaymentNumpadActivity));
             intent.PutExtra("isInitialCall", true);
             intent.PutExtra("isPaymentModeCash", mIsCashSelectedPaymentMode);
             intent.PutExtra("totalSaleAmount", mTotalSaleAmount);
             StartActivityForResult(intent, 24);
         }
     }
 }
Ejemplo n.º 2
0
        public override Task <IMarkpadDocument> Publish()
        {
            var save    = new ButtonExtras(ButtonType.Yes, "Save", "Saves this modified post to your blog");
            var saveAs  = new ButtonExtras(ButtonType.No, "Save As", "Saves this blog post as a local markdown file");
            var publish = new ButtonExtras(ButtonType.Retry, "Publish As", "Publishes this post to another blog, or as another post");

            var service = new DialogMessageService(null)
            {
                Icon         = DialogMessageIcon.Question,
                Buttons      = DialogMessageButtons.Yes | DialogMessageButtons.No | DialogMessageButtons.Retry | DialogMessageButtons.Cancel,
                Title        = "Markpad",
                Text         = string.Format("{0} has already been published, what do you want to do?", Title),
                ButtonExtras = new[] { save, saveAs, publish }
            };

            var result = service.Show();

            switch (result)
            {
            case DialogMessageResult.Yes:
                return(Save());

            case DialogMessageResult.No:
                return(SaveAs());

            case DialogMessageResult.Retry:
                return(DocumentFactory.PublishDocument(null, this));
            }

            return(TaskEx.FromResult <IMarkpadDocument>(this));
        }
Ejemplo n.º 3
0
 private void MRlPrinter_Click(object sender, EventArgs e)
 {
     if (!mDialogShown)
     {
         using (var mBluetoothAdapter = BluetoothAdapter.DefaultAdapter)
         {
             if (mBluetoothAdapter == null)
             {
                 DialogMessageService.MessageBox(Context, "Attention", "This device does not support bluetooth");
             }
             else if (mBluetoothAdapter.IsEnabled)
             {
                 mDialogShown  = true;
                 mIsPrinterSet = mSettingsDataAccess.SelectTable()[0].ReceiptPrinterAddress != "";
                 //if there is selected printer, jump to selected printer test print, else jump to printer list
                 if (mIsPrinterSet)
                 {
                     Intent intent = new Intent(Context, typeof(SettingsFragmentSelectedPrinterActivity));
                     StartActivityForResult(intent, 3);
                 }
                 else
                 {
                     Intent intent = new Intent(Context, typeof(SettingsFragmentPrinterListActivity));
                     StartActivityForResult(intent, 3);
                 }
             }
             else
             {
                 DialogMessageService.MessageBox(Context, "Attention", "Please turn on your Bluetooth to connect the printer to your phone.");
             }
         }
     }
 }
 private void TimeListener(object sender, TimePickerDialog.TimeSetEventArgs e)
 {
     if (GetSelectedTime(HourAndMinuteToDateTime(e.HourOfDay, e.Minute).ToString("h:mm tt").ToLower(), mTxtTransactionDate.Text) > DateTime.Now)
     {
         DialogMessageService.MessageBox(this, "Invalid time", "Selected time must not be later than the current time");
     }
     else
     {
         selectedHourOfDay        = e.HourOfDay;
         selectedMinute           = e.Minute;
         mTxtTransactionTime.Text = HourAndMinuteToDateTime(e.HourOfDay, e.Minute).ToString("h:mm tt").ToUpper();
         SetTransactionDateTimeAppearance(false);
     }
 }
 private void MBtnCheckoutButton_Click(object sender, EventArgs e)
 {
     //disable if no items on cart
     if (GlobalVariables.globalProductsOnCart.Count == 0)
     {
         DialogMessageService.MessageBox(Context, "Your cart is empty", "Please add some products to the cart first.");
     }
     else
     {
         GlobalVariables.mIsAllCollapsed = true;
         Intent intent = new Intent(Context, typeof(CheckoutFragmentCartActivity));
         intent.AddFlags(ActivityFlags.NoAnimation);
         StartActivityForResult(intent, 2);
     }
 }
        private bool SizesListEmpty()
        {
            bool retVal;

            if (GlobalVariables.newProductSizesList.Count != 0)
            {
                retVal = false;
            }
            else
            {
                retVal = true;
                DialogMessageService.MessageBox(this, "Incomplete fields", "Please input sizes for this product.");
            }
            return(retVal);
        }
        private bool HasUnpaidSales()
        {
            bool retval = false;

            if (mTransactionsDataAccess.SelectTable().Exists(x => x.CustomerOrRunnerId == mSelectedRunnerRow[0].Id && !x.IsPaid))
            {
                retval = true;
            }
            else
            {
                retval = false;
                DialogMessageService.MessageBox(this.Context, "", "No unpaid transactions");
            }
            return(retval);
        }
Ejemplo n.º 8
0
        private bool HasErrors(decimal _amountReceived, decimal _totalSaleAmount)
        {
            bool retVal = false;

            if (_amountReceived == 0)
            {
                DialogMessageService.MessageBox(this, "", "Please enter an amount.");
                return(true);
            }
            else if (!mIsPaymentModeCash && (_amountReceived > _totalSaleAmount))
            {
                DialogMessageService.MessageBox(this, "", "The amount entered can't exceed the amount to pay.");
                return(true);
            }
            return(retVal);
        }
 private void DateListener(object sender, DatePickerDialog.DateSetEventArgs e)
 {
     if (e.Date > DateTime.Now)
     {
         DialogMessageService.MessageBox(this, "Invalid date", "Selected date must not be later than today");
     }
     else
     {
         selectedCalendarYear         = e.Year;
         selectedCalendarMonth        = e.Month;
         selectedCalendarDayOfMonth   = e.DayOfMonth;
         mTxtTransactionDate.Text     = e.Date.ToString("d/MMM/yyyy").ToUpper();
         mSelectedTransactionDatetime = e.Date;
         SetTransactionDateTimeAppearance(false);
     }
 }
Ejemplo n.º 10
0
        private bool HasErrors()
        {
            bool   retVal       = false;
            string name         = mEtCategory.Text.Trim();
            string label        = isSize ? "size" : "category";
            string selectedName = "";

            if (isEdit)
            {
                selectedName = isSize ? selectedSize.ProductSizeName : selectedCategory.ProductCategoryName;
            }

            if (name == "")
            {
                DialogMessageService.MessageBox(this, "Blank fields", "Please input a " + label + " name.");
                retVal = true;
            }
            else if (!isSize && (mCategoriesDataAccess.NameExists(name.ToUpper()) || name.ToLower() == "All"))
            {
                if (isEdit && name.ToUpper() == selectedName.ToUpper())
                {
                    retVal = false;
                }
                else
                {
                    DialogMessageService.MessageBox(this, "Error", "This " + label + " name already exists.");
                    retVal = true;
                }
            }
            else if (isSize && mSizesDataAccess.NameExists(name))
            {
                if (isEdit && name == selectedName)
                {
                    retVal = false;
                }
                else
                {
                    DialogMessageService.MessageBox(this, "Error", "This " + label + " already exists.");
                    retVal = true;
                }
            }
            else
            {
                retVal = false;
            }
            return(retVal);
        }
Ejemplo n.º 11
0
 private void MBtnPayLater_Click(object sender, EventArgs e)
 {
     if (GlobalVariables.mHasSelectedCustomerOnCheckout)
     {
         if (!mDialogShown) //avoid double click
         {
             mDialogShown = true;
             Intent intent = new Intent(this, typeof(CheckoutFragmentPaymentPayLaterActivity));
             intent.PutExtra("TotalSaleAmount", mTotalSaleAmount);
             StartActivityForResult(intent, 31);
         }
     }
     else
     {
         DialogMessageService.MessageBox(this, "No runner selected", "Please select a runner first.");
     }
 }
 private void MBtnCheckoutMultiAddAddToCart_Click(object sender, EventArgs e)
 {
     mProductHolder = _Adapter.GetUpdatedData();
     if (mProductHolder.Exists(x => x.isSelected == true))
     {
         foreach (var item in mProductHolder.Where(x => x.isSelected == true))
         {
             AddItemsToCart(item.productId, item.quantity, item.productPrice);
         }
         //close view then update total button
         Finish();
     }
     else
     {
         DialogMessageService.MessageBox(this, "No item selected", "Please select item(s) to add to cart.");
     }
 }
Ejemplo n.º 13
0
        private void LoadPrinterList()
        {
            mBluetoothAdapter = BluetoothAdapter.DefaultAdapter;

            if (mBluetoothAdapter == null)
            {
                DialogMessageService.MessageBox(this, "Attention", "This device does not support bluetooth");
            }
            else if (mBluetoothAdapter.IsEnabled)
            {
                mDevices.Clear();
                SetUpBluetooth();
            }
            else
            {
                DialogMessageService.MessageBox(this, "Attention", "Please turn on your Bluetooth to connect the printer to your phone.");
            }
        }
Ejemplo n.º 14
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var             view       = new MainForm();
            IMessageService msgService = new DialogMessageService();

            INeuralNetwork  network = new NeuraNet();
            INetworkManager manager = new NeuraNetFileManager();

            var patternManager = new ImagePatternManager();
            var pattern        = new ImagePattern(7, 5, new SmileyMap());

            var presenter = new RecognizerPresenter(view, msgService, network, manager, patternManager, pattern);

            Application.Run(view);
        }
        private bool hasErrors()
        {
            var    retVal      = false;
            string productName = mTxtInputLayputProductName.EditText.Text.Trim();

            if (productName == "")
            {
                retVal = true;
                mTxtInputLayputProductName.Error = "Product name cannot be blank";
            }
            else if (mParentProductsDataAccess.NameExists(productName))
            {
                if (isEdit)
                {
                    if (mEditTextProductName.Text.Trim() == mSelectedParentProductRow[0].ParentProductName)
                    {
                        retVal = false;
                    }
                    else
                    {
                        retVal = true;
                        mTxtInputLayputProductName.Error = "Product name already exists";
                    }
                }
                else
                {
                    retVal = true;
                    mTxtInputLayputProductName.Error = "Product name already exists";
                }
            }
            else if (mlblCategory.Visibility == ViewStates.Invisible)
            {
                retVal = true;
                mTxtInputLayputProductName.ErrorEnabled = false;
                DialogMessageService.MessageBox(this, "Incomplete fields", "Please select a category.");
            }
            else
            {
                mTxtInputLayputProductName.ErrorEnabled = false;
                retVal = false;
            }
            return(retVal);
        }
Ejemplo n.º 16
0
        private void MListViewPrinters_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            string deviceName    = mDevices[e.Position].deviceName;
            string deviceAddress = mDevices[e.Position].deviceAddress;

            //Toast.MakeText(this, deviceName + " Address is : " + deviceAddress, ToastLength.Long).Show();

            BluetoothDevice selectedDevice = (from bd in mBluetoothAdapter.BondedDevices where bd.Address == deviceAddress select bd).FirstOrDefault();

            if (selectedDevice == null)
            {
                DialogMessageService.MessageBox(this, "Attention", "Please turn on the printer.");
            }

            //show selected printer page
            Intent intent = new Intent(this, typeof(SettingsFragmentSelectedPrinterActivity));

            UpdateSelectedPrinter(deviceName, deviceAddress);
            Finish();
            StartActivity(intent);
        }
 private void MBtnTestPrint_Click(object sender, EventArgs e)
 {
     using (var mBluetoothAdapter = BluetoothAdapter.DefaultAdapter)
     {
         if (mBluetoothAdapter == null)
         {
             DialogMessageService.MessageBox(this, "Attention", "This device does not support bluetooth");
         }
         else if (mBluetoothAdapter.IsEnabled)
         {
             BluetoothDevice     printer             = mBluetoothAdapter.GetRemoteDevice(mSettingsDataAccess.SelectTable()[0].ReceiptPrinterAddress);
             PrintReceiptService printReceiptService = new PrintReceiptService();
             printReceiptService.PrintText(printer, new List <string>()
             {
                 "PRINTER WORKING"
             });
         }
         else
         {
             DialogMessageService.MessageBox(this, "Attention", "Please turn on your Bluetooth to connect the printer to your phone.");
         }
     }
 }
Ejemplo n.º 18
0
        public void SetUpBluetooth()
        {
            if (mBluetoothAdapter == null)
            {
                throw new Exception("No bluetooth Adapter Found");
            }
            if (!mBluetoothAdapter.IsEnabled)
            {
                DialogMessageService.MessageBox(this, "Attention", "Please turn on the bluetooth");
            }

            foreach (var bd in mBluetoothAdapter.BondedDevices)
            {
                mDevices.Add(new ConnectedBluetoothDevice()
                {
                    deviceName = bd.Name, deviceAddress = bd.Address
                });
            }

            BluetoothDevicesListViewAdapter adapter = new BluetoothDevicesListViewAdapter(this, mDevices);

            mListViewPrinters.Adapter = adapter;
        }