Exemple #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     this.axWindowsMediaPlayer1.URL = Environment.CurrentDirectory + @"\sfx\MouseClick.wav";
     UI.Menu menu = new UI.Menu();
     this.Close();
     menu.Show();
 }
Exemple #2
0
        public void OnDestroy()
        {
            rootObjects = null;

            importMenu = null;

            fileSelector = null;

            if (importer != null)
            {
                importer.Dispose();
            }
        }
Exemple #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((UI.Menu)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #4
0
        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 static void run()
 {
     MenuViewModel VM = new MenuViewModel(); // create the view model container
     UI.Menu MW = new UI.Menu(ref VM); // create the view.
     MW.ShowDialog(); // display the program to the user.
 }
Exemple #6
0
        public void OnGUI()
        {
            //Initialisation/ reinit to avoid null object on runtime launch
            if (importer == null)
            {
                importer = new Model.Importer();
            }

            if (fileSelector == null)
            {
                fileSelector = new NativeSelectorEditor();
            }

            if (importMenu == null)
            {
                importMenu = new UI.Menu();
            }

            if (rootObjects == null)
            {
                rootObjects = new List <GameObject>();
            }

            GUILayout.BeginVertical();

            GUILayout.Label("Select files to import:");

            string[] extensions = importer.SupportedExtensions;

            for (int i = 0; i < extensions.Length; i++)
            {
                extensions[i] = extensions[i].Insert(0, "*.");
            }

            fileSelector.DisplayConfiguration(string.Join(";", extensions), true);

            if (fileSelector.Filenames != null)
            {
                if (fileSelector.Modified)
                {
                    displayAssimpOptions = false;

                    foreach (string file in fileSelector.Filenames)
                    {
                        if (Path.GetExtension(file).Remove(0, 1).ToLower() != Constants.binaryExtension)
                        {
                            displayAssimpOptions = true;

                            break;
                        }
                    }

                    importMenu.Options.Init(importer, fileSelector.Filenames);
                    fileSelector.Modified = false;
                }

                if (displayAssimpOptions)
                {
                    importMenu.DisplayConfiguration();
                }
                else
                {
                    GUILayout.FlexibleSpace();
                }

                if (GUILayout.Button("Import"))
                {
                    rootObjects.Clear();
                    duration = new TimeSpan(0);
                    vertices = 0;
                    faces    = 0;

                    importMenu.Options.ApplyConfiguration(importer);

                    // Use serialization to create a deep copy clone
                    Model.Option.Import options;
                    using (Stream stream = new MemoryStream())
                    {
                        IFormatter formatter = new BinaryFormatter();

                        formatter.Serialize(stream, importMenu.Options);

                        stream.Seek(0, SeekOrigin.Begin);

                        options = (Model.Option.Import)formatter.Deserialize(stream);
                    }

                    if (options != null)
                    {
                        IEnumerator it = Import(importer, options);

                        while (it.MoveNext())
                        {
                            ;
                        }
                    }
                    else
                    {
                        Debug.LogError("Impossible to save import options.");
                    }
                }

                bool display_stats = false;
                foreach (GameObject root in rootObjects)
                {
                    if (root != null)
                    {
                        EditorGUILayout.ObjectField(root, typeof(GameObject), false);

                        display_stats = true;
                    }
                }

                if (display_stats)
                {
                    EditorGUILayout.LabelField("Vertices: " + vertices);
                    EditorGUILayout.LabelField("Faces: " + faces);
                    EditorGUILayout.LabelField("Duration: " + duration);
                }
            }

            GUILayout.EndVertical();
        }
        public static void OnKeyPress(object sender, KeyPressEventArgs args)
        {
            if (args.Event.Key == Gdk.Key.f)
            {
                if (Program.activesys == null)
                {
                    return;
                }
                else
                {
                    Program.activesys.IterateCenter();
                    Program.sys_view.ClearPaths();
                }
                args.RetVal = true;
            }
            else if (args.Event.Key == Gdk.Key.r)
            {
                double d = Vector3.Magnitude(Program.sys_view.camera.position);
                Program.sys_view.camera = new Camera(d, Vector3.zero);
            }
            else if (args.Event.Key == Gdk.Key.l)
            {
                canMove = !canMove;
                if (!canMove)
                {
                    rootPos = null;
                }
            }
            else if (args.Event.Key == Gdk.Key.Up)
            {
                Program.sys_view.radius_multiplier *= RADIUS_SENSITIVITY;
            }
            else if (args.Event.Key == Gdk.Key.Down)
            {
                Program.sys_view.radius_multiplier /= RADIUS_SENSITIVITY;
            }
            else if (args.Event.Key == Gdk.Key.Right)
            {
                Program.activesys.Stop();
                Program.timestep *= TIME_SENSITIVITY;
                Program.activesys.StartAsync(step: Program.timestep);
            }
            else if (args.Event.Key == Gdk.Key.Left)
            {
                Program.activesys.Stop();
                Program.timestep /= TIME_SENSITIVITY;
                Program.activesys.StartAsync(step: Program.timestep);
            }
            else if (args.Event.Key == Gdk.Key.Page_Down)
            {
                // don't make it smaller than 0
                if (Program.sys_view.line_max >= LINE_SENSITIVITY)
                {
                    Program.sys_view.line_max -= LINE_SENSITIVITY;
                }
            }
            else if (args.Event.Key == Gdk.Key.Page_Up)
            {
                Program.sys_view.line_max += LINE_SENSITIVITY;
            }
            else if (args.Event.Key == Gdk.Key.Escape)
            {
                Program.sys_view.Stop();
                Program.activesys.Stop();
                Program.mainWindow.Destroy();

                var menu = new UI.Menu();
                var data = new UI.SaveData()
                {
                    bodies            = ((IEnumerable <Body>)Program.activesys).ToList(),
                    centers           = Program.CustomCenters,
                    timestep          = Program.timestep,
                    radius_multiplier = Program.sys_view.radius_multiplier,
                    line_max          = Program.sys_view.line_max
                };
                menu.temp_savedata = data;
                menu.loadButton.Click();
            }
            else if (args.Event.Key == Gdk.Key.q)
            {
                Program.sys_view.camera = new Camera(Vector3.Magnitude(Program.sys_view.camera.position) * SCROLL_SENSITIVITY, Program.sys_view.camera.angle);
            }
            else if (args.Event.Key == Gdk.Key.w)
            {
                Program.sys_view.camera = new Camera(Vector3.Magnitude(Program.sys_view.camera.position) / SCROLL_SENSITIVITY, Program.sys_view.camera.angle);
            }
            else if (args.Event.Key == Gdk.Key.c)
            {
                if (focal_length == -1)
                {
                    Console.WriteLine("hi");
                    focal_length            = Vector3.Magnitude(Program.sys_view.camera.position);
                    Program.sys_view.camera = new Camera(1000 * AU, Program.sys_view.camera.angle);
                    //Program.sys_view.ClearPaths();
                    //Program.sys_view.Redraw();
                }
                else
                {
                    Console.WriteLine("hi2");
                    Program.sys_view.camera = new Camera(focal_length, Program.sys_view.camera.angle);
                    //Program.sys_view.Redraw();
                    focal_length = -1;
                }
            }
        }