private async void ProjectNew_ExecuteRequested(XamlUICommand sender, ExecuteRequestedEventArgs args) { // Prompt user to save unsaved changes (if applicable) if (await ProceedAfterPromptToSaveChanges() == false) { return; } var dlg = new TextPromptDialog { Title = "New Project", PromptText = "Enter a name for the new project", PrimaryButtonText = "OK", CloseButtonText = "Cancel" }; var dlgResult = await dlg.ShowAsync(); if (dlgResult == ContentDialogResult.Primary) { ActiveProject = new Project { Name = dlg.Text } } ; }
private async void MediaLibraryRenameItem_ExecuteRequested(XamlUICommand sender, ExecuteRequestedEventArgs args) { var dlg = new TextPromptDialog { Title = "Rename Item", PromptText = "Enter a different name for the item", Text = ActiveNode.Name, PrimaryButtonText = "OK", CloseButtonText = "Cancel" }; var dlgResult = await dlg.ShowAsync(); if (dlgResult == ContentDialogResult.Primary) { ActiveNode.Name = dlg.Text; ActiveProject.HasUnsavedChanges = true; } }
private async void PlayerNewClip_ExecuteRequested(XamlUICommand sender, ExecuteRequestedEventArgs args) { if (!(PlayableSource is IMarkable markable) || Slider.SelectionStart == null || Slider.SelectionEnd == null) { return; } SelectedMarker = null; var dlg = new TextPromptDialog { Title = "New Clip", PromptText = "Enter a name for the clip", PrimaryButtonText = "OK", CloseButtonText = "Cancel" }; var dlgResult = await dlg.ShowAsync(); if (dlgResult == ContentDialogResult.Primary) { var marker = new Marker { Name = dlg.Text, Position = (decimal)Slider.SelectionStart, Duration = (decimal)Slider.SelectionEnd - (decimal)Slider.SelectionStart }; var insertionIndex = 0; while (insertionIndex < markable.Markers.Count && markable.Markers[insertionIndex].Position <= marker.Position) { insertionIndex++; } markable.Markers.Insert(insertionIndex, marker); } }
private async void MediaLibraryNewFolder_ExecuteRequested(XamlUICommand sender, ExecuteRequestedEventArgs args) { // Prompt user for the name of the new project var dlg = new TextPromptDialog { Title = "New Folder", PromptText = "Enter a name for the new folder", PrimaryButtonText = "OK", CloseButtonText = "Cancel" }; var dlgResult = await dlg.ShowAsync(); if (dlgResult == ContentDialogResult.Primary) { ActiveNode.Children.Add(new MediaTreeFolder { Name = dlg.Text }); ActiveProject.HasUnsavedChanges = true; } }
private void buOK_Click(object sender, EventArgs e) { settime = 0; // กำหนดค่า settime ใน Countdown ให้เป็น 0 เป็นค่าเริ่มต้น if (m.Text == "" && s.Text == "") { MessageBox.Show("กรุณากรอกข้อมูล"); // เช็คกรณีที่ข้อมูลใน m และ s ว่างเปล่า ให้ขึ้น MessageBox ให้โชว์ "กรุณากรอกข้อมูล" } else // กรณีไม่เข้าเงื่อนไขข้างบน { if (m.Text == "") { m.Text = "0"; // ถ้า m ว่างเปล่าให้มีค่าเป็น "0" } else if (s.Text == "") { s.Text = "0"; // ถ้า s ว่างเปล่าให้มีค่าเป็น "0" } string mm, ss; settime = int.Parse(m.Text) * 60 + int.Parse(s.Text); // กำหนดค่า settime ใน Countdown ให้เป็นเวลาวินาที นำค่านาทีของ m มาคูณ 60 แล้วบวกกับวินาทีของตัวแปร s if (int.Parse(m.Text) > 9) { mm = m.Text.ToString(); } else { mm = "0" + m.Text.ToString(); } if (int.Parse(s.Text) > 9) { ss = s.Text.ToString(); } else { ss = "0" + s.Text.ToString(); } label2.Text = mm + ":" + ss; MessageBox.Show("เวลาที่จะนับถอยหลัง : " + (Countdown.settime).ToString() + " วินาที"); // ให้ขึ้น MessageBox โชว์วินาทีที่กำหนด run = true; // ให้ run เป็น true // ส่วนกำหนดเวลาเส้นตาย DialogResult dialogResult = MessageBox.Show("คุณต้องการตั้งค่าเวลาเส้นตายใช่หรือไม่", "ตั้งค่าเวลาแจ้งเตือนก่อนเส้นตาย", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { var prompt = new TextPromptDialog("ตั้งค่านาทีเส้นตาย :", "นาทีเส้นตาย", ""); prompt.ShowDialog(); if (prompt.Value != "") { if (tools.check_num(prompt.Value) == false) // เรียกใช้ tools.check_num() ให้กับเช็คว่าเป็นตัวเลขหรือไม่ ถ้าไม่ { prompt.Value = "0"; } } else { prompt.Value = "0"; } var prompt2 = new TextPromptDialog("ตั้งค่าวินาทีเส้นตาย :", "วินาทีเส้นตาย", ""); prompt2.ShowDialog(); if (prompt2.Value != "") { if (tools.check_num(prompt2.Value) == false) // เรียกใช้ tools.check_num() ให้กับเช็คว่าเป็นตัวเลขหรือไม่ ถ้าไม่ { prompt2.Value = "0"; } } else { prompt2.Value = "0"; } last_time = double.Parse(prompt.Value) * 60 + double.Parse(prompt2.Value); } if (settime != 0) // ถ้า settime ไม่เป็น 0 { button1.Text = "กำลังนับถอยหลัง..."; // ให้ข้อความใน button1 เป็น "กำลังนับถอยหลัง..." timer1.Enabled = true; // ให้เปิดการใช้งาน timer1 timer1.Start(); // ให้เริ่มการทำงาน timer1 } else // กรณีไม่เข้าเงื่อนไขข้างบน { label2.Text = "00:00:00"; // ให้ข้อความของ label2 เป็น "00:00:00" MessageBox.Show("กรุณาตั้งค่าเวลานับถอยหลัง"); // ขึ้น MessageBox โดยมีข้อความ "กรุณาตั้งค่าเวลานับถอยหลัง" } } }