private void InitializeLoginPage() { var curve = GameApp.Service<ResourceManager>().Acquire<Curve>("Curves/CardMove"); var candFmtOptions = new Graphics.TextRenderer.FormatOptions(new Graphics.TextRenderer.FontDescriptor("Microsoft YaHei", 11)); m_txtUserName = new UI.TextBox(100, 30, m_textFormatOptions, candFmtOptions) { ForeColor = Color.Red, SelectionBackColor = new Color(255, 0, 0, 0.75f), SlidingCurve = curve, Transform = MatrixHelper.Translate(462, 200), Dispatcher = Root }; m_txtPassword = new UI.TextBox(100, 30, m_textFormatOptions, candFmtOptions) { ForeColor = Color.Red, SelectionBackColor = new Color(255, 0, 0, 0.75f), PasswordChar = '*', SlidingCurve = curve, Transform = MatrixHelper.Translate(462, 250), Dispatcher = Root, }; TextRenderer.IFormattedText textUserName = GameApp.Service<TextRenderer>().FormatText("用户名: ", m_textFormatOptions); var lblUserName = new UI.Label() { TextColor = Color.Red, Dispatcher = Root, FormattedText = textUserName, Transform = MatrixHelper.Translate(350, 200) }; TextRenderer.IFormattedText textPassword = GameApp.Service<TextRenderer>().FormatText("密码: ", m_textFormatOptions); var lblPassword = new UI.Label() { TextColor = Color.Red, Dispatcher = Root, FormattedText = textPassword, Transform = MatrixHelper.Translate(350, 250) }; TextRenderer.IFormattedText textMessage = GameApp.Service<TextRenderer>().FormatText(string.Empty, m_textFormatOptions); m_lblMessage = new UI.Label() { TextColor = Color.Red, Dispatcher = Root, FormattedText = textMessage, Transform = MatrixHelper.Translate(350, 300) }; var resourceMgr = GameApp.Service<ResourceManager>(); var buttonTexture = resourceMgr.Acquire<Graphics.VirtualTexture>("atlas:Textures/UI/InGame/Atlas0$Button"); Graphics.TexturedQuad m_buttonFace = new Graphics.TexturedQuad(buttonTexture); TextRenderer.IFormattedText textLoginButton = GameApp.Service<TextRenderer>().FormatText("登录", m_textFormatOptions); var btnLogin = new UI.Button() { Dispatcher = Root, ButtonText = textLoginButton, TextColor = Color.White, Transform = MatrixHelper.Translate(300, 350), NormalFace = m_buttonFace }; btnLogin.MouseButton1Down += new EventHandler<UI.MouseEventArgs>(btnLogin_MouseButton1Down); TextRenderer.IFormattedText textReturnButton = GameApp.Service<TextRenderer>().FormatText("返回", m_textFormatOptions); var btnReturn = new UI.Button() { Dispatcher = Root, ButtonText = textReturnButton, TextColor = Color.White, Transform = MatrixHelper.Translate(450, 350), NormalFace = m_buttonFace }; btnReturn.MouseButton1Down += delegate(object sender, UI.MouseEventArgs e) { Root.Dispatcher = null; GameApp.Service<MenuUI>().Startup(); }; TextRenderer.IFormattedText textRegister = GameApp.Service<TextRenderer>().FormatText("注册", m_textFormatOptions); var btnRegister = new UI.Button() { Dispatcher = Root, ButtonText = textRegister, TextColor = Color.White, Transform = MatrixHelper.Translate(600, 350), NormalFace = m_buttonFace }; btnRegister.MouseButton1Down += delegate(object sender, UI.MouseEventArgs e) { System.Diagnostics.Process.Start("http://touhouspring.com"); }; }
//---------------------------------------------------------------------- public ListViewColumn( ListView _listView, string _strText, int _iWidth, Anchor _anchor ) { Width = _iWidth; Label = new UI.Label( _listView.Screen, _strText ); Anchor = _anchor; }
public MainWindow() : base() { try { Global.Skin = new UI.Skin(); Global.Settings = new Settings(Application.StartupPath + "\\Steamp3.Settings.xml"); Global.MediaPlayer = new Steamp3.MediaPlayer(); Global.Steam = new Steamp3.Steam(); Global.Stats = new Stats(); Global.Skin = new UI.Skin(Global.Stats.Skin); Global.ToolTip = new UI.ToolTip(); CheckForUpdates(false); MaximizeBox = false; //? Size = new Size(Global.Settings.WindowWidth, Global.Settings.WindowHeight); p_TabContainer = new UI.TabContainer(this, null); p_TabContainer.AddRange(new UI.Tab[] { new UI.Tab("¯", "Playlist"), new UI.Tab("", "Library"), new UI.Tab("º", "Radio"), new UI.Tab("^", "Commands"), new UI.Tab("%", "Achievements"), new UI.Tab(">", "Skins"), new UI.Tab("~", "Plug-ins"), new UI.Tab("@", "Settings") }); p_TabContainer.SelectedItemChanged += new EventHandler(p_TabContainer_SelectedItemChanged); p_Playlist = new UI.Playlist(this, p_TabContainer); p_Playlist.Mask = "No files found."; p_BackButton = new UI.Button(this, p_TabContainer, "7", string.Empty, "Previous"); p_BackButton.Enabled = false; p_BackButton.MouseClick += new MouseEventHandler(p_BackButton_MouseClick); p_PlayButton = new UI.Button(this, p_TabContainer, "4", string.Empty, "Play"); p_PlayButton.Enabled = false; p_PlayButton.MouseClick += new MouseEventHandler(p_PlayButton_MouseClick); p_StopButton = new UI.Button(this, p_TabContainer, "<", string.Empty, "Stop"); p_StopButton.Enabled = false; p_StopButton.MouseClick += new MouseEventHandler(p_StopButton_MouseClick); p_NextButton = new UI.Button(this, p_TabContainer, "8", string.Empty, "Next"); p_NextButton.Enabled = false; p_NextButton.MouseClick += new MouseEventHandler(p_NextButton_MouseClick); p_RandomButton = new UI.Button(this, p_TabContainer, "s", string.Empty, "Random"); p_RandomButton.Enabled = false; p_RandomButton.MouseClick += new MouseEventHandler(p_RandomButton_MouseClick); p_RecordButton = new UI.Button(this, p_TabContainer, "=", string.Empty, "Record"); p_RecordButton.Enabled = false; p_RefreshButton = new UI.Button(this, p_TabContainer, "q", string.Empty, "Refresh Playlist"); p_RefreshButton.Enabled = false; p_RefreshButton.MouseClick += new MouseEventHandler(p_RefreshButton_MouseClick); p_VolumeDropDown = new UI.DropDown(this, p_TabContainer, "Xð", string.Empty, "Volume"); p_VolumeDropDown.AddRange(new string[] { "100%", "75%", "50%", "25%", "-", "0% (Mute)" }); p_VolumeDropDown.DrawArrow = false; p_VolumeDropDown.SelectedIndexChanged += new EventHandler(p_VolumeDropDown_SelectedIndexChanged); p_VolumeDropDown.UpdateText = false; p_PlayModeDropDown = new UI.DropDown(this, p_TabContainer, "6", string.Empty, "Play-mode"); p_PlayModeDropDown.AddRange(new string[] { "Continuous", "Reverse", "Repeat", "Shuffle", "-", "(None)" }); p_PlayModeDropDown.DrawArrow = false; p_PlayModeDropDown.SelectedIndexChanged += new EventHandler(p_PlayModeDropDown_SelectedIndexChanged); p_PlayModeDropDown.UpdateText = false; p_SeekBar = new UI.SeekBar(this, p_TabContainer); p_SeekBar.Enabled = false; p_SeekBar.MouseDown += new MouseEventHandler(p_SeekBar_MouseDown); p_SeekBar.MouseMove += new MouseEventHandler(p_SeekBar_MouseMove); p_SeekBar.MouseUp += new MouseEventHandler(p_SeekBar_MouseUp); p_Library = new UI.Library(this, p_TabContainer); p_Library.Mask = "No playlists found."; p_Library.Visible = false; p_StationList = new UI.StationList(this, p_TabContainer); p_StationList.Mask = "No stations found."; p_StationList.Visible = false; p_CommandList = new UI.CommandList(this, p_TabContainer); p_CommandList.Mask = "No commands found."; p_CommandList.Visible = false; p_AchievementList = new UI.AchievementList(this, p_TabContainer); p_AchievementList.Mask = "No achievements found."; p_AchievementList.Visible = false; p_SkinList = new UI.SkinList(this, p_TabContainer); p_SkinList.Mask = "No skins found."; p_SkinList.Visible = false; p_PluginList = new UI.PluginList(this, p_TabContainer); p_PluginList.Mask = "No plug-ins found."; p_PluginList.Visible = false; p_GeneralSettingsLabel = new UI.Label(this, p_TabContainer, "General Settings"); p_GeneralSettingsLabel.DrawSeparator = true; p_GeneralSettingsLabel.Visible = false; p_MusicFolderGroup = new UI.FolderBrowserGroup(this, p_TabContainer, "Music folder:", Global.Settings.MusicFolder, "The directory containing your playlists and music files"); p_MusicFolderGroup.DefaultButtonClicked += new EventHandler(p_MusicFolderGroup_DefaultButtonClicked); p_MusicFolderGroup.FolderChanged += new EventHandler(p_MusicFolderGroup_FolderChanged); p_MusicFolderGroup.Visible = false; p_TriggerGroup = new UI.DropDownGroup(this, p_TabContainer, "Command trigger:", Global.FormatString(Global.Settings.Trigger, "(None)"), "A prefix can be used to trigger commands", new string[] { "(None)", "~", "!", "@", ".", "/" }); p_TriggerGroup.Visible = false; p_TriggerGroup.DefaultButtonClicked += new EventHandler(p_TriggerGroup_DefaultButtonClicked); p_TriggerGroup.SelectedIndexChanged += new EventHandler(p_TriggerGroup_SelectedIndexChanged); p_GlobalCheckBox = new UI.CheckBox(this, p_TabContainer, "Enable global commands", "Global commands can be triggered by anyone"); p_GlobalCheckBox.Checked = Global.Settings.GlobalCommands; p_GlobalCheckBox.MouseClick += new MouseEventHandler(p_GlobalCheckBox_MouseClick); p_GlobalCheckBox.Visible = false; p_NotificationsCheckBox = new UI.CheckBox(this, p_TabContainer, "Scroll media notifications", "Play music without disturbing your friends"); p_NotificationsCheckBox.Checked = Global.Settings.Notifications; p_NotificationsCheckBox.MouseClick += new MouseEventHandler(p_NotificationsCheckBox_MouseClick); p_NotificationsCheckBox.Visible = false; p_SilentCheckBox = new UI.CheckBox(this, p_TabContainer, "Enable silent mode", "Disable all text sent to group chats and private messages"); p_SilentCheckBox.Checked = Global.Settings.Silent; p_SilentCheckBox.MouseClick += new MouseEventHandler(p_SilentCheckBox_MouseClick); p_SilentCheckBox.Visible = false; p_WebSettingsLabel = new UI.Label(this, p_TabContainer, "Web Settings"); p_WebSettingsLabel.DrawSeparator = true; p_WebSettingsLabel.Visible = false; p_ImageLocationGroup = new UI.DropDownGroup(this, p_TabContainer, "Artist images:", (int)Global.Settings.ImageLocation, "Choose how STEAMp3 should display artist images", new string[] { "(None)", "Download random image from Last.fm", "Download random image from Google", "Display ID3 album art (Not recommended)" }); p_ImageLocationGroup.Enabled = false; p_ImageLocationGroup.DefaultButtonClicked += new EventHandler(p_PlaylistFormatGroup_DefaultButtonClicked); p_ImageLocationGroup.SelectedIndexChanged += new EventHandler(p_PlaylistFormatGroup_SelectedIndexChanged); p_ImageLocationGroup.Visible = false; p_ImageQualityGroup = new UI.DropDownGroup(this, p_TabContainer, "Image quality:", (int)Global.Settings.ImageQuality, "Choose the size of artist images", new string[] { "Low (<100 KB)", "Medium (100-500 KB)", "High (>500 KB)" }); p_ImageQualityGroup.Enabled = false; p_ImageQualityGroup.DefaultButtonClicked += new EventHandler(p_PlaylistFormatGroup_DefaultButtonClicked); p_ImageQualityGroup.SelectedIndexChanged += new EventHandler(p_PlaylistFormatGroup_SelectedIndexChanged); p_ImageQualityGroup.Visible = false; p_AdvancedSettingsLabel = new UI.Label(this, p_TabContainer, "Advanced Settings"); p_AdvancedSettingsLabel.DrawSeparator = true; p_AdvancedSettingsLabel.Visible = false; p_MusicFilterGroup = new UI.DropDownGroup(this, p_TabContainer, "Music filter:", Global.Settings.MusicFilter, "Types of files that will be added to the playlist", new string[] { ".mp3", ".mp3;.wav", ".mp3;.wma", ".mp3;.wav;.wma", ".mp3;.m4a;.wav;.wma", ".mp3;.m4a;.wav;.wma;.ogg;.flac" }); p_MusicFilterGroup.Visible = false; p_MusicFilterGroup.DefaultButtonClicked += new EventHandler(p_MusicFilterGroup_DefaultButtonClicked); p_MusicFilterGroup.SelectedIndexChanged += new EventHandler(p_MusicFilterGroup_SelectedIndexChanged); p_PlaylistFormatGroup = new UI.DropDownGroup(this, p_TabContainer, "Playlist format:", Global.Settings.PlaylistFormat, "Customize the appearance of playlist items", new string[] { "{Artist} - {Title}", "{Artist} - {Album} - {Title}", "{Artist} - {Album} - {Track} - {Title}", "{Title} by {Artist}", "{URL}" }); p_PlaylistFormatGroup.DefaultButtonClicked += new EventHandler(p_PlaylistFormatGroup_DefaultButtonClicked); p_PlaylistFormatGroup.SelectedIndexChanged += new EventHandler(p_PlaylistFormatGroup_SelectedIndexChanged); p_PlaylistFormatGroup.Visible = false; p_OutputDeviceGroup = new UI.DropDownGroup(this, p_TabContainer, "Output device*:", Global.Settings.OutputDevice, "The device used to play audio files (Windows 7/8 Only)", Global.MediaPlayer.GetDeviceNames()); p_OutputDeviceGroup.DefaultButtonClicked += new EventHandler(p_OutputDeviceGroup_DefaultButtonClicked); p_OutputDeviceGroup.SelectedIndexChanged += new EventHandler(p_OutputDeviceGroup_SelectedIndexChanged); p_OutputDeviceGroup.Visible = false; SetOutputDevice(Global.Settings.OutputDevice); //? p_RecordingDeviceGroup = new UI.DropDownGroup(this, p_TabContainer, "Recording device*:", 0, "The device used to record sound (Windows 7/8 Only)", new string[] { "Microphone" }); p_RecordingDeviceGroup.Enabled = false; p_RecordingDeviceGroup.Visible = false; //SetRecordingDevice(Global.Settings.RecordingDevice); p_MainMenu = new UI.Menu(null); p_MainMenu.AddRange(new UI.MenuItem[] { new UI.MenuItem("¯", "Playlist"), new UI.MenuItem("", "Library"), new UI.MenuItem("º", "Radio"), new UI.MenuItem("^", "Commands"), new UI.MenuItem("%", "Achievements"), new UI.MenuItem(">", "Skins"), new UI.MenuItem("~", "Plug-ins"), new UI.MenuItem("@", "Settings"), new UI.MenuItem(string.Empty, "-"), new UI.MenuItem("þ", "Check for Updates..."), new UI.MenuItem("", "Release Notes..."), new UI.MenuItem(string.Empty, "-"), new UI.MenuItem("i", "About STEAMp3..."), new UI.MenuItem(string.Empty, "-"), new UI.MenuItem("r", "Exit") }); p_MainMenu.ItemClicked += new EventHandler(p_MainMenu_ItemClicked); p_NotifyIcon = new NotifyIcon(); p_NotifyIcon.MouseClick += new MouseEventHandler(p_NotifyIcon_MouseClick); p_NotifyIcon.MouseDoubleClick += new MouseEventHandler(p_NotifyIcon_MouseDoubleClick); p_NotifyIcon.Icon = this.Icon; p_NotifyIcon.Text = "STEAMp3"; p_NotifyIcon.Visible = true; //p_FileSystemWatcher = new FileSystemWatcher(Global.Settings.MusicFolder); //p_FileSystemWatcher.IncludeSubdirectories = true; //p_FileSystemWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName; //p_FileSystemWatcher.Created += new FileSystemEventHandler(p_FileSystemWatcher_Created); //p_FileSystemWatcher.Deleted += new FileSystemEventHandler(p_FileSystemWatcher_Deleted); //p_FileSystemWatcher.Renamed += new RenamedEventHandler(p_FileSystemWatcher_Renamed); //p_FileSystemWatcher.EnableRaisingEvents = false; //? } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public override void LoadContent(ContentManager Content) { base.LoadContent(Content); wndPanel.LoadContent(Content); wndPanel.DrawWindow = false; UI.Button bClose = new UI.Button(new Rectangle(WindowRectangle.Width - 112, WindowRectangle.Height - 48, 96, 32)); bClose.Parent = wndPanel; bClose.LoadContent(Content); bClose.Text = "Cancel"; bClose.Clicked += bClose_Clicked; wndPanel.AddWindow("btnClose", bClose); UI.Button bCreate = new UI.Button(new Rectangle(WindowRectangle.Width - bClose.WindowRectangle.Width - 16 - 112, WindowRectangle.Height - 48, 96, 32)); bCreate.Parent = wndPanel; bCreate.LoadContent(Content); bCreate.Text = "Create"; bCreate.Clicked += bCreate_Clicked; wndPanel.AddWindow("btnCreate", bCreate); UI.ComboBox cboWorldType = new ComboBox(new Rectangle(WindowRectangle.X + 9, WindowRectangle.Y + 104, 256, 32)); cboWorldType.LoadContent(Content); cboWorldType.AddItem("Forest Jungle"); cboWorldType.AddItem("Prison Cells"); cboWorldType.AddItem("Sandy Beach"); cboWorldType.SelectedItem = "Forest Jungle"; wndPanel.AddWindow("cboWorldType", cboWorldType); UI.Label lblWorldType = new UI.Label(new Rectangle(0, 74, wndPanel.WindowRectangle.Width, 20)); lblWorldType.Parent = wndPanel; lblWorldType.LoadContent(Content); lblWorldType.Text = "World Type"; wndPanel.AddWindow("lblWorldType", lblWorldType); UI.Label lblName = new UI.Label(new Rectangle(0, 12, wndPanel.WindowRectangle.Width, 20)); lblName.Parent = wndPanel; lblName.LoadContent(Content); lblName.Text = "Level Name:"; wndPanel.AddWindow("lblLvlName", lblName); UI.TextBox txtLevelName = new TextBox(new Rectangle(4, lblName.WindowRectangle.Height * 2, wndPanel.WindowRectangle.Width - 10, 32)); txtLevelName.Parent = wndPanel; txtLevelName.LoadContent(Content); txtLevelName.Clicked += txtLevelName_Clicked; txtLevelName.OnTabPressed += txtLevelName_OnTabPressed; txtLevelName.Text = "bla"; wndPanel.AddWindow("txtLevelName", txtLevelName); UI.Label lblSize = new UI.Label(new Rectangle(0, 140, wndPanel.WindowRectangle.Width, 20)); lblSize.Parent = wndPanel; lblSize.LoadContent(Content); lblSize.Text = "World Size (In Tiles)"; wndPanel.AddWindow("lblSize", lblSize); UI.Label lblWorldWidth = new UI.Label(new Rectangle(0, 180, 150, 20)); lblWorldWidth.Parent = wndPanel; lblWorldWidth.LoadContent(Content); lblWorldWidth.Text = "World Width:"; wndPanel.AddWindow("lblWorldWidth", lblWorldWidth); UI.Label lblWorldHeight = new UI.Label(new Rectangle(220, 180, 50, 20)); lblWorldHeight.Parent = wndPanel; lblWorldHeight.LoadContent(Content); lblWorldHeight.Text = "World Height:"; wndPanel.AddWindow("lblWorldHeight", lblWorldHeight); UI.TextBox txtWorldWidth = new TextBox(new Rectangle(140, 175, 80, 32)); txtWorldWidth.Parent = wndPanel; txtWorldWidth.LoadContent(Content); txtWorldWidth.MaxLength = 3; txtWorldWidth.Clicked += txtLevelWidth_Clicked; txtWorldWidth.OnTabPressed += txtWorldWidth_OnTabPressed; txtWorldWidth.NumericBox = true; txtWorldWidth.Text = "22"; wndPanel.AddWindow("txtLevelWidth", txtWorldWidth); UI.TextBox txtLevelHeight = new TextBox(new Rectangle(360, 175, 80, 32)); txtLevelHeight.Parent = wndPanel; txtLevelHeight.LoadContent(Content); txtLevelHeight.NumericBox = true; txtLevelHeight.MaxLength = 3; txtLevelHeight.Text = "22"; txtLevelHeight.Clicked += txtLevelHeight_Clicked; txtLevelHeight.OnTabPressed += txtLevelHeight_OnTabPressed; wndPanel.AddWindow("txtLevelHeight", txtLevelHeight); UI.CheckBox chkWater = new CheckBox(new Rectangle(4, WindowRectangle.Height - 48, 150, 24)); chkWater.Parent = wndPanel; chkWater.LoadContent(Content); chkWater.Text = "Water Level"; chkWater.WindowClicked += chkWater_WindowClicked; wndPanel.AddWindow("chkWater", chkWater); UI.TextBox txtWaterLevel = new TextBox(new Rectangle(160, WindowRectangle.Height - 48, 40, 32)); txtWaterLevel.Parent = wndPanel; txtWaterLevel.LoadContent(Content); txtWaterLevel.NumericBox = true; txtWaterLevel.MaxLength = 1; txtWaterLevel.Text = DEFAULT_WATER_LEVEL; txtWaterLevel.Clicked += txtWaterLevel_Clicked; txtWaterLevel.OnTabPressed += txtWaterLevel_OnTabPressed; txtWaterLevel.OnEnterPressed += txtWaterLevel_OnEnterPressed; txtWaterLevel.Visible = false; wndPanel.AddWindow("txtWaterLevel", txtWaterLevel); }
//---------------------------------------------------------------------- public ListViewColumn(ListView _listView, string _strText, int _iWidth, Anchor _anchor) { Width = _iWidth; Label = new UI.Label(_listView.Screen, _strText); Anchor = _anchor; }