Ejemplo n.º 1
0
 public void DropInInteractive(FillingRobber fillingRobber)
 {
     fillingRobber.RobbersSound.InsideInteractive();
     fillingRobber.RobbersSound.PlayTimerAudio(true);
     Vibration.Vibrate(100);
 }
        private async Task <bool> GetItems(string code)
        {
            if (await RemoveAllOld(code))
            {
                if (Connectivity.NetworkAccess == NetworkAccess.Internet)
                {
                    RestSharp.RestClient client = new RestSharp.RestClient();
                    string path = "GetDocument";
                    client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path);
                    {
                        string str     = $"GET?qrystr=ACCHISTL|6|{code}|102|" + GoodsRecieveingApp.MainPage.UserCode;
                        var    Request = new RestSharp.RestRequest();
                        Request.Resource = str;
                        Request.Method   = RestSharp.Method.GET;
                        var cancellationTokenSource = new CancellationTokenSource();
                        var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token);

                        if (res.Content.ToString().Contains("DocNum"))
                        {
                            if (!firstSO)
                            {
                                if (!await PalletAddSO())
                                {
                                    return(false);
                                }
                            }
                            await GoodsRecieveingApp.App.Database.DeleteSpecificDocs(code);

                            DataSet myds = new DataSet();
                            myds = Newtonsoft.Json.JsonConvert.DeserializeObject <DataSet>(res.Content);
                            foreach (DataRow row in myds.Tables[0].Rows)
                            {
                                try
                                {
                                    var Doc = new DocLine();
                                    Doc.DocNum       = row["DocNum"].ToString();
                                    Doc.SupplierCode = row["SupplierCode"].ToString();
                                    Doc.SupplierName = row["SupplierName"].ToString();
                                    Doc.ItemBarcode  = row["ItemBarcode"].ToString();
                                    Doc.ItemCode     = row["ItemCode"].ToString();
                                    Doc.ItemDesc     = row["ItemDesc"].ToString();
                                    Doc.Bin          = row["Bin"].ToString();
                                    try
                                    {
                                        Doc.ScanAccQty = Convert.ToInt32(row["ScanAccQty"].ToString().Trim());
                                    }
                                    catch
                                    {
                                        Doc.ScanAccQty = 0;
                                    }
                                    Doc.ScanRejQty = 0;
                                    try
                                    {
                                        Doc.PalletNum = Convert.ToInt32(row["PalletNumber"].ToString().Trim());
                                    }
                                    catch
                                    {
                                        Doc.PalletNum = 0;
                                    }
                                    currentPallet   = Doc.PalletNum;
                                    Doc.ItemQty     = Convert.ToInt32(row["ItemQty"].ToString().Trim());
                                    lblCode.Text    = Doc.DocNum;
                                    lblCusName.Text = Doc.SupplierName;
                                    await GoodsRecieveingApp.App.Database.Insert(Doc);
                                }
                                catch (Exception)
                                {
                                    LodingIndiactor.IsVisible = false;
                                    Vibration.Vibrate();
                                    message.DisplayMessage("Error In Server!!", true);
                                    return(false);
                                }
                            }
                            return(true);
                        }
                        else
                        {
                            LodingIndiactor.IsVisible = false;
                            Vibration.Vibrate();
                            message.DisplayMessage("Error Invalid SO Code!!", true);
                        }
                    }
                }
                else
                {
                    LodingIndiactor.IsVisible = false;
                    Vibration.Vibrate();
                    message.DisplayMessage("Internet Connection Problem!", true);
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        internal void CheckForNfcMessage(Intent intent)
        {
            if (!Enabled)
            {
                return;
            }

            if (intent.Action != NfcAdapter.ActionTechDiscovered)
            {
                return;
            }

            if (!(intent.GetParcelableExtra(NfcAdapter.ExtraTag) is Tag tag))
            {
                return;
            }

            try
            {
                var ev1 = MifareUltralight.Get(tag);

                //TagDetected?.Invoke(tag);

                ev1.Connect();
                byte[] FirstTag = MainTabViewModel.Current?.DataBag.GetData();
                byte[] mem      = new byte[80];

                for (int i = 0; i < 20; i += 4)
                {
                    byte[] payload = ev1.ReadPages(i);
                    Buffer.BlockCopy(payload, 0, mem, 4 * i, 16);
                }

                if (WriteMode)
                {
                    byte[] dstData = MainTabViewModel.MergeTagData(FirstTag, mem);


                    // password auth
                    // var response = ev1.Transceive(new byte[]{
                    //            (byte) 0x1B, // PWD_AUTH
                    //            0,0,0,0 });

                    // Check if PACK is matching expected PACK
                    // This is a (not that) secure method to check if tag is genuine
                    //if ((response != null) && (response.Length >= 2))
                    //{
                    //}

                    for (int i = 4; i < 16; i++)
                    {
                        ev1.WritePage(i, dstData.Skip(4 * i).Take(4).ToArray());
                    }

                    MainTabViewModel.Current?.DataBag.SetData(dstData);
                    WriteMode = false;
                }
                else
                {
                    MainTabViewModel.Current?.SetControlsVisibility(mem[41]);
                    MainTabViewModel.Current?.DataBag.SetData(mem);
                }
                ev1.Close();
                MainTabViewModel.Current.cbNFCRead  = false;
                MainTabViewModel.Current.cbNFCWrite = false;

                try
                {
                    // Use default vibration length
                    Vibration.Vibrate();
                }
                catch (FeatureNotSupportedException ex)
                {
                    // Feature not supported on device
                }
                catch (Exception ex)
                {
                    // Other error has occurred.
                }
            }
            catch (Exception e)
            {
                try
                {
                    Vibration.Vibrate();
                    Thread.Sleep(1000);
                    Vibration.Vibrate();
                }
                catch (Exception ex)
                {
                    // Other error has occurred.
                }
            }
        }
Ejemplo n.º 4
0
        async Task <bool> GetItems()
        {
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                RestClient client = new RestClient();
                string     path   = "Inventory";
                client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path);
                {
                    string str     = $"GET?CountIDNum={countID}";
                    var    Request = new RestRequest(str, Method.GET);
                    var    cancellationTokenSource = new CancellationTokenSource();
                    var    res = await client.ExecuteAsync(Request, cancellationTokenSource.Token);

                    if (res.IsSuccessful && res.Content.Contains("CountID"))
                    {
                        items.Clear();
                        DataSet myds = new DataSet();
                        myds = Newtonsoft.Json.JsonConvert.DeserializeObject <DataSet>(res.Content);
                        foreach (DataRow row in myds.Tables[0].Rows)
                        {
                            InventoryItem i1 = new InventoryItem();
                            i1.CountID  = countID;
                            i1.ItemDesc = row["ItemDesc"].ToString();
                            i1.BarCode  = row["BarCode"].ToString();
                            i1.ItemCode = row["ItemCode"].ToString();
                            i1.Bin      = row["Bin"].ToString();
                            i1.isFirst  = Convert.ToBoolean(row["isFirst"].ToString());
                            i1.Complete = Convert.ToBoolean(row["Complete"].ToString());
                            try
                            {
                                i1.FirstScanQty = Convert.ToInt32(row["FirstScanQty"].ToString());
                            }
                            catch
                            {
                                i1.FirstScanQty = 0;
                            }
                            try
                            {
                                i1.SecondScanQty = Convert.ToInt32(row["SecondScanQty"].ToString());
                            }
                            catch
                            {
                                i1.SecondScanQty = 0;
                            }
                            try
                            {
                                i1.CountUser = Convert.ToInt32(row["CountUser"].ToString());;
                            }
                            catch
                            {
                                i1.CountUser = 0;
                            }
                            try
                            {
                                i1.SecondScanAuth = Convert.ToInt32(row["SecondScanAuth"].ToString());;
                            }
                            catch
                            {
                                i1.SecondScanAuth = 0;
                            }
                            items.Add(i1);
                        }
                        return(true);
                    }
                }
            }
            else
            {
                Vibration.Vibrate();
                message.DisplayMessage("Please connect to the internet", true);
                return(false);
            }
            return(false);
        }
 private void Button_Clicked(object sender, EventArgs e)
 {
     Vibration.Vibrate(TimeSpan.FromSeconds(1));
 }
Ejemplo n.º 6
0
        internal void Salvage()
        {
            State = WreckageState.SALVAGING;
            var mAircraft  = MiddleAircraft;
            var totalScale = mAircraft.GetTotalScale();

            mAircraft.Visible = false;
            List <Part> totalparts = mAircraft.TotalParts;

            // unmount and disassemble
            mAircraft.Body = null;
            foreach (var part in totalparts)
            {
                part.Disassemble();
                foreach (var singlePart in totalparts)
                {
                    if (singlePart.Flipped)
                    {
                        singlePart.Flip();
                    }
                }
                // repair the part fully
                part.Reinitialize();
            }
            // choose the parts that will be salvaged
            SalvagedParts = new List <Part>();
            // how many?
            var rng          = new Random();
            int salvageCount = (int)(GetWreckPercentile(mAircraft) * totalparts.Count());

            if (salvageCount != totalparts.Count() && rng.NextDouble() <= (GetWreckPercentile(mAircraft) * totalparts.Count()) % 1)
            {
                salvageCount++;
            }
            // choose random parts
            for (int i = 0; i < salvageCount; i++)
            {
                var index = rng.Next(totalparts.Count());
                SalvagedParts.Add(totalparts.ElementAt(index));
                totalparts.RemoveAt(index);
            }
            float delay    = SalvagedParts.Count * SalvagedParts.Count * 150 + 100;
            float delaySec = delay / 1000;

            // vibrate
            if (Constants.oS != Constants.OS.WINDOWS)
            {
                Vibration.Vibrate(delay * 0.015f);
            }
            // visualize
            var     boundsCenter = VisibleBoundsWorldspace.Center;
            CCPoint pointIn      = boundsCenter + new CCPoint(0, VisibleBoundsWorldspace.Size.Height * 0.6f);
            var     width        = VisibleBoundsWorldspace.Size.Width / 3;
            float   inMoveTime   = 1f;
            Dictionary <Part, CCPoint> destinations = new Dictionary <Part, CCPoint>();

            foreach (var part in SalvagedParts)
            {
                part.Visible = true;
                AddChild(part, -10);
                part.AnchorPoint = CCPoint.AnchorMiddle;
                var rotation = new CCRepeatForever(new CCRotateBy(1, rng.Next(20, 30) * 0.5f));
                rotation.Tag = RotationTag;
                part.AddAction(rotation);
                // find a free spot
                part.Scale = totalScale;
                const float BORDER   = 32f;
                bool        notFound = true;
                // first try to find a free space where the part can rotate without touching anything
                for (int tries = 0; tries < 40 && notFound; tries++)
                {
                    destinations[part] = Constants.RandomPointBoxnear(boundsCenter, width, rng);
                    // check whether the space is free
                    part.Position = destinations[part];
                    CCRect bbox = part.BoundingBoxTransformedToWorld;
                    // construct a bounding square
                    float size = bbox.Size.Height > bbox.Size.Width ? bbox.Size.Height : bbox.Size.Width;
                    bbox = new CCRect(bbox.Center.X - size / 2, bbox.Center.Y - size / 2, size, size);
                    // add a bit of padding
                    CCRect box = new CCRect(bbox.MinX - BORDER, bbox.MinY - BORDER, bbox.Size.Width + 2 * BORDER, bbox.Size.Height + 2 * BORDER);
                    notFound = false;
                    foreach (var otherPart in SalvagedParts)
                    {
                        if (otherPart == part)
                        {
                            continue;
                        }
                        if (box.IntersectsRect(otherPart.BoundingBoxTransformedToWorld))
                        {
                            notFound = true;
                            break;
                        }
                    }
                }
                // if this failed try to find a free space where the parts at least do not touch in starting configuration
                for (int tries = 0; tries < 40 && notFound; tries++)
                {
                    destinations[part] = Constants.RandomPointBoxnear(boundsCenter, width, rng);
                    // check whether the space is free
                    part.Position = destinations[part];
                    CCRect bbox = part.BoundingBoxTransformedToWorld;
                    // add a bit of padding
                    CCRect box = new CCRect(bbox.MinX - BORDER, bbox.MinY - BORDER, bbox.Size.Width + 2 * BORDER, bbox.Size.Height + 2 * BORDER);
                    notFound = false;
                    foreach (var otherPart in SalvagedParts)
                    {
                        if (otherPart == part)
                        {
                            continue;
                        }
                        if (box.IntersectsRect(otherPart.BoundingBoxTransformedToWorld))
                        {
                            notFound = true;
                            break;
                        }
                    }
                }
            }
            foreach (var part in SalvagedParts)
            {
                part.Position = pointIn;
                part.AddAction(new CCSequence(new CCDelayTime(delaySec), new CCEaseOut(new CCMoveTo(inMoveTime, destinations[part]), 2f)));
            }
            // count down the percentage
            float   startP       = GetWreckPercentile(mAircraft);
            CCLabel percentLabel = GetPercentLabel(mAircraft);

            AddAction(new CCSequence(new CCEaseIn(new CCCallFiniteTimeFunc(delaySec, (progress, duration) => { SetWreckPercentile(mAircraft, startP * (1 - progress)); }), 4f), new CCCallFunc(() => { percentLabel.Visible = false; })));
            // if no parts could be salvaged end the salvaged state immediately
            if (!SalvagedParts.Any())
            {
                AddAction(new CCSequence(new CCDelayTime(delaySec + inMoveTime), new CCCallFunc(() => { State = WreckageState.SALVAGED; EndSalvage(); })));
            }
            else
            {
                AddAction(new CCSequence(new CCDelayTime(delaySec + inMoveTime), new CCCallFunc(() => { State = WreckageState.SALVAGED; })));
            }
        }
Ejemplo n.º 7
0
        private async void txfItemCode_Completed(object sender, EventArgs e)
        {
            LoadingIndicator.IsVisible = true;
            if (txfItemCode.Text.Length > 10)
            {
                if (items.Where(x => x.BarCode == txfItemCode.Text && x.Complete == false).FirstOrDefault() != null)
                {
                    int CUSTQTY = 1;
                    if (InvLandingPage.CustQty)
                    {
                        string result = await DisplayPromptAsync("Custom QTY", "Enter QTY of SINGLE units", "OK", "Cancel", keyboard : Keyboard.Numeric);

                        switch (result)
                        {
                        case "Cancel":
                            Vibration.Vibrate();
                            message.DisplayMessage("You have to enter a QTY", true);
                            txfItemCode.Text           = "";
                            LoadingIndicator.IsVisible = false;
                            txfItemCode.Focus();
                            return;

                        default:
                            try
                            {
                                CUSTQTY = Convert.ToInt32(result);
                            }
                            catch
                            {
                                Vibration.Vibrate();
                                message.DisplayMessage("Please enter a valid QTY", true);
                                txfItemCode.Text           = "";
                                LoadingIndicator.IsVisible = false;
                                txfItemCode.Focus();
                                return;
                            }
                            break;
                        }
                    }
                    SameItemCheck(items.Where(x => x.BarCode == txfItemCode.Text).First().ItemCode);
                    CurrentQTYCounted += CUSTQTY;
                    Setlbl(items.Where(x => x.BarCode == txfItemCode.Text).First().ItemDesc);
                    if (!RefreshList())
                    {
                        Vibration.Vibrate();
                        message.DisplayMessage("Could Not Refresh The List", true);
                        txfItemCode.Text           = "";
                        LoadingIndicator.IsVisible = false;
                        txfItemCode.Focus();
                        return;
                    }
                }
                else
                {
                    Vibration.Vibrate();
                    message.DisplayMessage("No item found or scanning complete for this item", true);
                    txfItemCode.Text           = "";
                    LoadingIndicator.IsVisible = false;
                    txfItemCode.Focus();
                    return;
                }
            }
            else if (txfItemCode.Text.Length > 7 && !InvLandingPage.CustQty)
            {
                BOMItem bi = new BOMItem();
                try
                {
                    bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfItemCode.Text);
                }
                catch
                {
                    Vibration.Vibrate();
                    message.DisplayMessage("Error! No Item with this code", true);
                    txfItemCode.Text           = "";
                    LoadingIndicator.IsVisible = false;
                    txfItemCode.Focus();
                    return;
                }
                if (items.Where(x => x.ItemCode == bi.ItemCode && x.Complete == false).FirstOrDefault() != null)
                {
                    SameItemCheck(bi.ItemCode);
                    CurrentQTYCounted += bi.Qty;
                    Setlbl(items.Where(x => x.ItemCode == bi.ItemCode).First().ItemDesc);
                    if (!RefreshList())
                    {
                        Vibration.Vibrate();
                        message.DisplayMessage("Could Not Refresh The List", true);
                        txfItemCode.Text           = "";
                        LoadingIndicator.IsVisible = false;
                        txfItemCode.Focus();
                        return;
                    }
                }
                else
                {
                    Vibration.Vibrate();
                    message.DisplayMessage("No item found or scanning complete for this item", true);
                    txfItemCode.Text           = "";
                    LoadingIndicator.IsVisible = false;
                    txfItemCode.Focus();
                    return;
                }
            }
            else if (InvLandingPage.CustQty && (txfItemCode.Text.Length == 8 || txfItemCode.Text.Length == 9))
            {
                Vibration.Vibrate();
                message.DisplayMessage("You cannot add a pack to a custom Qty scan", true);
            }
            txfItemCode.Text           = "";
            LoadingIndicator.IsVisible = false;
            txfItemCode.Focus();
        }
 // Update is called once per frame
 public void RequestQuit()
 {
     Vibration.Vibrate(35);
     Application.Quit();
 }
Ejemplo n.º 9
0
        public MainPageViewModel()
        {
            FirebaseHelper firebaseHelper = new FirebaseHelper();

            AllNotes     = new ObservableCollection <string>();
            EraseCommand = new Command(() =>
            {
                TheNote = string.Empty;
            });

            SaveCommand = new Command(async() =>
            {
                Console.WriteLine("Hello" + _theNote);
                await firebaseHelper.AddNote(_theNote);
                var allNotes = await firebaseHelper.GetAllNotes();
                Console.WriteLine("Hello" + allNotes);
                // AllNotes.Add(allNotes.ToString());
                Console.WriteLine(allNotes.Capacity);
                for (int i = 0; i < allNotes.Count; i++)
                {
                    if (i == allNotes.Capacity - 1)
                    {
                        AllNotes.Add(allNotes[i].TheNote);
                        Console.WriteLine("Hello " + allNotes[i].TheNote);
                    }
                }
                TheNote = string.Empty;
            });
            GetAll = new Command(async() =>
            {
                var allNotes = await firebaseHelper.GetAllNotes();
                for (int i = 0; i < allNotes.Count; i++)
                {
                    if (AllNotes.Count < allNotes.Count)
                    {
                        AllNotes.Add(allNotes[i].TheNote);
                        Console.WriteLine("Hello " + allNotes[i].TheNote);
                    }
                }
            });



            /*
             * AllNotes.Add(TheNote);
             *
             * TheNote = string.Empty;
             *
             *
             *
             * async void saveCommand(object sender, EventArgs e)
             * {
             * await _firebaseHelper.AddNote(_theNote);
             * _theNote = string.Empty;
             * var allNotes = await _firebaseHelper.GetAllNotes();
             * AllNotes.Add(allNotes.ToString());
             * }*/

            VibrateOn = new Command(() =>
            {
                if (_sliderTime != 0)
                {
                    Vibration.Vibrate(TimeSpan.FromMilliseconds(_sliderTime));
                }
            });
            VibrateOff = new Command(() =>
            {
                Vibration.Cancel();
            });
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 确认消息
 /// </summary>
 public static async Task <bool> ConfirmVibrantly(string message, string title = null, int vibratedDuration = 500, CancellationToken?cancelToken = null)
 {
     Vibration.Vibrate(vibratedDuration);
     return(await UserDialogs.Instance.ConfirmAsync(message, title, "确定", "取消", cancelToken));
 }
Ejemplo n.º 11
0
        private async void SearchBar_SearchButtonPressed(object sender, EventArgs e)
        {
            await Task.Yield();

            activityIndicator.IsVisible = true;

            activityIndicator.IsRunning = true;

            MoviesList.IsVisible = false;

            var key = ((SearchBar)sender).Text;

            if (key == "")
            {
                DependencyService.Get <IToast>().LongAlert("The name can't be empty");

                await SpeakNow("The name can't be empty");

                return;
            }

            //Verify if internet connection is available
            if (Connectivity.NetworkAccess == NetworkAccess.None || Connectivity.NetworkAccess == NetworkAccess.Unknown)
            {
                Device.StartTimer(TimeSpan.FromSeconds(3), () =>
                {
                    DependencyService.Get <IToast>().LongAlert("Please be sure that your device has an Internet connection");
                    return(false);
                });
                return;
            }

            await MainThread.InvokeOnMainThreadAsync(async() =>
            {
                try
                {
                    if (key != "")
                    {
                        var movie_results = await Locator.Current.GetService <ApiClient>().SearchMovieByName(key);

                        if (movie_results.Results.Count != 0)
                        {
                            vm.AllMoviesList.Clear();

                            foreach (var MovieResult in movie_results.Results)
                            {
                                if (MovieResult.BackdropPath != null)
                                {
                                    vm.AllMoviesList.Add(MovieResult);
                                }
                            }

                            BindingContext = vm;

                            MoviesList.IsVisible = true;

                            MoviesList.ItemsSource = vm.AllMoviesList;

                            await MoviesList.TranslateTo(0, 0, 500, Easing.SpringIn);

                            activityIndicator.IsVisible = false;

                            activityIndicator.IsRunning = false;

                            //await SpeakNow("Search completed");
                        }
                        else
                        {
                            MoviesList.ItemsSource = null;

                            activityIndicator.IsVisible = false;

                            activityIndicator.IsRunning = false;

                            MoviesList.IsVisible = true;

                            DependencyService.Get <IToast>().LongAlert("It seems like that movie doesn't exists, check your spelling!");

                            //await SpeakNow("It seems like that movie doesn't exists, check your spelling!");

                            Vibration.Vibrate();
                        }
                    }
                }
                catch (Exception e3)
                {
                    Debug.WriteLine("Error: " + e3.InnerException);
                }
            });
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 警告消息
 /// </summary>
 /// <remarks>带振动</remarks>
 public static async Task AlertVibrantly(string message, string title = null, int vibratedDuration = 500, CancellationToken?cancelToken = null)
 {
     Vibration.Vibrate(vibratedDuration);
     await UserDialogs.Instance.AlertAsync(message, title, "确定", cancelToken);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 提示消息
 /// </summary>
 /// <remarks>带振动</remarks>
 public static void ToastVibrantly(string title, TimeSpan?dismissTimer = null, int vibratedDuration = 500)
 {
     Vibration.Vibrate(vibratedDuration);
     UserDialogs.Instance.Toast(title, dismissTimer);
 }
Ejemplo n.º 14
0
 /* pulsation */
 private void VPulse()
 {
     Vibration.Vibrate(30);
 }
Ejemplo n.º 15
0
        public void OnPointerDown(PointerEventData eventData)
        {
            if (!held)
            {
                held = true;
                SX   = SY = 0;
                Vibration.Vibrate(50);
                //Debug.Log("JFIDOAWJDIOWA");
                // When we press, we first want to snap the joystick to the user's finger
                if (SnapsToFinger)
                {
                    CurrentEventCamera = eventData.pressEventCamera ?? CurrentEventCamera;

                    Vector3 localStickPosition;
                    Vector3 localBasePosition;
                    RectTransformUtility.ScreenPointToWorldPointInRectangle(_stickTransform, eventData.position,
                                                                            CurrentEventCamera, out localStickPosition);
                    RectTransformUtility.ScreenPointToWorldPointInRectangle(_baseTransform, eventData.position,
                                                                            CurrentEventCamera, out localBasePosition);

                    float newX = localBasePosition.x;
                    float newY = localBasePosition.y;


                    if ((!swapped && localBasePosition.x < xClamp) || (swapped && localBasePosition.x > xClamp))
                    {
                        newX = xClamp;
                        //Debug.Log("CLAMPED");
                    }
                    if (localBasePosition.y > yTopClamp)
                    {
                        newY = yTopClamp;
                        //Debug.Log("CLAMPED");
                    }
                    if (localBasePosition.y < yBotClamp)
                    {
                        newY = yBotClamp;
                        //Debug.Log("CLAMPED");
                    }
                    //Debug.Log(GetComponent<RectTransform>().rect.height);

                    _baseTransform.position    = new Vector3(newX, newY, 0);
                    _stickTransform.position   = new Vector3(newX, newY, 0);
                    _intermediateStickPosition = _stickTransform.anchoredPosition;

                    OnDrag(eventData);
                }
                else
                {
                    OnDrag(eventData);
                }
                // We also want to show it if we specified that behaviour
                if (HideOnRelease)
                {
                    Hide(false);
                }
            }


            //afk manager-
            onTouchAction();
        }
Ejemplo n.º 16
0
        private async void ConfirmBtn_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (ContactNoEntry.Text == null)
                {
                    // Use default vibration length
                    Vibration.Vibrate();
                    codeFrame.BorderColor = Color.Red;
                    codeFrameshakeAnimation();
                }
                else
                {
                    string code = ContactNoEntry.Text.Replace(" ", "").Trim();
                    if (code.Length < 6)
                    {
                        Vibration.Vibrate();
                        codeFrame.BorderColor = Color.Red;
                        codeFrameshakeAnimation();
                        ContactNoEntry.Text = null;
                    }
                    else
                    {
                        request.ClientId         = Constants.ClientId;
                        request.CustomerId       = Constants.cutomerAuthContext.CustomerId;
                        request.Email            = Constants.cutomerAuthContext.CustomerEmail;
                        request.ConfirmationCode = code;

                        bool busy = false;
                        if (!busy)
                        {
                            try
                            {
                                busy = true;
                                await PopupNavigation.Instance.PushAsync(new LoadingPopup("Loading details..."));

                                await Task.Run(async() =>
                                {
                                    try
                                    {
                                        response = checkConfirmEmailAddress(request);
                                    }
                                    catch (Exception ex)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup(ex.Message));
                                    }
                                });
                            }
                            finally
                            {
                                busy = false;
                                if (PopupNavigation.Instance.PopupStack.Count == 1)
                                {
                                    await PopupNavigation.Instance.PopAllAsync();
                                }
                                if (PopupNavigation.Instance.PopupStack.Count > 1)
                                {
                                    if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                                    {
                                        await PopupNavigation.Instance.PopAllAsync();
                                    }
                                }
                                if (response != null)
                                {
                                    if (response.refId == 1)
                                    {
                                        if (App.Current.Properties.ContainsKey("CustomerId"))
                                        {
                                            App.Current.Properties["CustomerId"] = customerId;
                                        }
                                        else
                                        {
                                            App.Current.Properties.Add("CustomerId", customerId);
                                        }
                                        if (fromVal == 1)
                                        {
                                            await Navigation.PushModalAsync(new EmailonfirmSuccess(confirmationType, fromVal));
                                        }
                                        else
                                        {
                                            await Navigation.PushModalAsync(new EmailonfirmSuccess(confirmationType));
                                        }
                                    }
                                    else if (response.refId == 2)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, your confirmation code was expired. Please resend code. "));
                                    }
                                    else
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Invalid confirmation code"));
                                    }
                                }
                                else
                                {
                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Something went wrong, Please try again."));
                                }
                            }
                        }
                    }
                }
            }
            catch (FeatureNotSupportedException ex)
            {
                // Feature not supported on device
            }
            catch (Exception ex)
            {
                // Other error has occurred.
            }
            //Navigation.PushAsync(new EmailonfirmSuccess());
        }
Ejemplo n.º 17
0
    void Jump()
    {
        if (tr.position.y >= 0.7f)
        {
            //stayEnd = false;
            return;
        }

        if (isJumping == true)
        {
            isJumping = false;
            SoundManager.Instance.PlaySound(eSound.Jump, 0);
            //SoundManager.Instance.PlaySound(eSound.Jump.ToString(), false, GameManager.Instance.AudioVolume);
            gage -= 10;
            GameManager.Instance.SetGagebar(gage / 100);

            if (firstJump == true)
            {
                currJumpPower = jumpPower;
                rigid.AddForce((Vector3.up * upPower + Vector3.forward * forwardPower) * currJumpPower, ForceMode.Impulse);
                firstJump = false;
                StartCoroutine("cor_FirstJump");
                return;
            }

            if (tr.position.y >= 0.4f)
            {
                currJumpPower = jumpPower * 0.9f;
                upPower      *= 0.97f;
                GameManager.Instance.SetJudgement(eJudgement.Excellent);
                // 진동
                if (GameManager.Instance.IsVibration == true)
                {
                    Vibration.Vibrate(GameManager.Instance.vibrationValue);
                }
            }
            else if (tr.position.y >= -0.1f)
            {
                currJumpPower = jumpPower * 0.8f;
                upPower      *= 0.9f;
                GameManager.Instance.SetJudgement(eJudgement.Good);
                // 진동
                if (GameManager.Instance.IsVibration == true)
                {
                    Vibration.Vibrate((int)(GameManager.Instance.vibrationValue * 0.5f));
                }
            }
            else
            {
                GameManager.Instance.SetJudgement(eJudgement.Fail);
                StartCoroutine(GameManager.Instance.GameOver());
                return;
            }


            if (jumpCount < 2)
            {
                jumpCount++;
            }

            rigid.velocity = new Vector3(0, 0, 0);
            rigid.AddForce((Vector3.up * upPower + Vector3.forward * forwardPower) * currJumpPower, ForceMode.Impulse);

            if (forwardPower < 15f)
            {
                forwardPower += speedIncreaseValue;
            }

            if (gage < 30)
            {
                upPower *= halfLife;
            }

            if (gage <= 0)
            {
                isFever   = true;
                jumpCount = 0;
            }
        }
    }
Ejemplo n.º 18
0
        private async Task <bool> CheckUser()
        {
            AccessLoading.IsVisible = true;
            try
            {
                try
                {
                    DeviceConfig con = await GoodsRecieveingApp.App.Database.GetConfig();

                    if (con != null)
                    {
                        GoodsRecieveingApp.MainPage.APIPath = con.DefaultAPI;
                    }
                }
                catch
                {
                }
                RestClient client = new RestClient();
                string     path   = "GetUser";
                //client.BaseUrl = new Uri("https://manifoldsa.co.za/FDBAPI/api/" + path);
                client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path);
                {
                    string str     = $"GET?UserName={txfUserBarcode.Text}";
                    var    Request = new RestRequest(str, Method.GET);
                    var    cancellationTokenSource = new CancellationTokenSource();
                    var    res = await client.ExecuteAsync(Request, cancellationTokenSource.Token);

                    if (res.IsSuccessful && res.Content.Contains("UserName"))
                    {
                        DataSet myds = new DataSet();
                        myds = Newtonsoft.Json.JsonConvert.DeserializeObject <DataSet>(res.Content);
                        foreach (DataRow row in myds.Tables[0].Rows)
                        {
                            GoodsRecieveingApp.MainPage.UserName = row["UserName"].ToString();
                            GoodsRecieveingApp.MainPage.UserCode = Convert.ToInt32(row["Id"].ToString());

                            GoodsRecieveingApp.MainPage.fReceive  = Convert.ToBoolean(row["fReceive"]);
                            GoodsRecieveingApp.MainPage.fRepack   = Convert.ToBoolean(row["fRepack"]);
                            GoodsRecieveingApp.MainPage.fInvCount = Convert.ToBoolean(row["fInvCount"]);
                            GoodsRecieveingApp.MainPage.fWhTrf    = Convert.ToBoolean(row["fWhTrf"]);
                            GoodsRecieveingApp.MainPage.fPickPack = Convert.ToBoolean(row["fPickPack"]);

                            GoodsRecieveingApp.MainPage.AuthWHTrf      = Convert.ToBoolean(row["AuthWHTrf"]);
                            GoodsRecieveingApp.MainPage.AuthReceive    = Convert.ToBoolean(row["AuthReceive"]);
                            GoodsRecieveingApp.MainPage.AuthDispatch   = Convert.ToBoolean(row["AuthDispatch"]);
                            GoodsRecieveingApp.MainPage.PickChecker    = Convert.ToBoolean(row["PickChecker"]);
                            GoodsRecieveingApp.MainPage.SystAdmin      = Convert.ToBoolean(row["SystAdmin"]);
                            GoodsRecieveingApp.MainPage.CreateInvCount = Convert.ToBoolean(row["CreateInvCount"]);
                            GoodsRecieveingApp.MainPage.CloseInvCount  = Convert.ToBoolean(row["CloseInvCount"]);
                            //GoodsRecieveingApp.MainPage.CanPartRec = Convert.ToBoolean(row["CanPartReceive"]);
                            GoodsRecieveingApp.MainPage.PSCollect = Convert.ToBoolean(row["PSCollect"]);
                        }
                        _ = GetInfo();
                        await Navigation.PushAsync(new MainPage());

                        AccessLoading.IsVisible = false;
                        return(true);
                    }
                    else
                    {
                        AccessLoading.IsVisible = false;
                        Vibration.Vibrate();
                        var result = await DisplayAlert("Error invalid access", "Could not get user access" + Environment.NewLine + "Would you like to edit the API path?", "Yes", "No");

                        if (result)
                        {
                            DeviceConfig con   = new DeviceConfig();
                            bool         isNew = false;
                            try
                            {
                                con = await GoodsRecieveingApp.App.Database.GetConfig();
                            }
                            catch
                            {
                                isNew          = true;
                                con.DefaultAPI = "";
                            }
                            var PathVal = await DisplayPromptAsync("Change API path", "Enter the API path here", "OK", "Cancel", con.DefaultAPI);

                            if (PathVal != "Cancel" && PathVal != "OK" && PathVal.Length > 4)
                            {
                                con.DefaultAPI = PathVal;
                                if (isNew)
                                {
                                    await GoodsRecieveingApp.App.Database.Insert(con);
                                }
                                else
                                {
                                    await GoodsRecieveingApp.App.Database.Update(con);
                                }
                            }
                        }
                        //message.DisplayMessage("Error - " + res.ErrorMessage, true);
                        return(false);
                    }
                }
            }
            catch
            {
                AccessLoading.IsVisible = false;
                message.DisplayMessage("Invalid user!", true);
                Vibration.Vibrate();
                return(false);
            }
        }
Ejemplo n.º 19
0
 private void ButtonVibrate_Clicked(object sender, EventArgs e)
 {
     Vibration.Vibrate(TimeSpan.FromMilliseconds(SliderTime.Value));
 }
Ejemplo n.º 20
0
 public void TapVibrate()
 {
     Vibration.Vibrate();
 }
Ejemplo n.º 21
0
        private async Task <bool> CheckWithSQL()
        {
            int    QTY      = 0;
            string itemcode = currentItem.ItemCode;

            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                RestClient client = new RestClient();
                string     path   = "ItemQOH";
                client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path);
                {
                    string stri    = InvLandingPage.WH;
                    string str     = $"GET?WH={InvLandingPage.WH}&ItemCode={itemcode}";
                    var    Request = new RestRequest(str, Method.GET);
                    var    cancellationTokenSource = new CancellationTokenSource();
                    var    res = await client.ExecuteAsync(Request, cancellationTokenSource.Token);

                    if (!res.IsSuccessful || res.Content == null)
                    {
                        Vibration.Vibrate();
                        message.DisplayMessage("Item not found", true);
                        return(true);
                    }
                    else
                    {
                        QTY = Convert.ToInt32(Double.Parse(res.Content, CultureInfo.InvariantCulture.NumberFormat), CultureInfo.InvariantCulture.NumberFormat);
                    }
                }
            }
            else
            {
                Vibration.Vibrate();
                message.DisplayMessage("Please recconect to the internet", true);
                return(true);
            }
            SetQty();
            if (currentItem.isFirst)
            {
                if (currentItem.FirstScanQty == QTY)
                {
                    items.Where(x => x.BarCode == currentItem.BarCode).First().Complete = true;
                    items.Where(x => x.BarCode == currentItem.BarCode).First().FinalQTY = items.Where(x => x.BarCode == currentItem.BarCode).First().FirstScanQty;
                    await DisplayAlert("Complete!", "QTY DID MATCH!", "OK");
                }
                else
                {
                    items.Where(x => x.BarCode == currentItem.BarCode).First().FinalQTY = items.Where(x => x.BarCode == currentItem.BarCode).First().FirstScanQty;
                    items.Where(x => x.BarCode == currentItem.BarCode).First().isFirst  = false;
                    Vibration.Vibrate();
                    await DisplayAlert("Error", "QTY DID NOT MATCH\nPlease recount now!", "OK");
                }
            }
            else
            {
                if (currentItem.SecondScanQty == QTY)
                {
                    items.Where(x => x.BarCode == currentItem.BarCode).First().Complete = true;
                    items.Where(x => x.BarCode == currentItem.BarCode).First().FinalQTY = items.Where(x => x.BarCode == currentItem.BarCode).First().SecondScanQty;
                    await DisplayAlert("Complete!", "QTY DID MATCH!", "OK");
                }
                else
                {
                    items.Where(x => x.BarCode == currentItem.BarCode).First().Complete = true;
                    items.Where(x => x.BarCode == currentItem.BarCode).First().FinalQTY = items.Where(x => x.BarCode == currentItem.BarCode).First().SecondScanQty;
                    //await Navigation.PushAsync(new AcceptScanPage(currentItem,QTY));
                }
            }
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                if (!await SendData())
                {
                    Vibration.Vibrate();
                    message.DisplayMessage("Could not update the database", true);
                }
            }
            else
            {
                Vibration.Vibrate();
                message.DisplayMessage("No Internet Connection", true);
            }
            Navigation.InsertPageBefore(new CountPage(countID), Navigation.NavigationStack[3]);
            await Navigation.PopAsync();

            return(true);
        }
Ejemplo n.º 22
0
 public void TapVibrateCustom() //Android
 {
     Debug.Log(inputTime.text);
     Vibration.Vibrate(int.Parse(inputTime.text));
 }
Ejemplo n.º 23
0
    // Update is called once per frame
    private void Update()
    {
        //   transform.localRotation = baseRotation * GyroManager.Instance.GetRotation();
        //  Quaternion quat =  GyroManager.Instance.GetRotation();
        if (solved == false)
        {
            Vector3 rot = GyroManager.Instance.GetRotation().eulerAngles;

            // int jump = (int)Math.Floor((rot.z - 15/2)/15)*15;
            int jump = (int)Math.Floor((rot.z) / degJump) * degJump;
            //Debug.Log("jump" + jump + " prevJump" + prevJump + " z-angle:" + rot.z);

            if (prevJump != degJump / 3 && prevJump != jump)
            {
                transform.localRotation = Quaternion.Euler(0, 0, (float)jump) * baseRotation;
                //double winPos = (180/Math.PI) * (solution*15); // the random
                // double winPos = Math.PI/4; // win position is hard coded to be at 225 deg now, can be changed to be dynamic somehow.
                double sineValue = Math.Sin(((Math.PI / 180) * jump - (Math.PI + (Math.PI / 180) * (double)winPos)) / 2.0);
                Debug.Log("sine: " + sineValue);
                audioSource.pitch = 1f + (float)Math.Pow(sineValue, 32.0) + (float)Math.Pow(sineValue, 4.0);
                // Debug.Log("pitch: " + audioSource.pitch);
                audioSource.PlayOneShot(clip, 0.5f);

                // To make the vibrations stronger closer to the goal:
                // double vibe = 20 + 0.5 * ((float)Math.Pow(sineValue, 32.0) + (float)Math.Pow(sineValue, 4.0)) * 235;
                // Vibration.Vibrate(15, (int)vibe, false);

                // To make the vibrations constant:
                // Vibration.Vibrate(15, 100, false);
            }
            // if(jump == 225){
            //   if(prevJump != 225){
            if (jump == winPos)
            {
                if (prevJump != winPos)
                {
                    //Debug.Log("jump: " + jump);
                    start = System.DateTime.Now;
                    Vibration.Vibrate(5, 255, false);
                    //Debug.Log("winPos reached: " + System.DateTime.Now);
                }

                // int timeDiff = System.DateTime.Now - start;
                System.TimeSpan timeDiff = System.DateTime.Now - start;
                //Debug.Log("timeDiff: " + timeDiff);

                if (timeDiff.Seconds >= 3)
                {
                    solved = true;
                }
            }

            prevJump = jump;
        }
        else if (unloading == false)
        {
            unloading = true;
            Debug.Log("You opened the safe! Clue collected.");
            ClueMessage.SetActive(true);
            StartCoroutine(UnloadVaultSceneAsync());
        }
    }
Ejemplo n.º 24
0
 public void TapVibratePattern()
 {
     long[] longs = inputPattern.text.Select(item => ( long )item).ToArray();
     Debug.Log(longs + " " + int.Parse(inputRepeat.text));
     Vibration.Vibrate(longs, int.Parse(inputRepeat.text));
 }
 private async void txfItemCode_Completed(object sender, EventArgs e)
 {
     if (txfItemCode.Text.Length != 0)
     {
         // txfItemCode.Text = GoodsRecieveingApp.MainPage.CalculateCheckDigit(txfItemCode.Text);
         if (txfItemCode.Text.Length == 8)
         {
             BOMItem bi = new BOMItem();
             try
             {
                 bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfItemCode.Text);
             }
             catch
             {
                 Vibration.Vibrate();
                 message.DisplayMessage("Error! No Item with this code", true);
                 txfItemCode.Text = "";
                 txfItemCode.Focus();
                 return;
             }
             if (await CheckOrderItemCode(bi.ItemCode))
             {
                 List <DocLine> docs = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text)).Where(x => x.ItemCode == bi.ItemCode).ToList();
                 int            i    = docs.Sum(x => x.ScanAccQty);
                 if (i + bi.Qty <= docs.First().ItemQty)
                 {
                     DocLine docline = new DocLine {
                         Balacnce = 0, Complete = "No", DocNum = txfSOCode.Text, isRejected = false, ItemBarcode = docs.First().ItemBarcode, ItemDesc = docs.First().ItemDesc, ItemCode = docs.First().ItemCode, ItemQty = docs.First().ItemQty, PalletNum = currentPallet, ScanAccQty = bi.Qty
                     };
                     await GoodsRecieveingApp.App.Database.Insert(docline);
                     await RefreshList();
                 }
                 else
                 {
                     Vibration.Vibrate();
                     message.DisplayMessage("All of this item have been scanned for this order", true);
                 }
             }
             else
             {
                 Vibration.Vibrate();
                 message.DisplayMessage("This Item is not on this order", true);
             }
         }
         else
         {
             if (await CheckOrderBarcode(txfItemCode.Text))
             {
                 List <DocLine> docs = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text)).Where(x => x.ItemBarcode == txfItemCode.Text).ToList();
                 int            i    = docs.Sum(x => x.ScanAccQty);
                 if (i + 1 <= docs.First().ItemQty)
                 {
                     DocLine docline = new DocLine {
                         Balacnce = 0, Complete = "No", DocNum = txfSOCode.Text, isRejected = false, ItemBarcode = txfItemCode.Text, ItemDesc = docs.First().ItemDesc, ItemCode = docs.First().ItemCode, ItemQty = docs.First().ItemQty, PalletNum = currentPallet, ScanAccQty = 1
                     };
                     await GoodsRecieveingApp.App.Database.Insert(docline);
                     await RefreshList();
                 }
                 else
                 {
                     Vibration.Vibrate();
                     message.DisplayMessage("All of this item have been scanned for this order", true);
                 }
             }
             else
             {
                 Vibration.Vibrate();
                 message.DisplayMessage("This Item is not on this order", true);
             }
         }
         if (await CompleteCheck())
         {
             btnComplete.IsVisible = true;
         }
         else
         {
             btnComplete.IsVisible = false;
         }
         txfItemCode.Text = "";
         txfItemCode.Focus();
     }
 }
Ejemplo n.º 26
0
        public void FourthSub(string txt)
        {
            string fourthIndex = txt;

            //fourthIndex

            if (fourthIndex.Equals("a") || fourthIndex.Equals("A"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }
            if (fourthIndex.Equals("b") || fourthIndex.Equals("B"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("c") || fourthIndex.Equals("C"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("d") || fourthIndex.Equals("D"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("e") || fourthIndex.Equals("E"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("f") || fourthIndex.Equals("F"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("g") || fourthIndex.Equals("G"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("h") || fourthIndex.Equals("H"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("i") || fourthIndex.Equals("I"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("j") || fourthIndex.Equals("J"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("k") || fourthIndex.Equals("K"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("l") || fourthIndex.Equals("L"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("m") || fourthIndex.Equals("M"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("n") || fourthIndex.Equals("N"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("o") || fourthIndex.Equals("O"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("p") || fourthIndex.Equals("P"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("q") || fourthIndex.Equals("Q"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("r") || fourthIndex.Equals("R"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("s") || fourthIndex.Equals("S"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("t") || fourthIndex.Equals("T"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("u") || fourthIndex.Equals("U"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("v") || fourthIndex.Equals("V"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("w") || fourthIndex.Equals("W"))
            {
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("x") || fourthIndex.Equals("X"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("y") || fourthIndex.Equals("Y"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
            }

            if (fourthIndex.Equals("z") || fourthIndex.Equals("Z"))
            {
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration2);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
                Vibration.Vibrate(duration1);
                Thread.Sleep(1000);
            }
        }
        private async void txfSOCode_Completed(object sender, EventArgs e)
        {
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                if (txfSOCode.Text.Length != 0)
                {
                    LodingIndiactor.IsVisible = true;
                    if (await GetItems(txfSOCode.Text.ToUpper()))
                    {
                        if (!await PalletCheck(txfSOCode.Text))
                        {
                            LodingIndiactor.IsVisible = false;
                            txfSOCode.Text            = "";
                            txfSOCode.Focus();
                        }
                        DocLine d = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text)).First();
                        txfSOCode.IsEnabled = false;
                        txfSOCode.IsVisible = false;
                        lblSOCode.IsVisible = false;
                        try
                        {
                            await GoodsRecieveingApp.App.Database.Delete(await GoodsRecieveingApp.App.Database.GetHeader(d.DocNum));
                        }
                        catch { }
                        await GoodsRecieveingApp.App.Database.Insert(new DocHeader { DocNum = txfSOCode.Text, PackerUser = GoodsRecieveingApp.MainPage.UserCode, AccName = d.SupplierName, AcctCode = d.SupplierCode });

                        LodingIndiactor.IsVisible = false;
                        SOCodeLayout.IsVisible    = false;
                        ItemCodeLayout.IsVisible  = true;
                        AddSoLayout.IsVisible     = true;
                        GridLayout.IsVisible      = true;
                        string SONumbers = await GetAllSONumbers(currentPallet);

                        if (SONumbers == "")
                        {
                            SONumbers = txfSOCode.Text + "|";
                        }
                        List <string> codes = new List <string>();
                        foreach (ToolbarItem items in this.ToolbarItems)
                        {
                            codes.Add(items.Text);
                        }
                        foreach (string str in SONumbers.Split('|'))
                        {
                            if (str.Length > 1)
                            {
                                if (!codes.Contains(str))
                                {
                                    ToolbarItem item = new ToolbarItem
                                    {
                                        Text  = str,
                                        Order = ToolbarItemOrder.Secondary
                                    };
                                    item.Clicked += btnViewSO_Clicked;
                                    this.ToolbarItems.Add(item);
                                }
                            }
                        }
                        await RefreshList();

                        txfItemCode.Focus();
                    }
                    else
                    {
                        txfSOCode.Text = "";
                        txfSOCode.Focus();
                    }
                }
            }
            else
            {
                Vibration.Vibrate();
                message.DisplayMessage("No Internet Connection", true);
                txfSOCode.Text = "";
                txfSOCode.Focus();
            }
        }
Ejemplo n.º 28
0
        async private void Button2_Clicked(object sender, EventArgs e)
        {
            Vibration.Vibrate(TimeSpan.FromSeconds(0.03));

            await Navigation.PushAsync(new Register());
        }
Ejemplo n.º 29
0
        public Basket()
        {
            ProductBasket.prodlist.Clear();
            ProductBasket.sumlist.Clear();
            ProductBasket.list.Clear();
            InitializeComponent();

            Product p = DbWorking.ViewToBasket(0);

            if (p == null)
            {
                ProdEmpty();
            }
            else
            {
                Frame frame = new Frame
                {
                    BackgroundColor   = Color.FromHex("#F8F8F8"),
                    Padding           = new Thickness(20, 10, 20, 10),
                    VerticalOptions   = LayoutOptions.EndAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    HasShadow         = false
                };

                Button button = new Button
                {
                    FontSize        = 16,
                    FontFamily      = "Ubuntu-Bold.ttf#Ubuntu",
                    Text            = $"Оформить заказ на {ProductBasket.buttonText} р.\nДоставка = 0 р.",
                    TextTransform   = 0,
                    TextColor       = Color.White,
                    BackgroundColor = Color.FromHex("#b39afd"),
                    CornerRadius    = 8,
                    HeightRequest   = 60
                };

                button.Clicked += (object sender, EventArgs e) =>
                {
                    Vibration.Vibrate(TimeSpan.FromSeconds(0.03));
                    int check = DbWorking.CheckIO();
                    if (check == 0)
                    {
                        DisplayActionSheet("Кондитер", "Ок", null, "Ошибка! Для оплаты товара, необходимо зайти в учетную запись.");
                        return;
                    }
                    Navigation.PushAsync(new BasketList());
                };

                frame.Content = button;

                StackLayout st = new StackLayout
                {
                    Spacing = 0,
                };

                foreach (Grid grid in ProductBasket.list)
                {
                    st.Children.Add(grid);
                    st.Children.Add(new Line
                    {
                        Margin            = new Thickness(0, 10, 0, 0),
                        HeightRequest     = 0.2,
                        X1                = 400,
                        Stroke            = Brush.LightGray,
                        HorizontalOptions = LayoutOptions.Center
                    });
                }

                StackLayout stackLayout = new StackLayout
                {
                    BackgroundColor = Color.White,
                    Children        =
                    {
                        st
                    }
                };

                ScrollView scrollView = new ScrollView {
                    Content = stackLayout
                };

                StackLayout stack = new StackLayout
                {
                    BackgroundColor = Color.White,
                    Spacing         = 0,
                    Children        =
                    {
                        scrollView,
                        frame
                    }
                };
                Content = stack;
            }
        }
Ejemplo n.º 30
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            if (Boton.Text.Equals("Finalizar Viaje"))
            {
                var     myHttpClient = new HttpClient();
                Archivo d            = JsonConvert.DeserializeObject <Archivo>(TextoJson);
                var     formContent  = new FormUrlEncodedContent(new Dictionary <string, string> {
                });
                var uri             = new Uri("https://urbanmove-back.azurewebsites.net/api/Viaje/FinalizarViaje?idEmpresa=" + d.idEmpresa + "&idVehiculo=" + d.idVehiculo + "&codigo=" + this.TxtCodReserva.Text);
                var codigoRespuesta = myHttpClient.PostAsync(uri.ToString(), formContent).Result;

                // Use default vibration length
                Vibration.Vibrate();

                // Or use specified time
                var duration = TimeSpan.FromSeconds(1);
                Vibration.Vibrate(duration);

                if (codigoRespuesta.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //Controlamos la respuesta de la api
                    aTimer.Stop();
                    //a2Timer.Stop();
                    var responseString = await codigoRespuesta.Content.ReadAsStringAsync();

                    RespuestaJsonFinViaje des = JsonConvert.DeserializeObject <RespuestaJsonFinViaje>(responseString);
                    lblPrueba1.Text      = "Ha finalizado su viaje!! ";
                    lblPrueba1.TextColor = Color.Green;
                    lblPrueba2.Text      = "El viaje salió $" + des.precio + ".";
                    lblPrueba2.TextColor = Color.Green;
                    lblPrueba3.Text      = "Vuelva pronto!!";
                    lblPrueba3.TextColor = Color.Green;
                }
                else
                {
                    lblPrueba.Text = "Error al consumir el servicio codigo : " + codigoRespuesta.StatusCode.ToString();
                }
            }
            else
            {
                // comenzar viaje
                var myHttpClient = new HttpClient();
                // var uri = new Uri("https://urbanmove-back.azurewebsites.net/api/Viaje/IniciarViaje");

                Archivo d = JsonConvert.DeserializeObject <Archivo>(TextoJson);

                var formContent     = new FormUrlEncodedContent(new Dictionary <string, string> {
                });
                var uri             = new Uri("https://urbanmove-back.azurewebsites.net/api/Viaje/IniciarViaje?idEmpresa=" + d.idEmpresa + "&idVehiculo=" + d.idVehiculo + "&codigo=" + this.TxtCodReserva.Text);
                var codigoRespuesta = myHttpClient.PostAsync(uri.ToString(), formContent).Result;


                if (codigoRespuesta.StatusCode == System.Net.HttpStatusCode.OK)

                {
                    //Controlamos la respuesta de la api

                    var responseString = await codigoRespuesta.Content.ReadAsStringAsync();

                    RespuestaJsonInicioViaje des = JsonConvert.DeserializeObject <RespuestaJsonInicioViaje>(responseString);

                    if (!(des.result.Equals("false")))
                    {
                        Boton.Text = "Finalizar Viaje";
                        TxtCodReserva.IsEnabled = false;
                        Color color1 = Color.Red;
                        Boton.BackgroundColor = color1;

                        Color color2 = Color.Black;
                        Boton.TextColor = color2;

                        Color color3 = Color.Green;
                        lblCron.TextColor = color3;


                        aTimer          = new Timer();
                        aTimer.Interval = 1000;
                        aTimer.Elapsed += OnTimedEvent;
                        aTimer.Start();

                        /*aTimer2 = new Timer();
                         * aTimer2.Interval = 1000;
                         * aTimer2.Elapsed += OnTimedEvent2;
                         *
                         * aTimer2.Start();
                         */
                    }
                    else
                    {
                        lblPrueba.Text = "No existe el código de reserva";
                    }
                }
                else
                {
                    lblPrueba.Text = "Error al consumir WS: " + codigoRespuesta;
                }
            }
        }