private static void OnElementMove(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var _2   = d as UIElement;
            var _win = Window.GetWindow(_2) as AyWindowBase;

            if (_win.IsNotNull())
            {
                if (_2.IsNotNull())
                {
                    ElementMoveMode newValue = (ElementMoveMode)e.NewValue;
                    switch (newValue)
                    {
                    case ElementMoveMode.None:
                        break;

                    case ElementMoveMode.Move:
                        AyExtension.SetAyWindowMouseLeftButtonMove(_win, _2);
                        break;

                    case ElementMoveMode.MoveAndDoubleClickMax:
                        AyExtension.SetAyWindowMouseLeftButtonCommonClick(_win, _2);
                        break;
                    }
                }
            }
            else
            {
                if (!WpfTreeHelper.IsInDesignMode)
                {
                    throw new Exception("your window is not inherit from aywindow");
                }
            }
        }
Пример #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //其他参考设置
            //string windowuser = @"D:\";
            //AyuiConfig.AYUI_BackgroundImageDirectoryPath = windowuser + @"\44\ayuiresource\bg\";
            //AyuiConfig.AYUI_BackgroundImageThumbDirectoryPath = windowuser + @"44\t\thumb\";
            //AyuiConfig.AYUI_RelativeBg_BgPath = @"\ayuiresource\bg\";
            //AyuiConfig.AYUI_RelativeBg_ThumbPath = @"\t\thumb\";
            //AyuiConfig.AYUI_DiyColorTabTitle = "AY推荐颜色";
            //AyuiConfig.AYUI_DiyImageDirectoryName = "历史图片";
            //AyuiConfig.AYUI_ConfigFileNamePath = windowuser + @"44\ayuiresource\application.xml";
            //AyuiConfig.AYUI_ColorsCollectionBuilder(new List<string> { "#FFFFFF" }, true);


            //Heyo.Properties.Resources.Char.
            if (!Directory.Exists("Contents\\bg\\"))
            {
                Directory.CreateDirectory("Contents");
                Directory.CreateDirectory("Contents\\Config");
                Directory.CreateDirectory("Contents\\bg");
                Directory.CreateDirectory("Contents\\bg\\bg");
                Directory.CreateDirectory("Contents\\bg\\bg\\a默认");
                Directory.CreateDirectory("Contents\\bg\\thumb");
                Directory.CreateDirectory("Contents\\bg\\thumb\\a默认");
                FileStream fs     = new FileStream("Contents\\Config\\application.xml", FileMode.Create);
                byte[]     appXml = Encoding.UTF8.GetBytes(HeyoCraft.Properties.Resources.application.ToCharArray());
                fs.Write(appXml, 0, appXml.Length);
                fs.Close();
                fs = new FileStream("Contents\\Config\\Config.xml", FileMode.Create);
                byte[] configXml = Encoding.UTF8.GetBytes(HeyoCraft.Properties.Resources.Config.ToCharArray());
                fs.Write(configXml, 0, configXml.Length);
                fs.Close();
                fs = new FileStream("Contents\\bg\\bg\\a默认\\BG.jpg", FileMode.Create);
                byte[] bg = HeyoCraft.Properties.Resources.BG.ToBytes();
                fs.Write(bg, 0, bg.Length);
                fs.Close();
                fs = new FileStream("Contents\\bg\\thumb\\a默认\\BG.jpg", FileMode.Create);
                byte[] bg_t = HeyoCraft.Properties.Resources.BG_T.ToBytes();
                fs.Write(bg_t, 0, bg_t.Length);
                fs.Close();
            }


            //可以这里.AddFonts("aydemo", "#iconfont") 添加第三方字体
            Current.InitGlobalPackUri().AddResourceDictionary(AyExtension.CreatePackUriString("/Contents/Styles/AYUIProjectDictionary.xaml")).AYUI();
            base.OnStartup(e);
        }
Пример #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //其他参考设置
            //string windowuser = @"D:\";
            //AyuiConfig.AYUI_BackgroundImageDirectoryPath = windowuser + @"\44\ayuiresource\bg\";
            //AyuiConfig.AYUI_BackgroundImageThumbDirectoryPath = windowuser + @"44\t\thumb\";
            //AyuiConfig.AYUI_RelativeBg_BgPath = @"\ayuiresource\bg\";
            //AyuiConfig.AYUI_RelativeBg_ThumbPath = @"\t\thumb\";
            //AyuiConfig.AYUI_DiyColorTabTitle = "AY推荐颜色";
            //AyuiConfig.AYUI_DiyImageDirectoryName = "历史图片";
            //AyuiConfig.AYUI_ConfigFileNamePath = windowuser + @"44\ayuiresource\application.xml";
            //AyuiConfig.AYUI_ColorsCollectionBuilder(new List<string> { "#FFFFFF" }, true);

            //可以这里.AddFonts("aydemo", "#iconfont") 添加第三方字体
            Application.Current.InitGlobalPackUri().AddResourceDictionary(AyExtension.CreatePackUriString("/Contents/Styles/AYUIProjectDictionary.xaml")).AYUI();
            base.OnStartup(e);
        }
Пример #4
0
 public override void RegisterResourceDictionary(ClientResourceDictionaryCollection resources)
 {
     resources.Add(AyExtension.CreateResourceDictionary("Contents/Styles/AYUIProjectDictionary.xaml"));
 }
 private void _ViewStart_Loaded(object sender, RoutedEventArgs e)
 {
     AyExtension.SetAyWindowMouseLeftButtonCommonClick(this);
 }
Пример #6
0
        internal static void PlayAyMusic(PlayListItemModel music)
        {
            if (System.IO.File.Exists(music.SongPath))
            {
                if (currentPlayTimer != null)
                {
                    currentPlayTimer.Stop();
                    currentPlayTimer = null;
                }
                MainWindow.curr.ProgressEnbaled = true;
                if (lastMusic != null)
                {
                    MainWindow.CurrentPlayer.Stop();
                    MainWindow.CurrentPlayer.Dispose();
                }

                if (music.ExtName == ".mp3")
                {
                    Mp3File mp3 = new Mp3File(music.SongPath);
                    if (mp3.TagHandler.Picture != null)
                    {
                        MemoryStream stream   = new MemoryStream(AyFuncFactory.GetFunc <AyFuncBitmapWithWpf>().ImageToBytes(mp3.TagHandler.Picture, System.Drawing.Imaging.ImageFormat.Jpeg));
                        string       filename = AyFuncFactory.GetFunc <AyFuncSecrity>().GetMD5Result(mp3.TagHandler.Song + mp3.TagHandler.Artist.ToObjectString());
                        filename = ExtendUtils.GetDATA_TEMP_ALBUM_PATH() + "\\" + filename + ".jpg";
                        var dsd = imageSourceConverter.ConvertFrom(stream);
                        if (!File.Exists(filename))
                        {
                            System.Drawing.Image bm = System.Drawing.Image.FromStream(stream, true);
                            bm.Save(filename);
                        }
                        if (dsd == null)
                        {
                            MainWindow.SetAlbumImage(null, filename);
                        }
                        else
                        {
                            MainWindow.SetAlbumImage(dsd as System.Windows.Media.Imaging.BitmapFrame, filename);
                        }
                    }
                    else
                    {
                        MainWindow.SetAlbumImage(null);
                    }


                    MainWindow.curr.Singer = "- " + mp3.TagHandler.Artist;
                    mp3 = null;
                    AyExtension.MemoryGC();
                }
                else
                {
                    MainWindow.curr.Singer = "- 未知AY";
                }

                MainWindow.CurrentPlayer = new VlcPlayer();
                MainWindow.CurrentPlayer.Initialize(@"Contents\LibVlc", new string[] { "-I", "--dummy", "--ignore-config", "--no-video-title", "--no-sub-autodetect-file" });
                MainWindow.CurrentPlayer.EndBehavior = EndBehavior.Repeat;
                MainWindow.CurrentPlayer.LoadMedia(music.SongPath);
                MainWindow.CurrentPlayer.Play();

                MainWindow.CurSongGuid          = music.SongGuid;
                music.PlayStatus                = true;
                MainWindow.curr.WorldPlayStatus = true;
                MainWindow.curr.GeName          = music.SongNameWithoutExt;
                if (lastMusic != null && lastMusic.SongGuid != music.SongGuid)
                {
                    lastMusic.PlayStatus = false;
                }
                lastMusic = music;
                MainWindow.curr.WorldLoveStatus = music.LoveStatus;


                currentPlayTimer = AyTime.setInterval(100, () =>
                {
                    var totalDuration = MainWindow.CurrentPlayer.GetDuration();
                    if (totalDuration.Hours > 0)
                    {
                        MainWindow.curr.TotalTime = string.Format("{0:00}:{1:00}:{2:00}", totalDuration.Hours, totalDuration.Minutes, totalDuration.Seconds);
                    }
                    else if (totalDuration.Hours == 0)
                    {
                        MainWindow.curr.TotalTime = string.Format("{0:00}:{1:00}", totalDuration.Minutes, totalDuration.Seconds);
                    }
                    if (MainWindow.CurrentPlayer != null && (MainWindow.CurrentPlayer.State == Meta.Vlc.Interop.Media.MediaState.Paused || MainWindow.CurrentPlayer.State == Meta.Vlc.Interop.Media.MediaState.Stopped))
                    {
                        currentPlayTimer.Stop();
                    }
                    var dd = MainWindow.CurrentPlayer.GetPlayTime();
                    MainWindow.curr.CurrentTime = string.Format("{0:00}:{1:00}:{2:00}", dd.Hours, dd.Minutes, dd.Seconds);
                    if (dd.Hours > 0)
                    {
                        MainWindow.curr.CurrentTime = string.Format("{0:00}:{1:00}:{2:00}", dd.Hours, dd.Minutes, dd.Seconds);
                    }
                    else if (dd.Hours == 0)
                    {
                        MainWindow.curr.CurrentTime = string.Format("{0:00}:{1:00}", dd.Minutes, dd.Seconds);
                    }
                    if (!MainWindow.curr.sliderProgressLock)
                    {
                        MainWindow.curr.CurrentPlayerPosition = MainWindow.CurrentPlayer.Position;
                    }
                });
            }
            else
            {
                AyMessageBox.ShowInformation("音乐文件不存在!");
            }
        }
Пример #7
0
 private void _ViewStart_Loaded(object sender, RoutedEventArgs e)
 {
     AyExtension.SetAyWindowMouseLeftButtonMove(this, ddfd);
 }