Beispiel #1
0
        public MainWindow()
        {
            this.InitializeComponent();
            INFO.Text    = "Приятного прослушивания!^_^";
            style_picker = new StylePicker(this);

            VOLUME.Value             = 0.5;
            winForVid.IsPaused       = false;
            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            DataGridTextColumn title  = new DataGridTextColumn();
            DataGridTextColumn artist = new DataGridTextColumn();
            DataGridTextColumn lenght = new DataGridTextColumn();
            DataGridTextColumn album  = new DataGridTextColumn();
            DataGridTextColumn path   = new DataGridTextColumn();

            title.Header  = "Title";
            artist.Header = "Artist";
            lenght.Header = "Lenght";
            album.Header  = "Album";
            path.Header   = "Path";

            path.Binding   = new Binding("PATH");
            title.Binding  = new Binding("TITLE");
            artist.Binding = new Binding("ARTIST");
            lenght.Binding = new Binding("LENGHT");
            album.Binding  = new Binding("ALBUM");
            curr_play.Columns.Add(title);
            curr_play.Columns.Add(artist);
            curr_play.Columns.Add(lenght);
            curr_play.Columns.Add(album);
            curr_play.Columns.Add(path);
            curr_play.ColumnWidth = DataGridLength.Auto;
            if (System.IO.File.Exists(file_name))
            {
                doc = XDocument.Load(file_name);

                foreach (var item in doc.Element("Root").Elements("Playlist"))
                {
                    list.Items.Add(item.Element("Name").Value);
                }
            }
            else
            {
                doc = new XDocument();
                doc.Add(new XElement("Root"));
                doc.Element("Root").Add(new XElement("Style"));
                doc.Element("Root").Element("Style").Value = "mainstyle.xaml";
                doc.Save(file_name);
            }
            string proj_path = System.Reflection.Assembly.GetExecutingAssembly().Location;

            string[] se = proj_path.Split('\\');
            ApplicationFolder = proj_path.Remove(proj_path.Length - se[se.Length - 1].Length);
            this.Resources    = new ResourceDictionary()
            {
                Source = new Uri((System.IO.Path.Combine(ApplicationFolder, doc.Element("Root").Element("Style").Value.ToString())))
            };
            winForVid.Closing          += new CancelEventHandler(winForVid_Closing);
            winForVid.Closed           += new EventHandler(winForVid_Closed);
            winForVid.IsVisibleChanged += new DependencyPropertyChangedEventHandler(winForVid_IsVisibleChanged);
            style_picker.Closing       += new CancelEventHandler(style_picker_Closing);
        }
Beispiel #2
0
 private void STYLE_Click(object sender, RoutedEventArgs e)
 {
     style_picker = new StylePicker(this);
     style_picker.Show();
 }