public static bool EditTitle(Button b, Dictionary <string, Mp3Info> buttonMp3s) { var mp3 = buttonMp3s[b.Name]; if (mp3 == null || (mp3.HasName && mp3.HasPath)) { MessageBox.Show(Strings.NoTrackToEdit, Strings.NoTrackToRename, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } var newTitle = InputPrompt.ShowDialog(Strings.EnterNewTrackTitle, Strings.NewTrackTitle, mp3.Name); if (buttonMp3s.ContainsKey(b.Name)) { buttonMp3s[b.Name].Name = newTitle; b.Text = buttonMp3s[b.Name].Name; } FileHelpers.SaveSettings(buttonMp3s); return(false); }
void item_PlayerAddedToRoster(object sender, EventArgs e) { PlayerModel player = (PlayerModel)sender; TeamRoster teamRoster = new TeamRoster(); teamRoster.TeamID = TeamID; teamRoster.PlayerID = player.Player.PlayerID; teamRoster.UniformNumber = "0"; teamRoster.Active = "Y"; BaseTableDataAccess.Instance().UpsertTeamRoster(teamRoster); Common.Instance().SetTeamRosterPromptForJersey(TeamID, TeamName, player.Player.PlayerID); if (GameID != 0) { if (App.gPromptForJersey == true) { InputPrompt input = new InputPrompt(); InputScope scope = new InputScope(); InputScopeName name = new InputScopeName(); name.NameValue = InputScopeNameValue.Number; scope.Names.Add(name); input.Completed += input_Completed; input.Title = AppResources.JerseyNumber; input.Message = AppResources.EnterPlayersJerseyNumber; input.InputScope = scope; input.Show(); } App.gPromptForJersey = false; } else //Player List was called from Rosters screen so go back to that screen to get jersey number { (Application.Current.RootVisual as Frame).GoBack(); } }
private void send_sms1_click(object sender, RoutedEventArgs e) { try { ListBoxItem contextMenuListItem = (ListBoxItem)(prochains_bus.ItemContainerGenerator.ContainerFromItem(((MenuItem)sender).DataContext)); prochains_binding item = (prochains_binding)contextMenuListItem.Content; var input = new InputPrompt(); input.Completed += input_Completed; input.Message = "Votre numéro de téléphone"; me.current_id = item.id; if (IsolatedStorageSettings.ApplicationSettings.Contains("number")) { input.Value = (String)IsolatedStorageSettings.ApplicationSettings["number"]; } input.Show(); } catch { } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (NavigationContext.QueryString.Count > 0) { int teamID = Convert.ToInt32(NavigationContext.QueryString["teamID"]); if (teamID != 0) { _vm.Initialize(teamID); } } //Since we are using GoBack I did not have parameters to use so I needed to set some global variables to know //if user got here because they clicked back button or added a player //If added a player want to prompty for uniform number, if hit back button they did not add a player so no //need to prompt. (if using Navigate instead of GoBack I would have had parameters, but Navigate was acting very //weird and was contantly going back and forth between player list and team roster screen. if (App.gPromptForJersey == true) { InputPrompt input = new InputPrompt(); InputScope scope = new InputScope(); InputScopeName name = new InputScopeName(); name.NameValue = InputScopeNameValue.Number; scope.Names.Add(name); input.Completed += input_Completed; input.Title = AppResources.JerseyNumber; input.InputScope = scope; input.Message = AppResources.EnterPlayersJerseyNumber; input.Show(); } App.gPromptForJersey = false; }
void SetupPrompt() { // Create prompt label. var label = m_Type <= Type.Fire3 ? Enum.GetName(typeof(Type), m_Type) : m_OtherKey.ToString(); m_PromptLabel = m_Type >= Type.Fire1 && m_Type <= Type.Fire3 ? label.Insert(4, " ") : label; // Check if there is already an existing prompt in the scope. foreach (var brick in m_ScopedBricks) { var inputTriggers = brick.GetComponents <InputTrigger>(); foreach (var inputTrigger in inputTriggers) { if (inputTrigger.m_InputPrompt) { m_InputPrompt = inputTrigger.m_InputPrompt; break; } } } // Create a new prompt if none was found. if (!m_InputPrompt) { var boundsCenter = m_ScopedBounds.center; var promptPosition = new Vector3(boundsCenter.x, boundsCenter.y + m_ScopedBounds.extents.y + k_PromptHeight, boundsCenter.z); GameObject go = Instantiate(m_InputPromptPrefab, promptPosition, Quaternion.identity, transform); m_InputPrompt = go.GetComponent <InputPrompt>(); } // Add this Input Trigger to the prompt. var activeFromStart = (m_Enable == Enable.Always || m_ActiveColliders.Count > 0) && IsVisible(); m_InputPrompt.AddLabel(m_PromptLabel, activeFromStart, m_Distance); }
private void RenameListEntry(object sender, ListBox list) { ListBoxItem contextMenuListItem = list.ItemContainerGenerator.ContainerFromItem((sender as MenuItem).DataContext) as ListBoxItem; ROMDBEntry re = contextMenuListItem.DataContext as ROMDBEntry; InputPrompt prompt = new InputPrompt(); prompt.Completed += (o, e2) => { if (e2.PopUpResult == PopUpResult.Ok) { if (String.IsNullOrWhiteSpace(e2.Result)) { MessageBox.Show(AppResources.RenameEmptyString, AppResources.ErrorCaption, MessageBoxButton.OK); } else { if (e2.Result.ToLower().Equals(re.DisplayName.ToLower())) { return; } if (this.db.IsDisplayNameUnique(e2.Result)) { re.DisplayName = e2.Result; this.db.CommitChanges(); FileHandler.UpdateROMTile(re.FileName); } else { MessageBox.Show(AppResources.RenameNameAlreadyExisting, AppResources.ErrorCaption, MessageBoxButton.OK); } } } }; prompt.Title = AppResources.RenamePromptTitle; prompt.Message = AppResources.RenamePromptMessage; prompt.Value = re.DisplayName; prompt.Show(); }
private void dt_Tick(object sender, EventArgs e) { try { FrameworkDispatcher.Update(); } catch { } this.TB_Time.set_Text(DateTime.get_Now().ToString("hh:mm")); this.TB_Second.set_Text(DateTime.get_Now().ToString("ss") ?? ""); this.TB_TimeOfDay.set_Text(TimeOfDay.GetTimeOfDay(DateTime.get_Now())); if (this.isMatch) { TimeSpan span = DateTime.get_Now() - this._matchStartTime; if (span.get_TotalSeconds() > 15.0) { if (this.marks.IsMarked(this.max_DB)) { this.stopMeasure(); InputPrompt prompt = new InputPrompt(); prompt.Completed += new EventHandler <PopUpEventArgs <string, PopUpResult> >(this, this.input_Completed); prompt.Title = "请输入你的昵称:"; prompt.Message = "本次最高为 " + this.max_DB.ToString("f1") + " dB\n你已经创造了一条记录!"; prompt.Show(); } else { MessageBox.Show("本次最高为 " + this.max_DB.ToString("f1") + " dB"); this.min_DB = this.buffMinDB; this.max_DB = this.buffMaxDB; this.isMatch = false; this.update(); } } } }
public override void Prompt(string message, Action <PromptResult> promptResult, string title, string okText, string cancelText, string placeholder, int textLines) { // TODO: multiline text this.Dispatch(() => { var yes = false; var input = new InputPrompt { Title = title, Message = message, IsCancelVisible = true, }; input.ActionPopUpButtons.Clear(); var btnYes = new Button { Content = okText }; btnYes.Click += (sender, args) => { yes = true; input.Hide(); }; var btnNo = new Button { Content = cancelText }; btnNo.Click += (sender, args) => input.Hide(); input.ActionPopUpButtons.Clear(); input.ActionPopUpButtons.Add(btnYes); input.ActionPopUpButtons.Add(btnNo); input.Completed += (sender, args) => promptResult(new PromptResult { Ok = yes, Text = input.Value }); input.Show(); }); }
protected internal override void Enter() { Task.Run(async() => { ConsoleWriter.Info($"[env]: {GlobalSettings.TargetEnv}"); ConsoleWriter.Info($"[account]: {GlobalSettings.MyAccount}"); ConsoleWriter.Prompt("Input [mode] > "); var input = await InputPrompt.Create(); var mode = $"MODE_{input}"; foreach (Main.EventTrigger e in Enum.GetValues(typeof(Main.EventTrigger))) { if (Enum.GetName(typeof(Main.EventTrigger), e).ToLower() == mode.ToLower()) { StateMachine.SendEvent(e); ConsoleWriter.Succeeded($"ok."); return; } } ConsoleWriter.Error($"{input}: mode not found."); StateMachine.SendEvent(Main.EventTrigger.Continue); }); }
private void List_Documents_SelectionChanged(object sender, SelectionChangedEventArgs e) //选中ListBox项 { if (isSelected == 0) //直接选中状态 { string file_way = ""; string name = ""; if (this.top_Text.DataContext.ToString() != "目标文件") { isSelected = 0; foreach (var lbi in List_Documents.SelectedItems) { if (lbi != null) { string image = ((lbi as Documents_Item).ImageUrl).ToString(); name = ((lbi as Documents_Item).Name).ToString(); if (image == "/images/Hard_Disk.png" || image == "/images/Folder.png") { nowName = name; value = 1; nowWay += nowName; lastWay = Get_Last(nowWay, nowName); if (nowWay != @"C:\" && nowWay != @"D:\" && nowWay != @"E:\" && nowWay != @"F:\" && nowWay != @"G:\" && nowWay != @"H:\" && nowWay != @"I:\") { nowWay += @"\"; } } else { value = 2; file_way = nowWay; file_way += name; } } } } if (value == 1) { value = 0; Debug.WriteLine(nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString()); Client.SendCommand(@"size?1|" + nowWay); //发送指令来回收大小 int size = Client.Receive(@"size?1|" + nowWay); //接收大小 Client.SendCommand(@"1|" + nowWay, size); //发送指令来回收数据 string re_str = Client.Receive(size); //接收数据 Debug.WriteLine("第八" + re_str + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString()); if (re_str == "|||***|||") { re_str = ""; } Debug.WriteLine("0000" + re_str, DateTime.Now.ToShortTimeString()); this.top_Text.DataContext = new Now_Top(nowName); Bind_Data(re_str); } else if (value == 2) { value = 0; string[] type = name.Split('.'); if (type[type.Length - 1] == "txt") //txt文件预览 { Client.SendCommand(@"size?3|" + file_way); //发送指令来回收大小 int size = Client.Receive(@"size?3|" + file_way); //接收大小 Client.SendCommand(@"3|" + file_way, size); //发送指令来回收数据 byte[] re_str1 = Client.Receive(size, size); //接收数据 string re_str = System.Text.Encoding.UTF8.GetString(re_str1, 0, size); if (re_str == "|||***|||") { re_str = ""; } Debug.WriteLine("第九" + re_str + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString()); Debug.WriteLine("txt" + re_str, DateTime.Now.ToShortTimeString()); file_way = ""; Debug.WriteLine("1234" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString()); goToto = 1; //判断下一个页面去向 this.NavigationService.Navigate(new Uri("/File_Preview.xaml?top=" + name + "&doc=" + re_str, UriKind.Relative)); } else { foreach (var lbi in List_Documents.SelectedItems) { if (lbi != null) { pitch_on_name = ((lbi as Documents_Item).Name).ToString(); pitch_on_image = ((lbi as Documents_Item).ImageUrl).ToString(); } } string cmdway = nowWay; Client.SendCommand(@"size?4|" + cmdway + pitch_on_name); //发送指令来回收大小 int size = Client.Receive(@"size?4|" + cmdway + pitch_on_name); //接收大小 if (size < 4096000) { Client.SendCommand(@"4|" + cmdway + pitch_on_name, size); //发送指令来回收数据 byte[] re_str = Client.Receive(size, size); //接收数据 string re_str1 = System.Text.Encoding.UTF8.GetString(re_str, 0, size); if (re_str1 == "|||***|||") { Save_Write_File_Now(re_str, 0); } else { Save_Write_File_Now(re_str, 1); } } pitch_on_name = ""; //选中的名字 pitch_on_image = ""; //选中的图片 } } } else if (isSelected == 1) //重命名选中状态 { isSelected = 0; foreach (var lbi in List_Documents.SelectedItems) { if (lbi != null) { pitch_on_name = ((lbi as Documents_Item).Name).ToString(); pitch_on_image = ((lbi as Documents_Item).ImageUrl).ToString(); } } var input_Box = new InputPrompt { Title = "重命名", Message = "请输入新文件名称", }; input_Box.Completed += ReName; input_Box.Show(); } else if (isSelected == 2) //保存选中状态 { isSelected = 0; foreach (var lbi in List_Documents.SelectedItems) { if (lbi != null) { pitch_on_name = ((lbi as Documents_Item).Name).ToString(); pitch_on_image = ((lbi as Documents_Item).ImageUrl).ToString(); } } if (pitch_on_image != "/images/Hard_Disk.png" && pitch_on_image != "/images/Folder.png") { string cmdway = nowWay; //if (nowWay != @"C:\" && nowWay != @"D:\" && nowWay != @"E:\" && nowWay != @"F:\" && nowWay != @"G:\" && nowWay != @"H:\" && nowWay != @"I:\") //{ // cmdway += @"\"; //} Client.SendCommand(@"size?4|" + cmdway + pitch_on_name); //发送指令来回收大小 int size = Client.Receive(@"size?4|" + cmdway + pitch_on_name); //接收大小 Client.SendCommand(@"4|" + cmdway + pitch_on_name, size); //发送指令来回收数据 byte[] re_str = Client.Receive(size, size); //接收数据 string re_str1 = System.Text.Encoding.UTF8.GetString(re_str, 0, size); if (re_str1 == "|||***|||") { Save_Write_File(re_str, 0); } else { Save_Write_File(re_str, 1); } Debug.WriteLine("第十" + re_str + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString()); var messagePrompt = new MessagePrompt { Title = "保存文件", Body = new TextBlock { Text = "成功保存文件!" }, IsAppBarVisible = true, }; messagePrompt.Show(); } else { var messagePrompt = new MessagePrompt { Title = "保存文件", Body = new TextBlock { Text = "无法保存文件夹!" }, IsAppBarVisible = true, }; messagePrompt.Show(); } pitch_on_name = ""; //选中的名字 pitch_on_image = ""; //选中的图片 Client.SendCommand(@"size?1|" + nowWay); //发送指令来回收大小 int size1 = Client.Receive(@"size?1|" + nowWay); //接收大小 Client.SendCommand(@"1|" + nowWay, size1); //发送指令来回收数据 string re_str2 = Client.Receive(size1); //接收数据 Debug.WriteLine("第十一" + re_str2 + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString()); this.top_Text.DataContext = new Now_Top(nowName); Bind_Data(re_str2); } else if (isSelected == 3) //删除选中状态 { isSelected = 0; foreach (var lbi in List_Documents.SelectedItems) { if (lbi != null) { pitch_on_name = ((lbi as Documents_Item).Name).ToString(); pitch_on_image = ((lbi as Documents_Item).ImageUrl).ToString(); } } var messagePrompt = new MessagePrompt { Title = "删除文件", Body = new TextBlock { Text = "是否确定删除?" }, IsAppBarVisible = true, IsCancelVisible = true }; messagePrompt.Completed += select; messagePrompt.Show(); } }
public static ToolStripItem[] RecentMenu(this RecentFiles recent, Action <string> loadFileCallback, bool autoload = false, bool romloading = false) { var items = new List <ToolStripItem>(); if (recent.Empty) { var none = new ToolStripMenuItem { Enabled = false, Text = "None" }; items.Add(none); } else { foreach (var filename in recent) { string caption = filename; string path = filename; string physicalPath = filename; bool crazyStuff = true; //sentinel for newer format OpenAdvanced type code if (romloading) { if (filename.StartsWith("*")) { var oa = OpenAdvancedSerializer.ParseWithLegacy(filename); caption = oa.DisplayName; crazyStuff = false; if (oa is OpenAdvanced_OpenRom) { crazyStuff = true; physicalPath = ((oa as OpenAdvanced_OpenRom).Path); } } } //TODO - do TSMI and TSDD need disposing? yuck var item = new ToolStripMenuItem { Text = caption }; items.Add(item); item.Click += (o, ev) => { loadFileCallback(path); }; var tsdd = new ToolStripDropDownMenu(); if (crazyStuff) { //TODO - use standard methods to split filename (hawkfile acquire?) var hf = new HawkFile(); hf.Parse(physicalPath); bool canExplore = true; if (!File.Exists(hf.FullPathWithoutMember)) { canExplore = false; } if (canExplore) { //make a menuitem to show the last modified timestamp var timestamp = File.GetLastWriteTime(hf.FullPathWithoutMember); var tsmiTimestamp = new ToolStripLabel { Text = timestamp.ToString() }; tsdd.Items.Add(tsmiTimestamp); tsdd.Items.Add(new ToolStripSeparator()); if (hf.IsArchive) { //make a menuitem to let you copy the path var tsmiCopyCanonicalPath = new ToolStripMenuItem { Text = "&Copy Canonical Path" }; tsmiCopyCanonicalPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(physicalPath); }; tsdd.Items.Add(tsmiCopyCanonicalPath); var tsmiCopyArchivePath = new ToolStripMenuItem { Text = "Copy Archive Path" }; tsmiCopyArchivePath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(hf.FullPathWithoutMember); }; tsdd.Items.Add(tsmiCopyArchivePath); var tsmiOpenArchive = new ToolStripMenuItem { Text = "Open &Archive" }; tsmiOpenArchive.Click += (o, ev) => { System.Diagnostics.Process.Start(hf.FullPathWithoutMember); }; tsdd.Items.Add(tsmiOpenArchive); } else { //make a menuitem to let you copy the path var tsmiCopyPath = new ToolStripMenuItem { Text = "&Copy Path" }; tsmiCopyPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(physicalPath); }; tsdd.Items.Add(tsmiCopyPath); } tsdd.Items.Add(new ToolStripSeparator()); //make a menuitem to let you explore to it var tsmiExplore = new ToolStripMenuItem { Text = "&Explore" }; string explorePath = "\"" + hf.FullPathWithoutMember + "\""; tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", "/select, " + explorePath); }; tsdd.Items.Add(tsmiExplore); var tsmiCopyFile = new ToolStripMenuItem { Text = "Copy &File" }; var lame = new System.Collections.Specialized.StringCollection(); lame.Add(hf.FullPathWithoutMember); tsmiCopyFile.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetFileDropList(lame); }; tsdd.Items.Add(tsmiCopyFile); var tsmiTest = new ToolStripMenuItem { Text = "&Shell Context Menu" }; tsmiTest.Click += (o, ev) => { var si = new GongSolutions.Shell.ShellItem(hf.FullPathWithoutMember); var scm = new GongSolutions.Shell.ShellContextMenu(si); var tsddi = o as ToolStripDropDownItem; tsddi.Owner.Update(); scm.ShowContextMenu(tsddi.Owner, new System.Drawing.Point(0, 0)); }; tsdd.Items.Add(tsmiTest); tsdd.Items.Add(new ToolStripSeparator()); } else { //make a menuitem to show the last modified timestamp var tsmiMissingFile = new ToolStripLabel { Text = "-Missing-" }; tsdd.Items.Add(tsmiMissingFile); tsdd.Items.Add(new ToolStripSeparator()); } } //crazystuff //in any case, make a menuitem to let you remove the item var tsmiRemovePath = new ToolStripMenuItem { Text = "&Remove" }; tsmiRemovePath.Click += (o, ev) => { recent.Remove(path); }; tsdd.Items.Add(tsmiRemovePath); ////experiment of popping open a submenu. doesnt work well. //item.MouseDown += (o, mev) => //{ // if (mev.Button != MouseButtons.Right) return; // //location of the menu containing this item that was just rightclicked // var pos = item.Owner.Bounds.Location; // //the offset within that menu of this item // var tsddi = item as ToolStripDropDownItem; // pos.Offset(tsddi.Bounds.Location); // //the offset of the click // pos.Offset(mev.Location); // //tsdd.OwnerItem = item; //has interesting promise, but breaks things otherwise // tsdd.Show(pos); //}; //just add it to the submenu for now. seems to work well enough, even though its a bit odd item.MouseDown += (o, mev) => { if (mev.Button != MouseButtons.Right) { return; } if (item.DropDown != null) { item.DropDown = tsdd; } item.ShowDropDown(); }; } } items.Add(new ToolStripSeparator()); var clearitem = new ToolStripMenuItem { Text = "&Clear", Enabled = !recent.Frozen }; clearitem.Click += (o, ev) => recent.Clear(); items.Add(clearitem); var freezeitem = new ToolStripMenuItem { Text = recent.Frozen ? "&Unfreeze" : "&Freeze" }; freezeitem.Click += (o, ev) => recent.Frozen ^= true; items.Add(freezeitem); if (autoload) { var auto = new ToolStripMenuItem { Text = "&Autoload", Checked = recent.AutoLoad }; auto.Click += (o, ev) => recent.ToggleAutoLoad(); items.Add(auto); } var settingsitem = new ToolStripMenuItem { Text = "&Recent Settings..." }; settingsitem.Click += (o, ev) => { using (var prompt = new InputPrompt { TextInputType = InputPrompt.InputType.Unsigned, Message = "Number of recent files to track", InitialValue = recent.MAX_RECENT_FILES.ToString() }) { var result = prompt.ShowDialog(); if (result == DialogResult.OK) { int val = int.Parse(prompt.PromptText); if (val > 0) { recent.MAX_RECENT_FILES = val; } } } }; items.Add(settingsitem); return(items.ToArray()); }
public DiskSelector(Screen screen, string initialDiskPath, Mod initialDiskMod, Progress progress) { m_geometry = new Geometry(Primitive.Triangles); m_disks = ArcadeUtils.GetAllDisks().ToArray(); m_disksUnlocked = m_disks.Select(disk => ArcadeUtils.IsDiskUnlocked(disk.Disk, disk.Mod, progress)).ToArray(); m_page = 0; if (m_disks.Length <= COLUMNS_PER_PAGE) { m_numColumns = m_disks.Length; m_numRows = 1; } else if (m_disks.Length < NUM_PER_PAGE) { m_numColumns = (m_disks.Length + ROWS_PER_PAGE - 1) / ROWS_PER_PAGE; m_numRows = ROWS_PER_PAGE; } else { m_numColumns = COLUMNS_PER_PAGE; m_numRows = ROWS_PER_PAGE; } m_highlight = -1; m_backPrompt = new InputPrompt(UIFonts.Smaller, screen.Language.Translate("menus.close"), TextAlignment.Right); m_backPrompt.Key = Key.Escape; m_backPrompt.MouseButton = MouseButton.Left; m_backPrompt.GamepadButton = GamepadButton.B; m_backPrompt.SteamControllerButton = SteamControllerButton.MenuBack; m_backPrompt.Anchor = Anchor.BottomRight; m_backPrompt.LocalPosition = new Vector2(-16.0f, -16.0f - m_backPrompt.Height); m_backPrompt.Parent = this; m_backPrompt.OnClick += delegate(object o, EventArgs args) { m_closeNextFrame = true; }; m_selectPrompt = new InputPrompt(UIFonts.Smaller, screen.Language.Translate("menus.select"), TextAlignment.Left); m_selectPrompt.Key = Key.Return; m_selectPrompt.GamepadButton = GamepadButton.A; m_selectPrompt.SteamControllerButton = SteamControllerButton.MenuSelect; m_selectPrompt.Anchor = Anchor.BottomLeft; m_selectPrompt.LocalPosition = new Vector2(16.0f, -16.0f - m_selectPrompt.Height); m_selectPrompt.Parent = this; m_browseWorkshopPrompt = new InputPrompt(UIFonts.Smaller, screen.Language.Translate("menus.arcade.browse_workshop"), TextAlignment.Right); m_browseWorkshopPrompt.Key = Key.LeftCtrl; m_browseWorkshopPrompt.GamepadButton = GamepadButton.Y; m_browseWorkshopPrompt.SteamControllerButton = SteamControllerButton.MenuAltSelect; m_browseWorkshopPrompt.Anchor = Anchor.BottomRight; m_browseWorkshopPrompt.LocalPosition = new Vector2(-16.0f, -16.0f - m_selectPrompt.Height - m_browseWorkshopPrompt.Height); m_browseWorkshopPrompt.Parent = this; m_previousPageButton = new Button(Texture.Get("gui/arrows.png", true), 32.0f, 32.0f); m_previousPageButton.Region = new Quad(0.0f, 0.5f, 0.5f, 0.5f); m_previousPageButton.HighlightRegion = m_previousPageButton.Region; m_previousPageButton.DisabledRegion = m_previousPageButton.Region; m_previousPageButton.ShortcutButton = GamepadButton.LeftBumper; m_previousPageButton.AltShortcutButton = GamepadButton.LeftTrigger; m_previousPageButton.ShortcutSteamControllerButton = SteamControllerButton.MenuPreviousPage; m_previousPageButton.Colour = UIColours.Title; m_previousPageButton.HighlightColour = UIColours.White; m_previousPageButton.DisabledColour = m_previousPageButton.Colour; m_previousPageButton.Anchor = Anchor.CentreMiddle; m_previousPageButton.LocalPosition = new Vector2( -0.5f * (float)COLUMNS_PER_PAGE * (DISK_SIZE + DISK_PADDING) - m_previousPageButton.Width, -0.5f * m_previousPageButton.Height ); m_previousPageButton.Parent = this; m_previousPageButton.OnClicked += delegate(object o, EventArgs e) { PreviousPage(); }; m_nextPageButton = new Button(Texture.Get("gui/arrows.png", true), 32.0f, 32.0f); m_nextPageButton.Region = new Quad(0.0f, 0.0f, 0.5f, 0.5f); m_nextPageButton.HighlightRegion = m_nextPageButton.Region; m_nextPageButton.DisabledRegion = m_nextPageButton.Region; m_nextPageButton.ShortcutButton = GamepadButton.RightBumper; m_nextPageButton.AltShortcutButton = GamepadButton.RightTrigger; m_nextPageButton.ShortcutSteamControllerButton = SteamControllerButton.MenuNextPage; m_nextPageButton.Colour = UIColours.Title; m_nextPageButton.HighlightColour = UIColours.White; m_nextPageButton.DisabledColour = m_nextPageButton.Colour; m_nextPageButton.Anchor = Anchor.CentreMiddle; m_nextPageButton.LocalPosition = new Vector2( 0.5f * (float)COLUMNS_PER_PAGE * (DISK_SIZE + DISK_PADDING), -0.5f * m_previousPageButton.Height ); m_nextPageButton.Parent = this; m_nextPageButton.OnClicked += delegate(object o, EventArgs e) { NextPage(); }; // Load labels m_diskLabels = new Texture[m_disks.Length]; for (int i = 0; i < m_disks.Length; ++i) { var disk = m_disks[i]; var labelPath = AssetPath.ChangeExtension(disk.Disk.Path, "png"); if (disk.Mod != null) { if (disk.Mod.Assets.CanLoad(labelPath)) { m_diskLabels[i] = disk.Mod.Assets.Load <Texture>(labelPath); m_diskLabels[i].Filter = false; } } else { m_diskLabels[i] = Texture.Get(labelPath, false); } } m_framesOpen = 0; m_closeNextFrame = false; // Determine initial disk index m_initialDisk = -1; if (initialDiskPath != null && m_disks.Length > 0) { for (int i = 0; i < m_disks.Length; ++i) { var disk = m_disks[i]; if (disk.Disk.Path == initialDiskPath && disk.Mod == initialDiskMod && m_disksUnlocked[i]) { m_initialDisk = i; break; } } } }
protected MenuState(Game game, string title, string level, MenuArrangement arrangement) : base(game, level, LevelOptions.Menu) { m_unlocalisedTitle = title; m_unlocalisedBack = "menus.back"; m_unlocalisedAltSelect = "menus.select"; // Create camera m_animatedCamera = new AnimatedCameraController(Level.TimeMachine); // Create title menu { m_titleMenu = new TextMenu(UIFonts.Default, new string[] { Game.Language.Translate(title), }, TextAlignment.Center, MenuDirection.Vertical); if (arrangement == MenuArrangement.RobotScreen) { m_titleMenu.Anchor = Anchor.TopMiddle; m_titleMenu.LocalPosition = new Vector2(0.0f, 40.0f); } else { m_titleMenu.Anchor = Anchor.TopMiddle; m_titleMenu.LocalPosition = new Vector2(0.0f, 32.0f); } m_titleMenu.TextColour = UIColours.Title; m_titleMenu.Enabled = false; m_titleMenu.MouseOnly = true; m_titleMenu.OnClicked += delegate(object sender, TextMenuClickedEventArgs e) { if (Dialog == null) { OnTitleClicked(); } }; } // Create prompts { m_backPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate(m_unlocalisedBack), TextAlignment.Right); m_backPrompt.Key = Key.Escape; m_backPrompt.MouseButton = MouseButton.Left; m_backPrompt.GamepadButton = GamepadButton.B; m_backPrompt.SteamControllerButton = SteamControllerButton.MenuBack; if (arrangement == MenuArrangement.RobotScreen) { m_backPrompt.Anchor = Anchor.BottomMiddle; m_backPrompt.LocalPosition = new Vector2(225.0f, -40.0f - m_backPrompt.Font.Height); } else { m_backPrompt.Anchor = Anchor.BottomRight; m_backPrompt.LocalPosition = new Vector2(-16.0f, -16.0f - m_backPrompt.Font.Height); } m_backPrompt.OnClick += delegate(object sender, EventArgs e) { GoBack(); }; } { m_selectPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.select"), TextAlignment.Left); m_selectPrompt.Key = Key.Return; m_selectPrompt.GamepadButton = GamepadButton.A; m_selectPrompt.SteamControllerButton = SteamControllerButton.MenuSelect; if (arrangement == MenuArrangement.RobotScreen) { m_selectPrompt.Anchor = Anchor.BottomMiddle; m_selectPrompt.LocalPosition = new Vector2(-224.0f, -40.0f - m_selectPrompt.Font.Height); } else { m_selectPrompt.Anchor = Anchor.BottomLeft; m_selectPrompt.LocalPosition = new Vector2(16.0f, -16.0f - m_selectPrompt.Font.Height); } m_selectPrompt.Visible = false; } { m_altSelectPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate(m_unlocalisedAltSelect), TextAlignment.Left); m_altSelectPrompt.Key = Key.Tab; m_altSelectPrompt.GamepadButton = GamepadButton.Y; m_altSelectPrompt.SteamControllerButton = SteamControllerButton.MenuAltSelect; m_altSelectPrompt.Anchor = m_selectPrompt.Anchor; m_altSelectPrompt.LocalPosition = m_selectPrompt.LocalPosition + new Vector2(0.0f, -m_altSelectPrompt.Font.Height); m_altSelectPrompt.Visible = false; } }
private void icon_Comment1_Click(object sender, EventArgs e) { if (this.IsEnabled == false) { return; } if (this.DetailType != Model.AppOnly.DetailType.News && Tool.CheckLogin( ) == false) { //无法发表评论 } else { string title, author, url, id; int commentCount; if (GetUrl_Title_Author_CommentCount(out id, out url, out title, out author, out commentCount)) { InputPrompt input = new InputPrompt { Title = "发表评论", Message = string.Format("对 {0}", title), IsCancelVisible = true, IsSubmitOnEnterKey = false, }; //验证缓存 Dictionary <string, string> cacheCommentPub = Config.Cache_CommentPub; input.Value = cacheCommentPub.ContainsKey(string.Format("{0}_{1}", this.DetailType, id)) ? cacheCommentPub[string.Format("{0}_{1}", this.DetailType, id)] : string.Empty; input.OnValueChanged += (s, e1) => { Dictionary <string, string> cacheCommentsPub = Config.Cache_CommentPub; cacheCommentsPub[string.Format("{0}_{1}", this.DetailType, id)] = e1.Text; Config.Cache_CommentPub = cacheCommentsPub; }; if (this.DetailType == Model.AppOnly.DetailType.Tweet) { input.Message = string.Empty; } input.Completed += (s, e1) => { if (e1.PopUpResult == PopUpResult.Ok) { if (e1.Result.Length == 0) { MessageBox.Show("发表的评论内容不能为空"); return; } Dictionary <string, object> parameters = null; if (this.DetailType != Model.AppOnly.DetailType.Blog) { parameters = new Dictionary <string, object> { { "catalog", this.GetPubCommentType }, { "id", id }, { "uid", Config.UID }, { "content", e1.Result }, //{"isPostToMyZone", this.DetailType == CommentType.Tweet ? ((bool)this.checkResendToZone.IsChecked ? "1" : "0" ): "0"}, { "isPostToMyZone", "1" }, }; } else { parameters = new Dictionary <string, object> { { "blog", id }, { "uid", Config.UID }, { "content", e1.Result }, }; } PostClient client = Tool.SendPostClient(this.DetailType == Model.AppOnly.DetailType.Blog ? Config.api_blogcomment_pub : Config.api_comment_pub, parameters); client.DownloadStringCompleted += (s1, e2) => { if (e2.Error != null) { System.Diagnostics.Debug.WriteLine("发表评论时网络错误: {0}", e2.Error.Message); return; } ApiResult result = Tool.GetApiResult(e2.Result); if (result != null) { switch (result.errorCode) { case 1: //进入评论列表页 改变 pivot 的 selectIndex if (Config.Cache_CommentPub.ContainsKey(string.Format("{0}_{1}", this.DetailType, id))) { Config.Cache_CommentPub.Remove(string.Format("{0}_{1}", this.DetailType, id)); } this.icon_Refresh_Click(null, null); if (this.pivot.SelectedIndex != 1) { this.pivot.SelectedIndex = 1; } break; case 0: case -1: case -2: MessageBox.Show(result.errorMessage, "温馨提示", MessageBoxButton.OK); break; } } }; } }; input.Show( ); } } }
/// <summary> /// 评论点击 回复该评论 /// </summary> private void list_Comment_SelectionChanged(object sender, SelectionChangedEventArgs e) { //登陆判断 if (this.catalog != ( int )CommentType.News && Tool.CheckLogin( ) == false) { //无法发表评论 } else { CommentUnit c = this.list_Comment.SelectedItem as CommentUnit; this.list_Comment.SelectedItem = null; if (c != null) { InputPrompt input = new InputPrompt { Title = "回复这条评论", Message = c.content, IsCancelVisible = true, IsSubmitOnEnterKey = false, Value = Config.GetCache_CommentReply(this.id, c.id), }; input.OnValueChanged += (s, e1) => { Config.SaveCache_CommentReply(e1.Text, this.id, c.id); }; input.Completed += (s, e1) => { if (e1.PopUpResult == PopUpResult.Ok) { Dictionary <string, object> parameters = null; if (this.catalog != ( int )CommentType.Blog) { parameters = new Dictionary <string, object> { { "catalog", this.catalog }, { "id", this.id }, { "replyid", c.id }, { "authorid", c.authorID }, { "uid", Config.UID }, { "content", e1.Result }, }; } else { parameters = new Dictionary <string, object> { { "blog", this.id }, { "uid", Config.UID }, { "content", e1.Result }, { "reply_id", c.id }, { "objuid", c.authorID }, }; } PostClient client = Tool.SendPostClient(this.catalog == ( int )CommentType.Blog ? Config.api_blogcomment_pub : Config.api_comment_reply, parameters); client.DownloadStringCompleted += (s1, e2) => { if (e2.Error != null) { System.Diagnostics.Debug.WriteLine("回复评论时网络错误: {0}", e2.Error.Message); return; } ApiResult result = Tool.GetApiResult(e2.Result); if (result != null) { switch (result.errorCode) { case 1: Config.SaveCache_CommentReply(null, this.id, c.id); this.listBoxHelper.Refresh( ); break; case -1: case -2: case 0: MessageBox.Show(result.errorMessage, "温馨提示", MessageBoxButton.OK); break; } } }; } }; input.Show( ); } } }
private void EnterUnlockCode() { var input = new InputPrompt { Title = "Enter your code", Message = "Please enter the code provided to you:", MessageTextWrapping = TextWrapping.Wrap }; input.Completed += async(sender, args) => { if (args.PopUpResult == PopUpResult.Ok) { var code = args.Result; var url = string.Format("http://scottisafoolws.apphb.com/ScottIsAFool/InTwo/unlock?emailaddress={0}&code={1}", _emailAddress, code); SetProgressBar("Checking code..."); try { if (!_navigationService.IsNetworkAvailable) { Log.Info("No network connection"); return; } Log.Info("Verifying unlock code"); var response = await _httpClient.GetStringAsync(url); if (response.ToLower().Equals("true")) { Log.Info("Verification successful"); var myDeviceId = (byte[])DeviceExtendedProperties.GetValue("DeviceUniqueId"); var deviceIdAsString = Convert.ToBase64String(myDeviceId); FlurryWP8SDK.Api.LogEvent("UnlockCodeSuccessfull", new List <Parameter> { new Parameter("EmailAddress", _emailAddress), new Parameter("DeviceID", deviceIdAsString) }); App.SettingsWrapper.HasRemovedAds = true; Messenger.Default.Send(new NotificationMessage(Constants.Messages.ForceSettingsSaveMsg)); MessageBox.Show("Thanks, ads have now been removed for you.", "Success", MessageBoxButton.OK); _navigationService.GoBack(); } else { MessageBox.Show("The email address and code don't match our records, sorry.", "Not verified", MessageBoxButton.OK); Log.Info("Unable to verify email [{0}] with code [{1}]", _emailAddress, code); } } catch (Exception ex) { MessageBox.Show("There was an error verifying your unlock code, please try again later.", "Error", MessageBoxButton.OK); FlurryWP8SDK.Api.LogError("UnlockCode", ex); Log.ErrorException("UnlockCode", ex); } SetProgressBar(); } }; input.Show(); }
public static ToolStripItem[] RecentMenu(this RecentFiles recent, Action<string> loadFileCallback, bool autoload = false) { var items = new List<ToolStripItem>(); if (recent.Empty) { var none = new ToolStripMenuItem { Enabled = false, Text = "None" }; items.Add(none); } else { foreach (var filename in recent) { //TODO - do TSMI and TSDD need disposing? yuck var temp = filename; var item = new ToolStripMenuItem { Text = temp }; items.Add(item); item.Click += (o, ev) => { loadFileCallback(temp); }; //TODO - use standard methods to split filename (hawkfile acquire?) var hf = new HawkFile(); hf.Parse(temp); bool canExplore = true; if (!File.Exists(hf.FullPathWithoutMember)) canExplore = false; var tsdd = new ToolStripDropDownMenu(); if (canExplore) { //make a menuitem to show the last modified timestamp var timestamp = File.GetLastWriteTime(hf.FullPathWithoutMember); var tsmiTimestamp = new ToolStripLabel { Text = timestamp.ToString() }; tsdd.Items.Add(tsmiTimestamp); tsdd.Items.Add(new ToolStripSeparator()); if (hf.IsArchive) { //make a menuitem to let you copy the path var tsmiCopyCanonicalPath = new ToolStripMenuItem { Text = "&Copy Canonical Path" }; tsmiCopyCanonicalPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(temp); }; tsdd.Items.Add(tsmiCopyCanonicalPath); var tsmiCopyArchivePath = new ToolStripMenuItem { Text = "Copy Archive Path" }; tsmiCopyArchivePath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(hf.FullPathWithoutMember); }; tsdd.Items.Add(tsmiCopyArchivePath); var tsmiOpenArchive = new ToolStripMenuItem { Text = "Open &Archive" }; tsmiOpenArchive.Click += (o, ev) => { System.Diagnostics.Process.Start(hf.FullPathWithoutMember); }; tsdd.Items.Add(tsmiOpenArchive); } else { //make a menuitem to let you copy the path var tsmiCopyPath = new ToolStripMenuItem { Text = "&Copy Path" }; tsmiCopyPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(temp); }; tsdd.Items.Add(tsmiCopyPath); } tsdd.Items.Add(new ToolStripSeparator()); //make a menuitem to let you explore to it var tsmiExplore = new ToolStripMenuItem { Text = "&Explore" }; string explorePath = "\"" + hf.FullPathWithoutMember + "\""; tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", "/select, " + explorePath); }; tsdd.Items.Add(tsmiExplore); var tsmiCopyFile = new ToolStripMenuItem { Text = "Copy &File" }; var lame = new System.Collections.Specialized.StringCollection(); lame.Add(hf.FullPathWithoutMember); tsmiCopyFile.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetFileDropList(lame); }; tsdd.Items.Add(tsmiCopyFile); var tsmiTest = new ToolStripMenuItem { Text = "&Shell Context Menu" }; tsmiTest.Click += (o, ev) => { var si = new GongSolutions.Shell.ShellItem(hf.FullPathWithoutMember); var scm = new GongSolutions.Shell.ShellContextMenu(si); var tsddi = o as ToolStripDropDownItem; tsddi.Owner.Update(); scm.ShowContextMenu(tsddi.Owner, new System.Drawing.Point(0, 0)); }; tsdd.Items.Add(tsmiTest); tsdd.Items.Add(new ToolStripSeparator()); } else { //make a menuitem to show the last modified timestamp var tsmiMissingFile = new ToolStripLabel { Text = "-Missing-" }; tsdd.Items.Add(tsmiMissingFile); tsdd.Items.Add(new ToolStripSeparator()); } //in either case, make a menuitem to let you remove the path var tsmiRemovePath = new ToolStripMenuItem { Text = "&Remove" }; tsmiRemovePath.Click += (o, ev) => { recent.Remove(temp); }; tsdd.Items.Add(tsmiRemovePath); ////experiment of popping open a submenu. doesnt work well. //item.MouseDown += (o, mev) => //{ // if (mev.Button != MouseButtons.Right) return; // //location of the menu containing this item that was just rightclicked // var pos = item.Owner.Bounds.Location; // //the offset within that menu of this item // var tsddi = item as ToolStripDropDownItem; // pos.Offset(tsddi.Bounds.Location); // //the offset of the click // pos.Offset(mev.Location); // //tsdd.OwnerItem = item; //has interesting promise, but breaks things otherwise // tsdd.Show(pos); //}; //just add it to the submenu for now item.MouseDown += (o, mev) => { if (mev.Button != MouseButtons.Right) return; if (item.DropDown != null) item.DropDown = tsdd; item.ShowDropDown(); }; } } items.Add(new ToolStripSeparator()); var clearitem = new ToolStripMenuItem { Text = "&Clear", Enabled = !recent.Frozen }; clearitem.Click += (o, ev) => recent.Clear(); items.Add(clearitem); var freezeitem = new ToolStripMenuItem { Text = recent.Frozen ? "&Unfreeze" : "&Freeze" }; freezeitem.Click += (o, ev) => recent.Frozen ^= true; items.Add(freezeitem); if (autoload) { var auto = new ToolStripMenuItem { Text = "&Autoload", Checked = recent.AutoLoad }; auto.Click += (o, ev) => recent.ToggleAutoLoad(); items.Add(auto); } var settingsitem = new ToolStripMenuItem { Text = "&Recent Settings..." }; settingsitem.Click += (o, ev) => { using (var prompt = new InputPrompt { TextInputType = InputPrompt.InputType.Unsigned, Message = "Number of recent files to track", InitialValue = recent.MAX_RECENT_FILES.ToString() }) { var result = prompt.ShowDialog(); if (result == DialogResult.OK) { int val = int.Parse(prompt.PromptText); if (val > 0) recent.MAX_RECENT_FILES = val; } } }; items.Add(settingsitem); return items.ToArray(); }
public ArcadeState(Game.Game game) : base(game, "levels/startscreen.level", LevelOptions.Menu) { // Create computer m_computer = new Computer(GetComputerID()); m_computer.Memory.TotalMemory = RAM; m_computer.Host = App.Info.Title + " " + App.Info.Version; m_computer.Output = new LogWriter(LogLevel.User); m_computer.ErrorOutput = new LogWriter(LogLevel.Error); m_computer.SetPowerStatus(PowerStatus.Charged, 1.0); m_devices = new RobotDevices(); m_computer.Ports.Add(m_devices); // Create some textures m_displayBitmap = new Bitmap(m_devices.Display.Width, m_devices.Display.Height); m_displayTexture = new BitmapTexture(m_displayBitmap); UpdateDisplay(); // Create camera m_animatedCamera = new AnimatedCameraController(Level.TimeMachine); // Create prompts { m_zKey = Key.Z.RemapToLocal(); m_xKey = Key.X.RemapToLocal(); m_wKey = Key.W.RemapToLocal(); m_sKey = Key.S.RemapToLocal(); m_aKey = Key.A.RemapToLocal(); m_dKey = Key.D.RemapToLocal(); m_backPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.back"), TextAlignment.Right); m_backPrompt.MouseButton = MouseButton.Left; m_backPrompt.Key = Key.Escape; m_backPrompt.GamepadButton = GamepadButton.Back; m_backPrompt.SteamControllerButton = SteamControllerButton.ArcadeBack; m_backPrompt.Anchor = Anchor.BottomRight; m_backPrompt.LocalPosition = new Vector2(-16.0f, -16.0f - m_backPrompt.Font.Height); m_backPrompt.OnClick += delegate { GoBack(); }; m_diskSelectPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.arcade.swap_disk"), TextAlignment.Right); m_diskSelectPrompt.Key = Key.Tab; m_diskSelectPrompt.GamepadButton = GamepadButton.Start; m_diskSelectPrompt.SteamControllerButton = SteamControllerButton.ArcadeSwapDisk; m_diskSelectPrompt.Anchor = Anchor.BottomRight; m_diskSelectPrompt.LocalPosition = new Vector2(-16.0f, -16.0f - m_backPrompt.Font.Height - m_diskSelectPrompt.Height); m_bPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.arcade.b"), TextAlignment.Left); m_bPrompt.Key = m_xKey; m_bPrompt.GamepadButton = GamepadButton.B; m_bPrompt.SteamControllerButton = SteamControllerButton.ArcadeB; m_bPrompt.Anchor = Anchor.BottomLeft; m_bPrompt.LocalPosition = new Vector2(16.0f, -16.0f - m_bPrompt.Height); m_aPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.arcade.a"), TextAlignment.Left); m_aPrompt.Key = m_zKey; m_aPrompt.GamepadButton = GamepadButton.A; m_aPrompt.SteamControllerButton = SteamControllerButton.ArcadeA; m_aPrompt.Anchor = Anchor.BottomLeft; m_aPrompt.LocalPosition = new Vector2(16.0f, -16.0f - 2.0f * m_bPrompt.Height); } // Create disk selector m_diskSelector = null; m_activeDisk = null; m_activeDiskMod = null; m_cachedScore = 0; }