public void Initalize(DialogContent dialog) { dialogContent = dialog; title.text = dialogContent.title; content.text = dialogContent.content; dontShowAgain.isOn = dialogContent.dontShowAgain; }
//opens a dialog window which is populated by the lambda statement passed to show_dialog ie: //show_dialog((d) => { // GUILayout.Label("hello I'm a dialog"); //}) //The dialog instance is returned by show_dialog, and it's also passed into the lambda. protected KerbalXDialog show_dialog(DialogContent content) { KerbalXDialog dialog = gameObject.AddOrGetComponent <KerbalXDialog>(); dialog.content = content; return(dialog); }
private async void DeleteProOD(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn sản phẩm viên này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (obj != null) { var item = ListOD.SingleOrDefault(t => t.ProductID == (int)obj); ListOD.Remove(item); Subtotal -= (double)item.UnitPrice * (int)item.OrderQty; } } } catch { MessageBox.Show("Có Lỗi", "Thông Báo", MessageBoxButton.OK, MessageBoxImage.Warning); } }
protected ModalDialog show_modal_dialog(DialogContent content) { ModalDialog dialog = gameObject.AddOrGetComponent <ModalDialog>(); dialog.content = content; dialog.skin = this.skin; return(dialog); }
/// <summary> /// 设置具体对话的内容 /// </summary> /// <param name="content"></param> public void SetContext(DialogContent content) { currentDialog = content; dialogLines = content.GetContext(); speaker = content.GetSpeaker(); nameText.text = content.GetSpeaker(); ShowDialog(); }
//opens a dialog window which is populated by the lambda statement passed to show_dialog ie: //show_dialog((d) => { // GUILayout.Label("hello I'm a dialog"); //}) //The dialog instance is returned by show_dialog, and it's also passed into the lambda. protected DryDialog show_dialog(DialogContent content) { DryDialog dialog = gameObject.AddOrGetComponent <DryDialog>(); dialog.content = content; dialog.skin = this.skin; return(dialog); }
private async void DeleteSup(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn xóa nhà cung cấp này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (obj != null) { if (await supplier_repo.Remove((int)obj)) { ListSupplier.Remove(ListSupplier.SingleOrDefault(t => t.SupID == (int)obj)); dc = new DialogContent() { Content = "Xóa Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } else { dc = new DialogContent() { Content = "Xóa Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } } } } catch (Exception ex) { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
private async void DeleteOrder(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn xóa hóa đơn này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (await oh_repo.Remove((int)obj)) { dc = new DialogContent() { Content = "Xóa Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListOrder.Remove(ListOrder.SingleOrDefault(t => t.PurID == (int)obj)); } else { dc = new DialogContent() { Content = "Xóa Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
public static void Show(DialogContent content) { Open(); Instance._content.text = content._content; Instance._okText.text = content._okText; Instance._cancleText.text = content._cancleText; Instance._okButton.onClick.AddListener(content._action); Instance._cancleButton.onClick.AddListener(() => Shut()); }
public void HtmlAttribute_SetsCompleteTextBind() { actual = string.Empty; DialogContent target = new DialogContent(); target.TextValue = "Sample"; string expected = "<div><p>Sample</p></div>"; actual = Utility.ControlContentHtmlBuilder <DialogContent>(target); Assert.AreEqual(expected, actual); }
public void HtmlAttribute_SetsCompleteHtmlBind() { actual = string.Empty; DialogContent target = new DialogContent(); target.Html = delegate(object test) { return("<div style=\"padding: 10px;\">Html Test</div>"); }; string expected = "<div><div style=\"padding: 10px;\">Html Test</div></div>"; actual = Utility.ControlContentHtmlBuilder <DialogContent>(target); Assert.AreEqual(expected, actual); }
private async void DeleteCategory(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn xóa loại này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (obj != null) { if (await categories_Repo.Remove((int)obj)) { dc = new DialogContent() { Content = "Xóa Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); ListCatelogys.Remove(ListCatelogys.SingleOrDefault(t => t.CatelogyID == (int)obj)); } else { dc = new DialogContent() { Content = "Xóa Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public override bool Execute(GameObject target) { DialogContent content = new DialogContent(); content._content = "Objet Name : " + target.name; content._action = () => ModalDialog.Shut(); //RadialMenu.Shut(); ModalDialog.Show(content); return(true); }
bool ValidateCodecForFlv(FlvFile flvFile) { ResourceLoader loader = ResourceLoader.GetForCurrentView(); DialogContent dc = new DialogContent(); if (flvFile.FlvHeader.Signature != "FLV") { CurrentMediaInfo.MediaType = MediaType.Unkown; dc.Content = string.Format(loader.GetString("WrongFileFormat"), "FLV"); dc.OccueredErrorMediaInfo = dc.Content; } if (flvFile.FlvFileBody.VideoInfoFlvTag.VideoData.CodecID != CodecID.AVC) { dc.Content = loader.GetString("NotSupportedVideoCodec"); dc.Description1 = flvFile.FlvFileBody.VideoInfoFlvTag.VideoData.CodecID.ToString(); dc.Description2 = string.Format(loader.GetString("NotSupportedCodecDesc"), "H264"); } if (flvFile.FlvFileBody.AudioInfoFlvTag.AudioData.SoundFormat != SoundFormat.AAC && flvFile.FlvFileBody.AudioInfoFlvTag.AudioData.SoundFormat != SoundFormat.MP3 && flvFile.FlvFileBody.AudioInfoFlvTag.AudioData.SoundFormat != SoundFormat.ADPCM) { dc.Content = loader.GetString("NotSupportedAudioCodec"); dc.Description1 = flvFile.FlvFileBody.AudioInfoFlvTag.AudioData.SoundFormat.ToString(); dc.Description2 = string.Format(loader.GetString("NotSupportedCodecDesc"), "AAC, MP3, PCM"); } if (!string.IsNullOrEmpty(dc.Content)) { //재생 종료 StopMedia(); //화면 닫기 if (IsPlayerOpened) { IsPlayerOpened = false; } //에러 메세지 처리 if (string.IsNullOrEmpty(dc.OccueredErrorMediaInfo)) { dc.OccueredErrorMediaInfo = ResourceLoader.GetForCurrentView().GetString("Message/Error/CodecNotSupported"); } //로딩 패널 숨김 HideLoadingBar(); //에러 메세지 ShowDialogMediaStreamSourceError(dc); return(false); } return(true); }
private async void DeleteEmp(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn xóa tài khoản này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (obj != null) { if (await employee_Repo.Remove((int)obj)) { ListAccount.Remove(ListAccount.SingleOrDefault(t => t.EmpID == (int)obj)); dc = new DialogContent() { Content = "Xóa Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } else { dc = new DialogContent() { Content = "Xóa Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void buttonOK_Click(object sender, EventArgs e) { SearchOption = new DialogContent(); if (radioButtonNewSearch.Checked) SearchOption.Selection = DialogContent.SelectionSelect.NewSearch; else if (radioButtonWithinSelection.Checked) SearchOption.Selection = DialogContent.SelectionSelect.WithinSelection; else if (radioButtonAddToCurrent.Checked) SearchOption.Selection = DialogContent.SelectionSelect.AddToSelection; if (radioButtonName.Checked) SearchOption.Field = DialogContent.FieldSelect.Name; else if (radioButtonCode.Checked) SearchOption.Field = DialogContent.FieldSelect.Code; else if (radioButtonDescription.Checked) SearchOption.Field = DialogContent.FieldSelect.Description; else if (radioButtonOwner.Checked) SearchOption.Field = DialogContent.FieldSelect.Owner; SearchOption.CaseSensative = checkBoxCaseSensative.Checked; SearchOption.Text = textBoxFind.Text; }
private async void Addsuccess(PurchasingHeader obj) { try { if (obj != null) { var newobj = await oh_repo.GetById(obj.PurID); ListOrder.Add(newobj); dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
private void EndContent() { currentLine = 0; DialogContent nextTopic = currentDialog.GetNextContent(); PlotEvent plot = currentDialog.GetPlot(); if (nextTopic == null) { currentDialog = null; animator.Play("Hide"); talking = false; } else { SetContext(nextTopic); ShowDialog(); } GameManager.GetInstance().StartPlot(plot); }
public static void Show(string dialogId) { DialogContent dialog = null; if (instance.dialogDictionary.TryGetValue(dialogId, out dialog)) { if (!dialog.dontShowAgain) { GameObject newObject = Instantiate(instance.dialogPrefab) as GameObject; newObject.transform.SetParent(instance.dialogGroup, false); newObject.SetActive(true); // Initalize dynamic button component DialogDriver newComponent = newObject.GetComponent <DialogDriver>(); newComponent.Initalize(dialog); } } else { Debug.LogError("No dialog found with id:" + dialogId); } }
private void buttonOK_Click(object sender, EventArgs e) { SearchOption = new DialogContent(); if (radioButtonNewSearch.Checked) { SearchOption.Selection = DialogContent.SelectionSelect.NewSearch; } else if (radioButtonWithinSelection.Checked) { SearchOption.Selection = DialogContent.SelectionSelect.WithinSelection; } else if (radioButtonAddToCurrent.Checked) { SearchOption.Selection = DialogContent.SelectionSelect.AddToSelection; } if (radioButtonName.Checked) { SearchOption.Field = DialogContent.FieldSelect.Name; } else if (radioButtonCode.Checked) { SearchOption.Field = DialogContent.FieldSelect.Code; } else if (radioButtonDescription.Checked) { SearchOption.Field = DialogContent.FieldSelect.Description; } else if (radioButtonOwner.Checked) { SearchOption.Field = DialogContent.FieldSelect.Owner; } SearchOption.CaseSensative = checkBoxCaseSensative.Checked; SearchOption.Text = textBoxFind.Text; }
void sendNextMsg() { if (msgnum <= dialogSequence.Count) { if (msgnum == dialogSequence.Count) { Debug.Log("Dialog Number " + (msgnum + 1) + "/" + (dialogSequence.Count) + " completed - Exiting dialogSequence"); Time.timeScale = 1f; anim.Play("Dialog Out"); dialogSequence = new List <DialogContent>(); msgnum = 0; currentDialog.FinalAction(); currentDialog = null; } else { Debug.Log("Dialog Number " + (msgnum + 1) + "/" + (dialogSequence.Count)); currentDialog = dialogSequence[msgnum]; label.text = currentDialog.GetMainText(); namelabel.text = currentDialog.GetOwnerName(); picture.sprite = currentDialog.GetOwnerPhoto(); currentDialog.FinalAction(); msgnum++; } } else { Time.timeScale = 1f; anim.Play("Dialog Out"); dialogSequence = new List <DialogContent>(); msgnum = 0; currentDialog.FinalAction(); currentDialog = null; } }
private async void SubmitProductAsync(string obj) { try { var newpro = new Product() { Name = ProductName, Description = Description, UnitPrice = Convert.ToDecimal(Price), UnitOnOrder = Convert.ToDecimal(PriceSales), }; if (ImgProduct != null) { newpro.Picture = ImgProduct.ConvertToByte(); } if (SelectedCate != null) { newpro.CategoryID = SelectedCate.CatelogyID; } if (string.IsNullOrEmpty(obj)) { //Create new category var objresult = await product_Repo.Add(newpro); if (objresult != null) { dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListProducts = new ObservableCollection <ProductModel>(product_Repo.GetAllProductModels()); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } else { //update category newpro.ProductID = Convert.ToInt32(ProductID); if (await product_Repo.Update(newpro)) { dc = new DialogContent() { Content = "Cập Nhật Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListProducts = new ObservableCollection <ProductModel>(product_Repo.GetAllProductModels()); } else { dc = new DialogContent() { Content = "Cập Nhật Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
private async void Submit(string obj) { try { var newObj = new Logistic() { Name = Name, }; newObj.Fee = Convert.ToDecimal(Fee); if (string.IsNullOrEmpty(obj)) { var result = await log_repo.Add(newObj); if (result != null) { ListLog.Add(result); dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } else { newObj.LogID = Convert.ToInt32(LogID); if (await log_repo.Update(newObj)) { dc = new DialogContent() { Content = "Cập Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListLog = new ObservableCollection <Logistic>(log_repo.GetAll()); } else { dc = new DialogContent() { Content = "Cập Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { MessageBox.Show("Có Lỗi"); } }
private void DialogContent_TextChanged(object sender, EventArgs e) { string tokens = "<CLT(\\s?)([0-9]?)([0-9]?)>|(\\\\n)"; bool OnlyFix = false; System.Text.RegularExpressions.Regex rex = new System.Text.RegularExpressions.Regex(tokens); System.Text.RegularExpressions.MatchCollection mc = rex.Matches(DialogContent.Text); int StartCursorPosition = DialogContent.SelectionStart; DialogContent.SelectAll(); DialogContent.SelectionColor = Color.Black; string[] Changes = new string[mc.Count]; string PureText = DialogContent.Text.Replace("\\n", "/n"); DialogContent.SelectionFont = new Font(DialogContent.Font.Name, DialogContent.Font.Size, FontStyle.Regular, GraphicsUnit.Point, ((byte)(128))); again :; int pos = 0; foreach (System.Text.RegularExpressions.Match m in mc) { int startIndex = m.Index; int StopIndex = m.Length; Changes[pos] = startIndex + ":" + StopIndex; PureText = PureText.Replace(m.Value, ""); DialogContent.Select(startIndex, StopIndex); DialogContent.SelectionColor = Color.Blue; DialogContent.SelectionFont = new Font(DialogContent.Font.Name, DialogContent.SelectionFont.Size, FontStyle.Bold, GraphicsUnit.Point, ((byte)(128))); pos++; } if (DialogContent.Text.Length > 52 && !DialogContent.Text.Contains("\\n") && !OnlyFix) { int InScript = 0; int CorrectIndex = 0; for (int i = 0; CorrectIndex < 51; i++) { bool IsText = ScritStringMerge(i, Changes); if (IsText) { CorrectIndex++; } InScript++; } DialogContent.Select(InScript, DialogContent.Text.Length - InScript); DialogContent.SelectionColor = Color.Red; OnlyFix = true; goto again; } else if (DialogContent.Text.Length > 103 && !OnlyFix) { int InScript = 0; int CorrectIndex = 0; for (int i = 0; CorrectIndex < 101; i++) { bool IsText = ScritStringMerge(i, Changes); if (IsText) { CorrectIndex++; } InScript++; } DialogContent.Select(InScript, DialogContent.Text.Length - InScript); DialogContent.SelectionColor = Color.Red; OnlyFix = true; goto again; } DialogContent.Select(StartCursorPosition, 0); }
private async void Submit(string obj) { try { var newsup = new Supplier() { Name = Name, Delegate = Delegate, Email = Email, Phone = Phone, }; if (SupImg != null) { newsup.Avatar = SupImg.ConvertToByte(); } if (obj == null) { //Create new sup var objresult = await supplier_repo.Add(newsup); if (objresult != null) { dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListSupplier.Add(objresult); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } else { //update sup newsup.SupID = Convert.ToInt32(obj); if (await supplier_repo.Update(newsup)) { dc = new DialogContent() { Content = "Cập Nhật Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListSupplier = new ObservableCollection <Supplier>(await supplier_repo.GetAllAsync()); } else { dc = new DialogContent() { Content = "Cập Nhật Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
/// <summary> /// 用于对物品进行描述 /// </summary> /// <param name="describe"></param> private void ShowDescribe(string eviname) { DialogContent content = evidences.GetObjectEvidence(eviname).GetContent(); SetContext(content); }
bool ValidateCodecForMkv(Document doc, MKVFileSource mkvFileSource) { DialogContent dc = new DialogContent(); ResourceLoader loader = ResourceLoader.GetForCurrentView(); IEnumerable <ICodec> codecs = mkvFileSource.UnusableMediaCodecs; //MKV가 아닌 경우 예외 발생 if (doc.Header == null || doc.Header.Count == 0) { CurrentMediaInfo.MediaType = MediaType.Unkown; dc.Content = string.Format(loader.GetString("WrongFileFormat"), "MKV"); dc.OccueredErrorMediaInfo = dc.Content; } else { var videoCodec = codecs.Where(x => x.CodecType == TrackTypes.Video); var audioCodec = codecs.Where(x => x.CodecType == TrackTypes.Audio); if (videoCodec.Any()) { dc.Content = loader.GetString("NotSupportedVideoCodec"); dc.Description1 = videoCodec.FirstOrDefault().CodecName; dc.Description2 = string.Format(loader.GetString("NotSupportedCodecDesc"), "H264"); } if (audioCodec.Any()) { var licenseCodec = audioCodec.FirstOrDefault(x => x.IsNeedLicense); if (licenseCodec != null) { dc.Content = string.Format(loader.GetString("NotSupportedAudioLicenseCodec"), licenseCodec.LicenseCompany); dc.Description1 = licenseCodec.CodecName; dc.Description2 = loader.GetString("NotSupportedLicenseCodecDesc"); } else { dc.Content = loader.GetString("NotSupportedAudioCodec"); dc.Description1 = audioCodec.FirstOrDefault(x => !x.IsNeedLicense).CodecName; dc.Description2 = string.Format(loader.GetString("NotSupportedCodecDesc"), "AAC, MP3, FLAC, PCM"); } } } if (!string.IsNullOrEmpty(dc.Content)) { //재생 종료 StopMedia(); //화면 닫기 if (IsPlayerOpened) { IsPlayerOpened = false; } //에러 메세지 처리 if (string.IsNullOrEmpty(dc.OccueredErrorMediaInfo)) { dc.OccueredErrorMediaInfo = ResourceLoader.GetForCurrentView().GetString("Message/Error/CodecNotSupported"); } //로딩 패널 숨김 HideLoadingBar(); //에러메세지 출력 ShowDialogMediaStreamSourceError(dc); return(false); } return(true); }
private async void Submit(string obj) { try { var newemp = new Employee() { Mission = Mission, Address = Address, Avatar = ImgEmp.ConvertToByte(), Name = Name, Salary = Convert.ToDecimal(Salary), Phone = Phone, DOB = Convert.ToDateTime(DOB), }; if (IsB) { newemp.Sex = true; } if (IsG) { newemp.Sex = false; } if (string.IsNullOrEmpty(obj)) { //Create new customer var objresult = await employee_Repo.Add(newemp); if (objresult != null) { dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListEmployee.Add(objresult); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } else { //update customer newemp.EmpID = Convert.ToInt32(obj); if (await employee_Repo.Update(newemp)) { dc = new DialogContent() { Content = "Cập Nhật Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListEmployee = new ObservableCollection <Employee>(await employee_Repo.GetAllAsync()); } else { dc = new DialogContent() { Content = "Cập Nhật Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
private async void SubmitCategory(string obj) { try { var newcate = new ProductCategory() { Name = NameCate, Description = DesCate }; if (string.IsNullOrEmpty(obj)) { //Create new category var objresult = await categories_Repo.Add(newcate); if (objresult != null) { dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListCatelogys.Add(objresult); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } else { //update category newcate.CatelogyID = Convert.ToInt32(ProCateID); if (await categories_Repo.Update(newcate)) { dc = new DialogContent() { Content = "Cập Nhật Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListCatelogys = new ObservableCollection <ProductCategory>(categories_Repo.GetAll()); } else { dc = new DialogContent() { Content = "Cập Nhật Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private async void Submit(string obj) { try { var newcus = new Customer() { Email = Email, Address = Address, Avatar = ImgCus.ConvertToByte(), Name = Name, Phone = Phone, }; if (IsB) { newcus.Sex = true; } if (IsG) { newcus.Sex = false; } if (Kind != null) { newcus.Kind = ListKinds.IndexOf(Kind); } if (string.IsNullOrEmpty(obj)) { //Create new customer var objresult = await customer_repo.Add(newcus); if (objresult != null) { dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListCustomer.Add(objresult); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } else { //update customer newcus.CusID = Convert.ToInt32(obj); if (await customer_repo.Update(newcus)) { dc = new DialogContent() { Content = "Cập Nhật Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListCustomer = new ObservableCollection <Customer>(await customer_repo.GetAllAsync()); } else { dc = new DialogContent() { Content = "Cập Nhật Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
protected DryDialog show_dialog(string title, string heading, float top, float left, float dialog_width, bool modal, InnerDialogContent content) { close_dialog(); string response = ""; string err_msg = ""; int focus_count = 5; //wrapper for the given content which adds some of the common functionality DialogContent dc = new DialogContent(d => { //close on escape key press Event e = Event.current; if (e.type == EventType.KeyDown && e.keyCode == KeyCode.Escape) { close_dialog(); } //main dialog style_override = "dialog.section"; v_section(() => { if (!String.IsNullOrEmpty(heading)) { label(heading, "h2"); } if (!String.IsNullOrEmpty(err_msg)) { label(err_msg, "error"); } //display error message if any response = content(d); //render main dialog content which will return a response string. if (!String.IsNullOrEmpty(response) && response != "200") //collect any error message returned (as next pass response will be empty again). { err_msg = response; } }); //autofocus on textfield/area - the reason for the focous_count countdown is because we only want to focus on the field just after creating the dialog //but one the first (few) passes it doesn't appear to be ready, so this slightly hacky solution keeps setting the focus for first 5 passes. if (focus_count > 0) { auto_focus_field = "dialog_focus_field"; focus_count--; } //close dialog on OK response if (response == "200") { close_dialog(); } }); if (modal) { ModalDialog dialog = gameObject.AddOrGetComponent <ModalDialog>(); dialog.dialog_pos = new Rect(left, top, dialog_width, 80f); dialog.window_title = title; dialog.content = dc; dialog.skin = CraftManager.skin; return(dialog); } else { DryDialog dialog = gameObject.AddOrGetComponent <DryDialog>(); dialog.window_pos = new Rect(left, top, dialog_width, 80f); dialog.window_title = title; dialog.content = dc; dialog.skin = CraftManager.skin; return(dialog); } }