Ejemplo n.º 1
0
        private void NewPlayList_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                var d = (TextBox)sender;
                if (AfterLogin.objectUser.mPlaylists.FirstOrDefault(x => x.mName == d.Text) == null && d.Text != "")
                {
                    ListBoxItem itm = new ListBoxItem();
                    itm.Content = d.Text;
                    Expander exp1 = new Expander();
                    exp1.MouseRightButtonUp += Mouse_RightButtonClickPlaylist;
                    var newStack   = new StackPanel();
                    var newListBox = new System.Windows.Controls.ListBox();
                    newListBox.Background = Brushes.Black;
                    newListBox.Foreground = Brushes.LightGray;
                    //var newMediaFileList = new List<Song>();
                    //foreach (var d in b.mSongs)
                    //  newMediaFileList.Add(d);
                    //newListBox.ItemsSource = newMediaFileList;
                    newListBox.Tag = d.Text;
                    ListofListBox.Add(newListBox);
                    newStack.Children.Add(newListBox);
                    exp1.Content    = newStack;
                    exp1.Header     = d.Text;
                    exp1.Foreground = Brushes.LightGray;
                    allPlaylist.Children.Add(exp1);
                    AfterLogin.objectUser.mPlaylists.Add(new Playlist(d.Text));
                }
                else
                {
                    MessageBox.Show("Failed to create a playlist. Playlist name is already exist");
                }

                foreach (var b in allPlaylist.Children)
                {
                    if (b.GetType() == typeof(TextBox))
                    {
                        allPlaylist.Children.Remove((TextBox)b);
                        break;
                    }
                }
            }
            if (e.Key == Key.Escape)
            {
                foreach (var b in allPlaylist.Children)
                {
                    if (b.GetType() == typeof(TextBox))
                    {
                        allPlaylist.Children.Remove((TextBox)b);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static void ChangeLabelText(System.Windows.Controls.ListBox list, string label, int index)
        {
            list.Items.RemoveAt(index);
            Label newLabel = new Label();

            newLabel.Content = label;

            styleLabel(newLabel);

            list.Items.Insert(index, newLabel);
        }
Ejemplo n.º 3
0
        public void reloadPlaylists()
        {
            AllPLaylist.Children.Clear();

            /*
             * var newBox = new System.Windows.Controls.ListBox();
             * newBox.Tag = "Available Songs";
             * if (mediaFileList != null)
             * {
             *  newBox.ItemsSource = mediaFileList;
             *  //ax.URL = mediaFolder + "\\" + mediaFileList[0];
             * }
             * var newstackPanel = new StackPanel();
             * newstackPanel.Children.Add(newBox);
             * Expander exp = new Expander();
             * exp.Content = newstackPanel;
             * exp.Header = "Available Songs";
             *
             * exp.Foreground = Brushes.LightGray;
             * allPlaylist.Children.Add(exp);
             * newBox.Background = Brushes.Black;
             * newBox.Foreground = Brushes.LightGray;
             * newBox.Tag = "Available Songs";
             */
            foreach (var b in objectUser.mPlaylists)
            {
                Expander exp1 = new Expander();
                exp1.MouseRightButtonUp += Mouse_RightButtonClickPlaylist;
                var newStack   = new StackPanel();
                var newListBox = new System.Windows.Controls.ListBox();
                newListBox.Background = Brushes.Black;
                newListBox.Foreground = Brushes.LightGray;
                var newMediaFileList = new List <Song>();
                foreach (var d in b.mSongs)
                {
                    newMediaFileList.Add(d);
                }
                newListBox.ItemsSource = newMediaFileList;
                newListBox.Tag         = b.mName;
                ListofListBox.Add(newListBox);
                newStack.Children.Add(newListBox);
                exp1.Content    = newStack;
                exp1.Header     = b.mName;
                exp1.Foreground = Brushes.LightGray;
                allPlaylist.Children.Add(exp1);
            }
            AllPLaylist = allPlaylist;
        }
Ejemplo n.º 4
0
        public static void UnChangedFile(System.Windows.Controls.ListBox list)
        {
            int index = FileManager.currentLoadedIndex;

            if (index > -1 && FileManager.currentFileId > -1)
            {
                if (FileManager.isFileNotSaved[FileManager.currentFileId])
                {
                    FileManager.isFileNotSaved[FileManager.currentFileId] = false;
                    Label textshitthingdinges = (Label)inst.LuaFileView.Items[index];

                    string label = textshitthingdinges.Content.ToString();
                    if (label[label.Length - 1] == '*')
                    {
                        label = label.Remove(label.Length - 1);
                        textshitthingdinges.Content = label;
                        ChangeLabelText(list, label, index);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public AfterLogin(User x)
        {
            ListofListBox    = new List <System.Windows.Controls.ListBox>();
            afterLoginWindow = this;
            var newBox = new System.Windows.Controls.ListBox();


            objectUser    = new User();
            mediaFileList = new List <Song>();
            InitializeComponent();
            username.Content = x.mUsername;
            ax =
                winsFormHost.Child as AxWMPLib.AxWindowsMediaPlayer;
            objectUser     = x;
            profile.Source = new BitmapImage(new Uri("pack://application:,,,/Images/" + x.mUsername + ".png"));

            /*
             * DirectoryInfo dir = new DirectoryInfo(mediaFolder);
             *
             * foreach (FileInfo file in dir.GetFiles("*.*", SearchOption.AllDirectories))
             * {
             *  if (file.Extension == ".mp3" || file.Extension == ".mp4")
             *      mediaFileList.Add(file.Name);
             * }
             */
            foreach (var b in LoginScreen.allSongs.mSongs)
            {
                mediaFileList.Add(b);
            }

            /*if (mediaFileList != null)
            *  {
            *   newBox.ItemsSource = mediaFileList;
            *   ax.URL = mediaFolder + "\\" + mediaFileList[0];
            *  }
            *  var newstackPanel = new StackPanel { Name = "NewExpanderStackPanel" };
            *  newstackPanel.Children.Add(newBox);
            *  Expander exp = new Expander();
            *  exp.Content = newstackPanel;
            *  exp.Header = "Available Songs";
            *  exp.Foreground = Brushes.LightGray;
            *  allPlaylist.Children.Add(exp);
            *  newBox.Background = Brushes.Black;
            *  newBox.Foreground = Brushes.LightGray;
            *  foreach (var b in objectUser.mPlaylists)
            *  {
            *   Expander exp1 = new Expander();
            *   var newStack = new StackPanel { Name = "NewExpanderStackPanel" };
            *   var newListBox = new System.Windows.Controls.ListBox();
            *   newListBox.Background = Brushes.Black;
            *   newListBox.Foreground = Brushes.LightGray;
            *   var newMediaFileList = new List<string>();
            *   foreach (var d in b.mSongs)
            *       newMediaFileList.Add(d.mArtist + "-" + d.mTitle + d.mExtension);
            *   newListBox.ItemsSource = newMediaFileList;
            *   newStack.Children.Add(newListBox);
            *   exp1.Content = newStack;
            *   exp1.Header = b.mName;
            *   exp1.Foreground = Brushes.LightGray;
            *   allPlaylist.Children.Add(exp1);
            *
            *  }
            *  AllPLaylist = allPlaylist;*/
            AllPLaylist = new StackPanel();
            reloadPlaylists();
        }