コード例 #1
0
        private void WczytajPlayliste_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect = false;
            ofd.Filter      = "Playlista plik xml |*.xml";

            if (ofd.ShowDialog() == true)
            {
                try
                {
                    XmlSerializer serial = new XmlSerializer(music.GetType());
                    StreamReader  reader = new StreamReader(ofd.FileName);
                    music = (List <Source>)serial.Deserialize(reader);

                    ListBoxSongs.Items.Clear();
                    for (int i = 0; i < music.Count; i++)
                    {
                        ListBoxSongs.Items.Add(music[i].filename);
                    }

                    WindowPupUp window = new WindowPupUp(this, string.Empty, "Wczytano playliste", Brushes.Green);
                    window.Show();
                }

                catch (Exception ex)
                {
                    window = new WindowPupUp(this, "Error", ex.Message, Brushes.Red);
                    window.Show();
                }
            }
        }
コード例 #2
0
        private void ZapiszPlayliste_Click(object sender, RoutedEventArgs e)
        {
            if (ListBoxSongs.Items.Count > 0)
            {
                try
                {
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.Filter = "Playlista plik xml |*.xml";

                    if (sfd.ShowDialog() == true)
                    {
                        XmlSerializer serial = new XmlSerializer(music.GetType());
                        StreamWriter  writer = new StreamWriter(sfd.FileName);
                        serial.Serialize(writer, music);

                        window = new WindowPupUp(this, string.Empty, "Zapisano playliste", Brushes.Green);
                        window.Show();
                    }
                }

                catch (Exception ex)
                {
                    window = new WindowPupUp(this, "Error", ex.Message, Brushes.Red);
                    window.Show();
                }
            }
            else
            {
                window = new WindowPupUp(this, "Błąd", "Playlista jest pusta", Brushes.Red);
                window.Show();
            }
        }
コード例 #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.popup = ((OdtwarzaczAudio8441.WindowPupUp)(target));

            #line 20 "..\..\WindowPupUp.xaml"
                this.popup.Closed += new System.EventHandler(this.Window_Closed);

            #line default
            #line hidden
                return;

            case 2:
                this.Top = ((System.Windows.Controls.DockPanel)(target));

            #line 29 "..\..\WindowPupUp.xaml"
                this.Top.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Top_MouseDown);

            #line default
            #line hidden
                return;

            case 3:
                this.LabelTitle = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.ButtonClose = ((System.Windows.Controls.Button)(target));

            #line 31 "..\..\WindowPupUp.xaml"
                this.ButtonClose.Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.MainText = ((System.Windows.Controls.AccessText)(target));
                return;

            case 6:
                this.ButtonOK = ((System.Windows.Controls.Button)(target));

            #line 42 "..\..\WindowPupUp.xaml"
                this.ButtonOK.Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }