Beispiel #1
0
        private void ModifySound_Click(SoundButton btn)
        {
            CreateButton createbtn = new CreateButton(btn);

            createbtn.Owner = this;
            createbtn.Show();
        }
Beispiel #2
0
        //public void CreateButtonInFlowButtonSounds(string name, string id, object owner)
        //{
        //    FlowButtonSounds.Controls.Add(CreateButtons(name,id));
        //    if (owner != this)
        //    {
        //         this.LoadTags();
        //    }
        //}
        public SoundButton CreateButtonInFlowPlayList(Sound sound)
        {
            SoundButton btn = CreateButtons(sound);

            btn.Width  = this.flowPlayList.Width - 7;
            btn.Height = 40;
            flowPlayList.Controls.Add(btn);
            return(btn);
        }
Beispiel #3
0
 private void LoadPlaylistSounds()
 {
     this.flowPlayList.Controls.Clear();
     foreach (var sound in this.playList.ReturnSounds())
     {
         SoundButton btn = this.CreateButtonInFlowPlayList(sound);
         btn.IsPlayList = true;
     }
     this.RefreshList();
 }
Beispiel #4
0
 private void DeleteSound_Click(SoundButton btn)
 {
     if (btn.IsPlayList == false)
     {
         this.DeleteSound(btn.Sound);
     }
     else
     {
         this.DeleteSoundInPlayList(btn.Sound);
     }
 }
Beispiel #5
0
 public CreateButton(SoundButton btn)
 {
     InitializeComponent();
     this.sound            = btn.Sound;
     this.path             = btn.Sound.SoundPath;
     this.textBoxName.Text = btn.Sound.Name;
     foreach (var tag in btn.Sound.Tags)
     {
         this.CreateLabel(tag);
     }
     this.labelFile.Text = Path.GetFileName(this.path);
 }
Beispiel #6
0
        private void flowPlayList_DragEnter(object sender, DragEventArgs e)
        {
            SoundButton IsButton = (SoundButton)e.Data.GetData(typeof(SoundButton));

            if (IsButton != null && IsButton.IsPlayList == false)
            {
                e.Effect = DragDropEffects.Move;
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }
Beispiel #7
0
        private void flowPlayList_DragDrop(object sender, DragEventArgs e)
        {
            SoundButton btn = (SoundButton)e.Data.GetData(typeof(SoundButton));

            if (this.playList.Name == "")
            {
                this.playList = new PlayList();
            }
            this.playList.AddSound(btn.Sound);
            //this.CreateButtonInFlowPlayList(btn.Text, btn.Name);
            //this.flowPlayList.Controls.Add(btn);
            this.SavePlayList(this.playList);
            this.LoadPlaylistSounds();
        }
Beispiel #8
0
        private void labelDelete_DragEnter(object sender, DragEventArgs e)
        {
            var         send     = (Label)sender;
            SoundButton IsButton = (SoundButton)e.Data.GetData(typeof(SoundButton));

            if (IsButton != null)
            {
                send.Size       = new Size(send.Size.Width + 10, send.Size.Height + 10);
                e.Effect        = DragDropEffects.Move;
                send.DragLeave += new EventHandler(labelDelete_DragLeave);
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }
Beispiel #9
0
        private void labelDelete_DragDrop(object sender, DragEventArgs e)
        {
            var         send = (Label)sender;
            SoundButton btn  = (SoundButton)e.Data.GetData(typeof(SoundButton));

            if (btn.IsPlayList == false)
            {
                this.DeleteSound(btn.Sound);
            }
            else
            {
                this.DeleteSoundInPlayList(btn.Sound);
            }
            //this.LoadButtons();
            send.Size = new Size(send.Size.Width - 10, send.Size.Height - 10);
        }
Beispiel #10
0
        private void btn_MouseDown(object sender, MouseEventArgs e)
        {
            //Cast the sender to control type youre using
            this.mousePos = Cursor.Position;
            SoundButton send = (SoundButton)sender;

            if (e.Button == MouseButtons.Left)
            {
                Bitmap bmp = new Bitmap(send.Width, send.Height);
                send.DrawToBitmap(bmp, new Rectangle(Point.Empty, bmp.Size));
                //In a variable save the cursor with the image of your controler
                this.bitMapCursor = new Cursor(bmp.GetHicon());
                send.DoDragDrop(send, DragDropEffects.Move);
            }
            //Copy the control in a bitmap
        }
Beispiel #11
0
        private void ClickButton(object sender, QueryContinueDragEventArgs e)
        {
            SoundButton btn = (SoundButton)sender;

            if (e.Action != DragAction.Continue && this.mousePos == Cursor.Position)
            {
                string url = this.SearchPath(btn.Sound);
                this.wPlayer.controls.stop();
                if (this.wPlayer.URL != url)
                {
                    this.wPlayer.URL = url;
                    this.wPlayer.controls.play();
                }
                else
                {
                    this.wPlayer.URL = "";
                }
            }
        }
Beispiel #12
0
        private SoundButton CreateButtons(Sound sound)
        {
            SoundButton btn = new SoundButton(sound)
            {
                Name      = sound.Name,
                Text      = sound.Name,
                Height    = 80,
                Width     = 80,
                ForeColor = Color.White,
                BackColor = Color.FromArgb(32, 33, 36)
            };

            btn.QueryContinueDrag += new QueryContinueDragEventHandler(ClickButton);
            btn.MouseDown         += new MouseEventHandler(btn_MouseDown);
            btn.GiveFeedback      += new GiveFeedbackEventHandler(btn_GiveFeedback);
            var contextMenu = new ContextMenu();

            contextMenu.MenuItems.Add("Modify", new EventHandler((e, sender) => ModifySound_Click(btn)));
            contextMenu.MenuItems.Add("Delete", new EventHandler((e, sender) => DeleteSound_Click(btn)));
            btn.ContextMenu = contextMenu;
            return(btn);
        }