public void DisplayAndConfirmAlertBox() { ConfirmBox.Click(); IAlert alert = _driver.SwitchTo().Alert(); alert.Accept(); }
public void Quit() { MainMenuHandler.DisableInputReceive(); string title = "QUIT"; string message = "Do you really want to quit?"; if (Network.isServer) { message += " Other players will immediately get disconnected."; } UnityAction yesAction = () => { FindObjectOfType <GameManager>().LoadLevel("Main Menu", 0); Network.Disconnect(200); }; UnityAction noAction = () => { Destroy(confirmDialogInstance); confirmDialogInstance = null; MainMenuHandler.EnableInputReceive(); }; confirmDialogInstance = Instantiate(confirmDialogPrefab); ConfirmBox confirmDialogInfo = confirmDialogInstance.GetComponent <ConfirmBox>(); confirmDialogInfo.title.text = title; confirmDialogInfo.message.text = message; confirmDialogInfo.yesButton.onClick.AddListener(yesAction); confirmDialogInfo.noButton.onClick.AddListener(noAction); }
protected void InitializeConfirmBox() { var _confirmPanels = GameObject.FindGameObjectsWithTag("ConfirmPanel"); _confirmPanel = _confirmPanels.Where(cp => cp.name == "ConfirmPanel").FirstOrDefault(); _confirmBox = _confirmPanel.GetComponent <ConfirmBox>(); _confirmBox.InitializeThePanel(); _confirmBox.DeactivateConfirmBox(); }
protected void InitializedLockedConfirmBox() { var _lockedPanels = GameObject.FindGameObjectsWithTag("LockedPanel"); _lockedPanel = _lockedPanels.Where(lp => lp.name == "LockedPanel").FirstOrDefault(); _lockedBox = _lockedPanel.GetComponent <ConfirmBox>(); _lockedBox.InitializeThePanel(); _lockedBox.DeactivateConfirmBox(); }
private void CmiDeleteCamera_Click(object sender, EventArgs e) { if (tvItems.SelectedNode?.Tag is Camera camera && ConfirmBox.Show(Lng.Elem("Confirmation"), Lng.Elem("Are you sure you want to delete the selected camera?"), Decide.No) == DialogResult.Yes) { cameraRepository.Remove(camera.Id); serverListProvider.GetServersAndCamera(tvItems); } }
private void CmiDeleteIssue_Click(object sender, EventArgs e) { if (tvItems.SelectedNode?.Tag is Issue issue && ConfirmBox.Show(Lng.Elem("Confirmation"), Lng.Elem("Are you sure you want to delete the selected issue?"), Decide.No) == DialogResult.Yes) { issueRepository.Remove(issue.Id); GetIssues(); } }
/// <summary> /// Zeigt eine Fehlermeldung in einer Message box an /// </summary> /// <param name="title">Der Titel</param> /// <param name="msg">Die Nachricht</param> public void ShowError(string title, string msg) { ConfirmBox.Display("Fehler", title, msg); // WPF stellt folgende Out-of-the-box-Methode zur Verfügung, // dort haben wir aber keine Styling-Möglichkeiten, weshalb // wir die eigene Lösung bevorzugen. // // MessageBox.Show(msg, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); }
private void CmiDeleteResource_Click(object sender, EventArgs e) { if (tvItems.SelectedNode?.Tag is Resource resource && ConfirmBox.Show(Lng.Elem("Confirmation"), Lng.Elem("Are you sure you want to delete the selected resource?"), Decide.No) == DialogResult.Yes) { resourceRepository.Remove(resource.Id); resourceListProvider.GetResources(tvItems); } }
private void Start() { m_Collider = GetComponent <BoxCollider2D>(); m_confirmBox = GameObject.FindGameObjectWithTag("Descent Panel").GetComponent <ConfirmBox>(); if (!m_Collider.isTrigger) { m_Collider.isTrigger = true; } }
/// <summary> /// 显示确认窗口 这个函数将来要加到ShowConfirmBoxDelegate上 /// </summary> /// <param name="text"></param> /// <returns></returns> public static DialogResult ShowConfirmBox(string text) { var dialogResault = DialogResult.OK; waitForm.Invoke(new MethodInvoker(() => { dialogResault = ConfirmBox.ShowConfirmBoxDialog(text); })); return(dialogResault); }
private void BtnDone_Click(object sender, EventArgs e) { var charactersDirectory = Path.Combine(PathProvider.Characters, tbName.Text); bool createCharacter = !Directory.Exists(charactersDirectory) || ConfirmBox.Show(Lng.Elem("Character already exists, do you want to owerwrite it?")); if (createCharacter) { DirectoryExtension.CreateIfNotExists(charactersDirectory); character.Save(Path.Combine(charactersDirectory, String.Concat("character", ExtensionProvider.CharacterSheetExtension)), images); } }
private void CmiDeleteMeeting_Click(object sender, EventArgs e) { if (tvItems.SelectedNode?.Tag is Meeting meeting && ConfirmBox.Show(Lng.Elem("Confirmation"), Lng.Elem("Are you sure you want to delete the selected meeting?"), Decide.No) == DialogResult.Yes) { meetingRepository.Remove(meeting.Id); meetingsListProvider.GetUpcomingMeetings(tvItems); calendarItemsProvider.SetBoldDates(monthCalendar); } }
private void CmiDeleteEvent_Click(object sender, EventArgs e) { if (tvItems.SelectedNode?.Tag is Event myEvent && ConfirmBox.Show(Lng.Elem("Confirmation"), Lng.Elem("Are you sure you want to delete the selected event?"), Decide.No) == DialogResult.Yes) { eventRepository.Remove(myEvent.Id); eventListProvider.GetUpcomingEvents(tvItems); calendarItemsProvider.SetBoldDates(monthCalendar); } }
public void ShowConfirmDialog(string title, string message, UnityAction yesAction, UnityAction noAction) { Destroy(dialogInstance); DisableInputReceive(); dialogInstance = Instantiate(confirmDialog); ConfirmBox confirmDialogInfo = dialogInstance.GetComponent <ConfirmBox>(); confirmDialogInfo.title.text = title; confirmDialogInfo.message.text = message; confirmDialogInfo.yesButton.onClick.AddListener(yesAction); confirmDialogInfo.noButton.onClick.AddListener(noAction); }
public static void Check() { BaseBox.Yes = Lng.Elem("Yes"); BaseBox.No = Lng.Elem("No"); try { if (ConfirmBox.Show(Lng.Elem("Confirmation"), Lng.Elem("Are you sure you want to exit? This will interrupt the setup progress."), Decide.No) == DialogResult.Yes) { Environment.Exit(1); } } catch { } }
public void ArchivingDirectory(string source, string target, bool overwriteExisting = true, bool archiveSubdirectories = true) { try { if (Directory.Exists(source)) { var overwrite = overwriteExisting; if (Directory.Exists(target)) { if (!overwriteExisting) { overwrite = ConfirmBox.Show("Confirm arhive operation", message, Decide.No) == DialogResult.Yes; } } else { Directory.CreateDirectory(target); } if (overwrite) { if (target[target.Length - 1] != '\\') { target = String.Concat(target, "\\"); } try { foreach (var filename in Directory.GetFiles(source)) { System.IO.File.Copy(filename, String.Concat(target, filename.Substring(filename.LastIndexOf('\\'))), true); } } catch { } try { if (archiveSubdirectories) { foreach (var directoryName in Directory.GetDirectories(source)) { var tergetDirectoryName = String.Concat(target, directoryName.Substring(directoryName.LastIndexOf('\\'))); ArchivingDirectory(directoryName, tergetDirectoryName, overwriteExisting); } } } catch { } } } } catch { } }
private void CreateNewUserInterface() { if (ConfirmBox.Show("Confirmation", "Are you sure you want to create a new user interface? All of your current changes will be lost!", Decide.No) == DialogResult.Yes) { tvUserInterfaceStructure.Nodes.Clear(); var rootNode = new TreeNode("RootElement", 0, 0) { Name = "UI" }; tvUserInterfaceStructure.Nodes.Add(rootNode); tvUserInterfaceStructure.ExpandAll(); GetSourceCode(); } }
private bool IsFileCreationAllowed(string filePath) { var result = false; if (File.Exists(filePath)) { if (ConfirmBox.Show("Confirmation", "Are you sure you want to overwrite the existing file?", Decide.No) == DialogResult.Yes) { result = true; } } else { result = true; } return(result); }
void TabControl_Drop(object sender, DragEventArgs e) { var files = (string[])e.Data.GetData(DataFormats.FileDrop); if (files.Length > 0) { var move = Keyboard.Modifiers == ModifierKeys.Shift; var process = move ? "Move" : "Copy"; var confirmBox = new ConfirmBox($"{process} file", $"Move already existing cards\nto the current category (if any)?"); var reorganize = confirmBox.ShowDialog().Value; foreach (var file in files) { SelectedTab.AddImageFromOutside(file, move, reorganize); } } }
void tsmi_tsmi_ExportPhonebook_Click(object sender, EventArgs e) { if (sfd_SaveFileDialog.ShowDialog() != DialogResult.OK) { return; } var save_file = true; if (File.Exists(sfd_SaveFileDialog.FileName)) { save_file = ConfirmBox.Show("File already exists", "Are you sure, you want to overwrite the selected file?") == DialogResult.OK; } if (save_file) { presenter.ExportPhoneBook(sfd_SaveFileDialog.FileName); } }
private void btnEliminaJob_Click(object sender, EventArgs e) { var id = CurrentJobId; if (!string.IsNullOrWhiteSpace(id)) { if (ConfirmBox.Execute("Sicuro di voler eliminare il job?", "Conferma")) { AppRepo.RemoveJob(id); var n = treeView1.SelectedNode; treeView1.SelectedNode = n.NextNode ?? n.PrevNode; n.Remove(); if (treeView1.SelectedNode == null) { treeView1_AfterSelect(this, null); } } } }
private void btnEliminaMail_Click(object sender, EventArgs e) { var idMail = (string)treeView1.SelectedNode?.Tag; if (!string.IsNullOrWhiteSpace(idMail)) { if (ConfirmBox.Execute("Sicuro di voler eliminare la mail?", "Conferma")) { AppRepo.RemoveMail(idMail); var n = treeView1.SelectedNode; treeView1.SelectedNode = n.NextNode ?? n.PrevNode; n.Remove(); if (treeView1.SelectedNode == null) { treeView1_AfterSelect(this, null); } } } }
private void btnEliminaSelezionati_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { if (!ConfirmBox.Execute("Si conferma l'eliminazione di " + dataGridView1.SelectedRows.Count + " email?", "Conferma")) { return; } } foreach (DataGridViewRow row in dataGridView1.SelectedRows) { var d = row.DataBoundItem as Destinatario; if (d != null) { AppRepo.RemoveDestinatario(d.Id); _elencoDestintari.Remove(d); } } }
public void BackToPauseMenu() { if (gameSettings.valueChanged) { string title = "UNSAVED CHANGES"; string message = "There are unsaved changes in the settings. Would you like to apply them first?"; UnityAction yesAction = () => { ApplySettings(); FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; Destroy(dialogInstance); dialogInstance = null; MainMenuHandler.EnableInputReceive(); }; UnityAction noAction = () => { ResetSettings(); FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; Destroy(dialogInstance); dialogInstance = null; MainMenuHandler.EnableInputReceive(); }; MainMenuHandler.DisableInputReceive(); dialogInstance = Instantiate(confirmDialogBox); ConfirmBox confirmDialogInfo = dialogInstance.GetComponent <ConfirmBox>(); confirmDialogInfo.title.text = title; confirmDialogInfo.message.text = message; confirmDialogInfo.yesButton.onClick.AddListener(yesAction); confirmDialogInfo.noButton.onClick.AddListener(noAction); } else { FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; } }
public void SaveImage(string path, string imageName, string backgroundJpgFile) { var rgx = new Regex(@"[/\\:*?<>|]"); imageName = rgx.Replace(imageName, "-"); var filename = $"{Path.Combine(path, imageName)}.jpg"; var dialogResult = DialogResult.Yes; if (File.Exists(filename)) { dialogResult = ConfirmBox.Show("File already exists", String.Concat("Do you want to overwrite existing file?", Environment.NewLine, filename), Decide.No); } if (dialogResult != DialogResult.Yes) { return; } filename = Environment.ExpandEnvironmentVariables(filename); File.Copy(backgroundJpgFile, filename, true); InfoBox.Show("Desktop image saved", $"Successfully saved as: {filename}"); }
private void btnRimuoviDuplicati_Click(object sender, EventArgs e) { var gruppi = _elencoDestintari.GroupBy(x => x.Address.ToLower(), x => x); var gruppiDoppi = gruppi.Where(x => x.Count() > 1); if (!gruppiDoppi.Any()) { MessageBox.Show("Non ci sono duplicati."); } else { var msg = $"Ci sono in tutto {gruppiDoppi.Sum(x => x.Count()-1)} duplicati." + Environment.NewLine + "Procedere con l'eliminazione?"; var res = ConfirmBox.Execute(msg, "COnferma eliminazione duplicati"); if (res) { dataGridView1.SuspendLayout(); try { foreach (var g in gruppiDoppi) { var daRimuovere = g.Skip(1).ToList(); foreach (var d in daRimuovere) { _elencoDestintari.Remove(d); AppRepo.RemoveDestinatario(d.Id); } } } finally { dataGridView1.ResumeLayout(); } } } }
public void Update() { if ((InputManager.leftMousePushed && !HoveringOverSubmenuItem()) || InputManager.anyPushed) { UntoggleAllSubmenus(); } // Exit if (backButton.clicked) { Vector2 windowCenter = new Vector2(VoezEditor.windowRes.x * 0.5f, VoezEditor.windowRes.y * 0.5f); exitConfirm = new ConfirmBox(new Rect(new Vector2(windowCenter.x - 300f, windowCenter.y - 150f), new Vector2(600f, 300f)), "Save your changes before exiting?"); exitConfirm.enableCancel = true; VoezEditor.Editor.AddObject(exitConfirm); backButton.clicked = false; } if (exitConfirm != null) { if (exitConfirm.yesButton != null && exitConfirm.yesButton.clicked) { VoezEditor.Editor.project.ExportActiveProject(); VoezEditor.Editor.readyToShutDown = true; InputManager.ignoreNextLeftRelease = true; exitConfirm.Destroy(); exitConfirm = null; } else if (exitConfirm.noButton != null && exitConfirm.noButton.clicked) { VoezEditor.Editor.readyToShutDown = true; InputManager.ignoreNextLeftRelease = true; exitConfirm.Destroy(); exitConfirm = null; } else if (exitConfirm.cancelButton != null && exitConfirm.cancelButton.clicked) { exitConfirm.Destroy(); exitConfirm = null; } } // Handle Playback Slider Dragged if (playbackSlider.progressUpdate) { VoezEditor.Editor.musicPlayer.source.time = VoezEditor.Editor.musicPlayer.source.clip.length * Mathf.Clamp(playbackSlider.progress, 0f, 0.99f); VoezEditor.Editor.currentFrame = (int)(VoezEditor.Editor.musicPlayer.source.time * VoezEditor.Editor.framesPerSecond); grid.SnapPlaytimeToGrid(); playbackSlider.progressUpdate = false; } // Update timestamp for current song time if (VoezEditor.Editor.musicPlayer.source.clip != null) { playbackSlider.allowScrubbing = true; playbackSlider.progress = VoezEditor.Editor.songTime / VoezEditor.Editor.musicPlayer.source.clip.length; if (!playbackSlider.clicked) { // If playback slider is not being dragged, show current song time. playbackTimeLabel.SetText(BeatTimeStamp(VoezEditor.Editor.songTime)); } else { // If playback slider is being dragged, show song time at slider's current position playbackTimeLabel.SetText(BeatTimeStamp(VoezEditor.Editor.musicPlayer.source.clip.length * playbackSlider.pendingProgress)); } } else { playbackSlider.allowScrubbing = false; } // Play/Pause if (playButton.clicked || InputManager.spacePushed) { if (VoezEditor.Editor.musicPlayer.paused) { VoezEditor.Editor.musicPlayer.ResumeSong(); playButton.mySymbol.element = Futile.atlasManager.GetElementWithName("pause"); } else { VoezEditor.Editor.musicPlayer.PauseSong(); playButton.mySymbol.element = Futile.atlasManager.GetElementWithName("play"); grid.SnapPlaytimeToGrid(); } playButton.clicked = false; } // Toggle Loop Point if (playbackSlider.rightClicked) { if (playbackSlider.loopPoint >= 0f) { playbackSlider.loopPoint = -1; } else { playbackSlider.loopPoint = Mathf.Clamp(playbackSlider.progress, 0f, 0.99f); } playbackSlider.rightClicked = false; } // Jump Playback To Loop Point if (playbackSlider.loopPoint >= 0f && (playButton.rightClicked || InputManager.returnPushed || InputManager.middleMousePushed)) { VoezEditor.Editor.musicPlayer.source.time = VoezEditor.Editor.musicPlayer.source.clip.length * Mathf.Clamp(playbackSlider.loopPoint, 0f, 0.99f); VoezEditor.Editor.currentFrame = (int)(VoezEditor.Editor.musicPlayer.source.time * VoezEditor.Editor.framesPerSecond); grid.SnapPlaytimeToGrid(); playButton.rightClicked = false; } // BPM Editing if (bpmButton.clicked) { bpmButton.toggled = !bpmButton.toggled; bpmButton.clicked = false; } if (bpmButton.toggled) { float lastBPM = VoezEditor.Editor.project.songBPM; if (InputManager.UpTick()) { VoezEditor.Editor.project.songBPM += 1; } if (InputManager.DownTick()) { VoezEditor.Editor.project.songBPM -= 1; } if (InputManager.RightTick()) { VoezEditor.Editor.project.songBPM += 5; } if (InputManager.LeftTick()) { VoezEditor.Editor.project.songBPM -= 5; } VoezEditor.Editor.project.songBPM = Mathf.Clamp(VoezEditor.Editor.project.songBPM, 10, 250); if (VoezEditor.Editor.project.songBPM != lastBPM && VoezEditor.Editor.EditMode) { grid.SnapPlaytimeToGrid(); } bpmButton.myText.text = "BPM" + Environment.NewLine + VoezEditor.Editor.project.songBPM.ToString(); } if (bpmButton.toggled && VoezEditor.Editor.bpmPulse) { playbackSlider.pulseFlashEffectTime = 3; VoezEditor.Editor.bg.pulseFlashEffectTime = 3; } // Open Playback Speed Menu if (playbackTimeButton.clicked) { UntoggleAllSubmenus(); if (playbackTimes == null) { SpawnPlaybackTimeButtons(); } else { DespawnPlaybackTimeButtons(); } InputManager.ClearMouseInputs(); playbackTimeButton.toggled = playbackTimes != null; playbackTimeButton.clicked = false; } // Open Notes Selection Menu if (notesButton.clicked) { UntoggleAllSubmenus(); if (noteTypes == null) { SpawnNoteButtons(); } else { DespawnNoteButtons(); } InputManager.ClearMouseInputs(); notesButton.toggled = noteTypes != null; notesButton.clicked = false; } // Open Grid Snap Menu if (gridButton.clicked) { UntoggleAllSubmenus(); if (snapTimes == null) { SpawnGridButtons(); } else { DespawnGridButtons(); } InputManager.ClearMouseInputs(); gridButton.toggled = snapTimes != null; gridButton.clicked = false; } // Open Scroll Rate Menu if (scrollButton.clicked) { UntoggleAllSubmenus(); if (scrollRates == null) { SpawnScrollButtons(); } else { DespawnScrollButtons(); } InputManager.ClearMouseInputs(); scrollButton.toggled = scrollRates != null; scrollButton.clicked = false; } // Open Sound Assist Options Menu if (soundAssistButton.clicked) { UntoggleAllSubmenus(); if (metronomeToggle == null) { SpawnSoundAssistButtons(); } else { DespawnSoundAssistButtons(); } InputManager.ClearMouseInputs(); soundAssistButton.toggled = metronomeToggle != null; soundAssistButton.clicked = false; } // Save Project if (saveButton.clicked) { VoezEditor.Editor.project.ExportActiveProject(); saveButton.clicked = false; } // Set Playback Speed if (InputManager.onePushed && !Util.ShiftDown()) { if (playbackTimes != null) { playbackTimes[0].clicked = true; } else { VoezEditor.Editor.musicPlayer.playbackSpeed = 0.25f; } } if (InputManager.twoPushed && !Util.ShiftDown()) { if (playbackTimes != null) { playbackTimes[1].clicked = true; } else { VoezEditor.Editor.musicPlayer.playbackSpeed = 0.5f; } } if (InputManager.threePushed && !Util.ShiftDown()) { if (playbackTimes != null) { playbackTimes[2].clicked = true; } else { VoezEditor.Editor.musicPlayer.playbackSpeed = 1.0f; } } if (InputManager.fourPushed && !Util.ShiftDown()) { if (playbackTimes != null) { playbackTimes[3].clicked = true; } else { VoezEditor.Editor.musicPlayer.playbackSpeed = 2.0f; } } if (playbackTimes != null) { for (int i = 0; i < playbackTimes.Length; i += 1) { if (playbackTimes[i].clicked) { for (int j = 0; j < playbackTimes.Length; j += 1) { playbackTimes[j].toggled = false; } playbackTimes[i].toggled = true; if (i == 0) { VoezEditor.Editor.musicPlayer.playbackSpeed = 0.25f; } else if (i == 1) { VoezEditor.Editor.musicPlayer.playbackSpeed = 0.5f; } else if (i == 2) { VoezEditor.Editor.musicPlayer.playbackSpeed = 1.0f; } else if (i == 3) { VoezEditor.Editor.musicPlayer.playbackSpeed = 2.0f; } playbackTimes[i].clicked = false; // Automatically close the playback time selector after a choice has been made. if (playbackTimeButton.toggled) { DespawnPlaybackTimeButtons(); InputManager.ClearMouseInputs(); playbackTimeButton.toggled = false; break; } } } } // Set Selected Note Type if (InputManager.zPushed) { if (noteTypes != null) { noteTypes[0].clicked = true; } else { VoezEditor.Editor.selectedNoteType = ProjectData.NoteData.NoteType.CLICK; notesButton.mySymbol.element = Futile.atlasManager.GetElementWithName("click"); notesButton.mySymbol.color = Note.QUANTIZATION_COLORS[0]; VoezEditor.Editor.trackEditMode = false; notesButton.mySymbol.rotation = 45f + 180f; } } if (InputManager.xPushed) { if (noteTypes != null) { noteTypes[1].clicked = true; } else { VoezEditor.Editor.selectedNoteType = ProjectData.NoteData.NoteType.SLIDE; notesButton.mySymbol.element = Futile.atlasManager.GetElementWithName("slide"); notesButton.mySymbol.color = Color.white; VoezEditor.Editor.trackEditMode = false; notesButton.mySymbol.rotation = 45f + 180f; } } if (InputManager.cPushed) { if (noteTypes != null) { noteTypes[2].clicked = true; } else { VoezEditor.Editor.selectedNoteType = ProjectData.NoteData.NoteType.SWIPE; notesButton.mySymbol.element = Futile.atlasManager.GetElementWithName("swipe"); notesButton.mySymbol.color = Color.white; VoezEditor.Editor.trackEditMode = false; notesButton.mySymbol.rotation = 45f + 180f; } } if (InputManager.vPushed) { if (noteTypes != null) { noteTypes[3].clicked = true; } else { VoezEditor.Editor.trackEditMode = true; notesButton.mySymbol.element = Futile.atlasManager.GetElementWithName("track"); notesButton.mySymbol.color = Color.white; notesButton.mySymbol.rotation = 0f; } } if (noteTypes != null) { for (int i = 0; i < noteTypes.Length; i += 1) { if (noteTypes[i].clicked) { for (int j = 0; j < noteTypes.Length; j += 1) { noteTypes[j].toggled = false; } noteTypes[i].toggled = true; noteTypes[i].clicked = false; if (i == 0) { VoezEditor.Editor.selectedNoteType = ProjectData.NoteData.NoteType.CLICK; notesButton.mySymbol.element = Futile.atlasManager.GetElementWithName("click"); notesButton.mySymbol.color = Note.QUANTIZATION_COLORS[0]; } else if (i == 1) { VoezEditor.Editor.selectedNoteType = ProjectData.NoteData.NoteType.SLIDE; notesButton.mySymbol.element = Futile.atlasManager.GetElementWithName("slide"); notesButton.mySymbol.color = Color.white; } else if (i == 2) { VoezEditor.Editor.selectedNoteType = ProjectData.NoteData.NoteType.SWIPE; notesButton.mySymbol.element = Futile.atlasManager.GetElementWithName("swipe"); notesButton.mySymbol.color = Color.white; } if (i == 3) { VoezEditor.Editor.trackEditMode = true; notesButton.mySymbol.element = Futile.atlasManager.GetElementWithName("track"); notesButton.mySymbol.color = Color.white; notesButton.mySymbol.rotation = 0f; } else { VoezEditor.Editor.trackEditMode = false; notesButton.mySymbol.rotation = 45f; } // Automatically close the note type selector after a choice has been made. if (notesButton.toggled) { DespawnNoteButtons(); InputManager.ClearMouseInputs(); notesButton.toggled = false; break; } } } } // Set Grid Snapping if (InputManager.onePushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[0].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 0; } } if (InputManager.twoPushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[1].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 16; } } if (InputManager.threePushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[2].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 12; } } if (InputManager.fourPushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[3].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 8; } } if (InputManager.fivePushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[4].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 6; } } if (InputManager.sixPushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[5].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 4; } } if (InputManager.sevenPushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[6].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 3; } } if (InputManager.eightPushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[7].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 2; } } if (InputManager.ninePushed && Util.ShiftDown()) { if (snapTimes != null) { snapTimes[8].clicked = true; } else { VoezEditor.Editor.selectedTimeSnap = 1; } } if (snapTimes != null) { for (int i = 0; i < snapTimes.Length; i += 1) { if (snapTimes[i].clicked) { for (int j = 0; j < snapTimes.Length; j += 1) { snapTimes[j].toggled = false; } snapTimes[i].toggled = true; if (i == 0) { VoezEditor.Editor.selectedTimeSnap = 0; } else if (i == 1) { VoezEditor.Editor.selectedTimeSnap = 16; } else if (i == 2) { VoezEditor.Editor.selectedTimeSnap = 12; } else if (i == 3) { VoezEditor.Editor.selectedTimeSnap = 8; } else if (i == 4) { VoezEditor.Editor.selectedTimeSnap = 6; } else if (i == 5) { VoezEditor.Editor.selectedTimeSnap = 4; } else if (i == 6) { VoezEditor.Editor.selectedTimeSnap = 3; } else if (i == 7) { VoezEditor.Editor.selectedTimeSnap = 2; } else if (i == 8) { VoezEditor.Editor.selectedTimeSnap = 1; } snapTimes[i].clicked = false; grid.SnapPlaytimeToGrid(); // Automatically close the grid snap selector after a choice has been made. if (gridButton.toggled) { DespawnGridButtons(); InputManager.ClearMouseInputs(); gridButton.toggled = false; break; } } } } // Set Scroll Rate if (scrollRates != null) { for (int i = 0; i < scrollRates.Length; i += 1) { if (scrollRates[i].clicked) { for (int j = 0; j < scrollRates.Length; j += 1) { scrollRates[j].toggled = false; } scrollRates[i].toggled = true; VoezEditor.Editor.selectedScrollRate = i + 1; Note.NOTE_DURATION = Note.SCROLL_DURATIONS[i]; VoezEditor.Editor.RefreshAllNotes(); // Automatically close the scroll rate selector after a choice has been made. if (scrollButton.toggled) { DespawnScrollButtons(); InputManager.ClearMouseInputs(); scrollButton.toggled = false; break; } } } } // Set Sound Assist Options if (metronomeToggle != null && metronomeToggle.clicked) { metronomeToggle.toggled = !metronomeToggle.toggled; VoezEditor.Editor.metronomeEnabled = metronomeToggle.toggled; metronomeToggle.clicked = false; } if (hitSoundToggle != null && hitSoundToggle.clicked) { hitSoundToggle.toggled = !hitSoundToggle.toggled; VoezEditor.Editor.hitSoundsEnabled = hitSoundToggle.toggled; hitSoundToggle.clicked = false; } if (quantizationToggle != null && quantizationToggle.clicked) { quantizationToggle.toggled = !quantizationToggle.toggled; VoezEditor.Editor.quantizationEnabled = quantizationToggle.toggled; quantizationToggle.clicked = false; } }
/// <summary> /// 一个大循环 用来操作指纹仪. /// 这个函数要放到一个线程里来执行 /// </summary> /// <param name="studentList"></param> /// <param name="updateUserInterfaceDelegate">用来操作UI的委托</param> public static void Enroll(List <Student> studentList, UpdateUserInterfaceDelegate updateUserInterfaceDelegate) { FingerPrintHandle = HdFingerprintHelper.FpOpenUsb(0xFFFFFFFF, 1000); // 打开指纹仪驱动 //while (FingerPrintHandle == IntPtr.Zero) { // var confirmResault = ShowConfirmBox ( "指纹仪初始化失败 \n是否重新初始化指纹仪?" ); // if (confirmResault == DialogResult.OK) { // FingerPrintHandle = HdFingerprintHelper.FpOpenUsb ( 0xFFFFFFFF, 1000 ); // } else { // ShowMsgBox ( "当前指纹仪无法工作,请使用手动考勤." ); // return; // } //} //如果打不开 就只能手动签到了 //上面的这些已经注释了. 因为在switch那边有对错误的处理. var acceptPlayer = new SoundPlayer(Resources.Accept); var rejectPlayer = new SoundPlayer(Resources.Reject); var fingerprintImagePath = GlobalParams.RootDir + "/fingerprint.bmp"; while (IsRollCalling) { UInt16 fingerprintid = 1000; UInt16 similarity = 0; var fingerPrintStat = HdFingerprintHelper.StartVerify(FingerPrintHandle, fingerprintImagePath, ref fingerprintid, ref similarity, 3000); if (!IsRollCalling) { return; // 如果结束点名了 这个函数直接返回即可 } switch (fingerPrintStat) { case 0: { acceptPlayer.Play(); var index = studentList.FindIndex(s => s.FingerprintId == fingerprintid); if (index == -1) { continue; } var student = studentList[index]; student.SignIn(DateTime.Now); //var fingerprintImage = new File(GlobalParams.RootDir+@"/fingerprint.bmp") var fileInfo = new FileInfo(fingerprintImagePath); Image fingerprintImage; if (fileInfo.Length != 0) { var stream = File.Open(fingerprintImagePath, FileMode.Open); fingerprintImage = Image.FromStream(stream); stream.Close(); } else { fingerprintImage = null; } var normalStudentNum = CountNormalStudent(studentList); var absentStudentNum = CountAbsentStudent(studentList); var lateStudentNum = CountLateStudent(studentList); var askForLeaveStudentNum = CountAskForLeaveStudent(studentList); var leaveEarlyStudentNum = CountLeaveEarlyStudent(studentList); var expectedStudentNum = studentList.Count; var course = new CourseInfo(expectedStudentNum: expectedStudentNum, didNotSubmitStudentNum: absentStudentNum, actualStudentNum: normalStudentNum, askForLeaveStudentNum: askForLeaveStudentNum); updateUserInterfaceDelegate(fingerprintImage, course, student); CopyOfStudentList = studentList; break; } case 9: { //这里会出现文件占用的问题. 文件->流->图片 var fileInfo = new FileInfo(fingerprintImagePath); Image fingerprintImage; if (fileInfo.Length != 0) { var stream = File.Open(fingerprintImagePath, FileMode.Open); fingerprintImage = Image.FromStream(stream); stream.Close(); } else { fingerprintImage = null; } updateUserInterfaceDelegate(fingerprintImage, null); rejectPlayer.Play(); break; } default: { var confirmResault = ConfirmBox.ShowConfirmBoxDialog(string.Format("指纹仪故障 故障代码:{0}\n 是否重新打开指纹仪", fingerPrintStat)); if (confirmResault == DialogResult.Cancel) { IsRollCalling = false; return; // 如果点了否 就结束指纹仪点名. 点是 重新初始化. 手动签到那里要判断一下(不用判断了 在switch的入口那边加了一个对IsrollCalling的一个判断.) } else { FingerPrintHandle = HdFingerprintHelper.FpOpenUsb(0xFFFFFFFF, 1000); // 重新初始化指纹仪 } break; } } } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string title = "Message box sender"; string message = "This is a default message, you can set up a custom message with the -m directive."; var messageType = MessageType.Information; var timeout = Timeout.Infinite; var decide = Decide.Yes; int i = 0; while (i < args.Length) { var arg = args[i].ToLower(); switch (arg) { case "-message": case "/message": case "-m": case "/m": message = TestArgsLength(i, args.Length) ? "No message provided." : args[++i]; break; case "-info": case "/info": case "-information": case "/information": case "-i": case "/i": messageType = MessageType.Information; break; case "-question": case "/question": case "-q": case "/q": messageType = MessageType.Question; break; case "-error": case "/error": case "-e": case "/e": messageType = MessageType.Error; break; case "-timeout": case "/timeout": timeout = TestArgsLength(i, args.Length) ? Timeout.Infinite : Convert.ToInt32(args[++i]); break; case "-title": case "/title": case "-t": case "/t": title = TestArgsLength(i, args.Length) ? "No title has been provided" : args[++i]; break; case "-yes": case "/yes": case "-y": case "/y": decide = Decide.Yes; break; case "-no": case "/no": case "-n": case "/n": decide = Decide.No; break; } i++; } switch (messageType) { case MessageType.Information: InfoBox.Show(title, message, timeout); break; case MessageType.Question: ConfirmBox.Show(title, message, timeout, decide); break; case MessageType.Error: ErrorBox.Show(title, message, timeout); break; } }
public override void Update() { base.Update(); trackProgress = (VoezEditor.Editor.songTime - data.start) / (data.end - data.start); pos.y = VoezEditor.windowRes.y * (1.0f - TRACK_SCREEN_HEIGHT); float desiredX = GetXAtTime(VoezEditor.Editor.songTime); pos.x = Util.ScreenPosX(desiredX); if (trackProgress > 1f || trackProgress < 0f) { Destroy(); } if (flashEffectTime > 0) { flashEffectTime -= 1; } if (pulseFlashEffectTime > 0) { pulseFlashEffectTime -= 1; } if (VoezEditor.Editor.ui.bpmButton.toggled && VoezEditor.Editor.bpmPulse) { pulseFlashEffectTime = 5; } if (VoezEditor.Editor.EditMode && !VoezEditor.Editor.MenuOpen && VoezEditor.Editor.trackEditMode) { // Delete Track if (activeHover && (InputManager.delPushed || (Util.ShiftDown() && InputManager.rightMousePushed))) { Vector2 windowCenter = new Vector2(VoezEditor.windowRes.x * 0.5f, VoezEditor.windowRes.y * 0.5f); int damageCount = 0; for (int i = 0; i < VoezEditor.Editor.project.notes.Count; i += 1) { if (VoezEditor.Editor.project.notes[i].track == data.id) { damageCount += 1; } } if (damageCount > 0) { // There are notes attached to this track. Warn the user before deleting it! deletionConfirm = new ConfirmBox(new Rect(new Vector2(windowCenter.x - 300f, windowCenter.y - 150f), new Vector2(600f, 300f)), "Warning:\nThere are notes attached to this track!\nDeleting it will also delete " + damageCount.ToString() + " note" + (damageCount != 1 ? "s" : "") + ".\nAre you sure you want to delete?"); VoezEditor.Editor.AddObject(deletionConfirm); } else { // Empty track, delete it immediately. VoezEditor.Editor.project.DeleteTrack(data.id); VoezEditor.Editor.RefreshAllTracks(); } } // Edit Track if (activeHover && InputManager.leftMousePushed && !VoezEditor.Editor.ui.HoveringOverSubmenuItem()) { float trackEditWindowX = 0f; if (pos.x > VoezEditor.windowRes.x * 0.5f) { trackEditWindowX = pos.x - TrackEditor.WIDTH * 0.5f - 64f; } else { trackEditWindowX = pos.x + TrackEditor.WIDTH * 0.5f + 64f; } VoezEditor.Editor.trackEditor = new TrackEditor(new Vector2(trackEditWindowX, VoezEditor.windowRes.y * 0.55f), data); VoezEditor.Editor.AddObject(VoezEditor.Editor.trackEditor); VoezEditor.Editor.ui.bpmButton.toggled = false; } } if (deletionConfirm != null) { if (deletionConfirm.yesButton != null && deletionConfirm.yesButton.clicked) { deletionConfirm.Destroy(); deletionConfirm = null; VoezEditor.Editor.project.DeleteTrack(data.id); VoezEditor.Editor.RefreshAllNotes(); VoezEditor.Editor.RefreshAllTracks(); } else if (deletionConfirm.noButton != null && deletionConfirm.noButton.clicked) { deletionConfirm.Destroy(); deletionConfirm = null; } } }