void Focus(GlobalEvent evt) { if (embroideryStatus == EmbroideryStatus.Inlayed) { embroideryStatus = EmbroideryStatus.Focus; } }
void Hide(GlobalEvent evt) { if (embroideryStatus != EmbroideryStatus.Inlayed && embroideryStatus != EmbroideryStatus.Focus) { embroideryStatus = EmbroideryStatus.Hide; } else { embroideryStatus = EmbroideryStatus.HideAfterInlay; } }
private void AddNewItem_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(ProductNametxt.Text) || string.IsNullOrWhiteSpace(ProductIDtxt.Text) || string.IsNullOrWhiteSpace(DesignCodetxt.Text) || string.IsNullOrWhiteSpace(ColorTxt.Text) || string.IsNullOrWhiteSpace(NumberOfPiecesTxt.Text) || string.IsNullOrWhiteSpace(QuantityInStockTxt.Text) || string.IsNullOrWhiteSpace(ProductPriceTxt.Text) || string.IsNullOrWhiteSpace(KameezaFabricTxt.Text) || string.IsNullOrWhiteSpace(ShalwarFabricTxt.Text) || string.IsNullOrWhiteSpace(DupattaFabricTxt.Text) || !IsImgUploaded) { MessageBox.Show("Please Fill All Fields And Mark Embroidery Status If Require"); } else { try { Admin.AddItem(ProductNametxt.Text, ProductIDtxt.Text, DesignCodetxt.Text, ColorTxt.Text, int.Parse(NumberOfPiecesTxt.Text), int.Parse(QuantityInStockTxt.Text), double.Parse(ProductPriceTxt.Text), KameezaFabricTxt.Text, ShalwarFabricTxt.Text, DupattaFabricTxt.Text, EmbroideryStatus.GetItemChecked(0), EmbroideryStatus.GetItemChecked(1), EmbroideryStatus.GetItemChecked(2), EmbroideryStatus.GetItemChecked(3), o1.FileName); ProductPicture.Image = ProductPicture.InitialImage; ProductNametxt.Clear(); ProductIDtxt.Clear(); DesignCodetxt.Clear(); ColorTxt.ResetText(); NumberOfPiecesTxt.ResetText(); QuantityInStockTxt.ResetText(); ProductPriceTxt.ResetText(); KameezaFabricTxt.ResetText(); ShalwarFabricTxt.ResetText(); DupattaFabricTxt.ResetText(); ProductPicture.Image = ProductPicture.InitialImage; //EmbroideryStatus.Refresh(); for (int i = 0; i < EmbroideryStatus.Items.Count; i++) { EmbroideryStatus.SetItemChecked(i, false); } } catch (System.Data.SqlClient.SqlException ex) { if (ex.Number == 2627) { MessageBox.Show("Product Id Already Reserved for some other product please try some other Id"); } } } }
private void AddItemBtn_Click(object sender, EventArgs e) { ProductPicture.Image = ProductPicture.InitialImage; ProductNametxt.Clear(); ProductIDtxt.Clear(); DesignCodetxt.Clear(); ColorTxt.ResetText(); EmbroideryStatus.Refresh(); AddItems.Show(); AddItems.BringToFront(); EditItem.TabStop = false; ViewAccount.TabStop = false; AccountSetting.TabStop = false; KameezaFabricTxt.Items.Clear(); ShalwarFabricTxt.Items.Clear(); DupattaFabricTxt.Items.Clear(); ColorTxt.Items.Clear(); Admin.ReadFabricInfo(ColorTxt, KameezaFabricTxt, ShalwarFabricTxt, DupattaFabricTxt); }
void UpdateState() { switch (embroideryStatus) { case EmbroideryStatus.Hide: if (Vector3.Distance(transform.position, hidePoint.position) < 0.01f) { transform.position = hidePoint.position; foreach (var s in targetString) { if (s != null && s.gameObject.activeInHierarchy) { s.gameObject.SetActive(false); } } } else { transform.position = Vector3.Lerp(transform.position, hidePoint.position, Time.deltaTime * lerpSpeed); transform.rotation = Quaternion.Lerp(transform.rotation, hidePoint.rotation, Time.deltaTime * lerpSpeed); } break; case EmbroideryStatus.Display: if (Vector3.Distance(transform.position, displayPoint.position) < 0.01f) { transform.position = displayPoint.position; foreach (var s in targetString) { if (s != null && !s.gameObject.activeInHierarchy) { s.SetMoveCenter(s.transform.position); s.transform.position += Vector3.up * 10f; s.gameObject.SetActive(true); } } } else { transform.position = Vector3.Lerp(transform.position, displayPoint.position, Time.deltaTime * lerpSpeed); } var inlayCount = 0; foreach (var c in colorLayers) { if (c.inlayFinished) { inlayCount++; } } if (inlayCount >= colorLayers.Count) { GlobalEventManager.SendEvent(inlayEvent); embroideryStatus = EmbroideryStatus.Inlayed; } break; case EmbroideryStatus.Inlayed: break; case EmbroideryStatus.Focus: Vector3 viewPoint = CameraCharacter.Singleton.ownedCamera.transform.position + CameraCharacter.Singleton.transform.forward * focusDistance; if (Vector3.Distance(transform.position, viewPoint) < 0.01f) { var p = InputPlatform.Singleton.GetMoveVector() * InputPlatform.Singleton.ScreenSizeRatio; float deltaX = p.x * 0.2f; //float deltaY = p.y * 0.2f; Vector3 eulerAngles = transform.rotation.eulerAngles; eulerAngles += new Vector3(0, -deltaX, 0); transform.rotation = Quaternion.Euler(eulerAngles); } else { transform.position = Vector3.Lerp(transform.position, viewPoint, Time.deltaTime * lerpSpeed); } break; case EmbroideryStatus.HideAfterInlay: if (Vector3.Distance(transform.position, hidePoint.position) < 0.01f) { foreach (var s in targetString) { Destroy(s.gameObject); } Destroy(gameObject); } else { transform.position = Vector3.Lerp(transform.position, hidePoint.position, Time.deltaTime * lerpSpeed); transform.rotation = Quaternion.Lerp(transform.rotation, hidePoint.rotation, Time.deltaTime * lerpSpeed); } break; default: break; } }
void Display(GlobalEvent evt) { embroideryStatus = EmbroideryStatus.Display; }