TMusic/Util/AppUtil.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Collections.ObjectModel;
using TMusic.Model;
using TMusic.ViewModel;
using System.Windows;
using System.ComponentModel;
using System.Windows.Interop;
namespace TMusic.Util
{
public static class AppUtil
{
private static bool? _isInDesignMode;
public static bool IsInDesignMode
{
get
{
if (!_isInDesignMode.HasValue)
{
_isInDesignMode = (bool)DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)).Metadata.DefaultValue;
}
return _isInDesignMode.Value;
}
}
public static IntPtr GetHandle(this Visual visual) => (PresentationSource.FromVisual(visual) as HwndSource)?.Handle ?? IntPtr.Zero;
public static Color? GetColor(string colorString)
{
if (string.IsNullOrEmpty(colorString)) return null;
object colorObj = null;
try
{
colorObj = ColorConverter.ConvertFromString(colorString);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
if (colorObj == null) return null;
return (Color)colorObj;
}
public static string GetColorString(Color color)
{
return null;
}
public static bool HasImg(string path)
{
try
{
var info = Application.GetResourceStream(new Uri(path, UriKind.RelativeOrAbsolute));
if (info != null && info.Stream != null && info.Stream.Length > 0)
后面还有 91 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
