Discuz.Web/silverlight/album/Common/ControlBase.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
//------------------------------------------------------------
// Copyright(c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Input;
using System.Resources;
using System.Reflection;
using System.Diagnostics;
using System.IO;
namespace DiscuzAlbum.Common
{
// Base class for all Sample Controls - overrides Width, Height and
// mouse events to use the implementation root
public abstract class ControlBase : Control
{
#region Public Methods
public ControlBase()
{
//the control template must be in an embeded resource - find it
Stream resourceStream = null;
//if the assembly is built with VS there will be a prefix before
//the resource name we expect. The resource name will be at the
//end after a dot
string dotResource = '.' + ResourceName;
Assembly assembly = typeof(ControlBase).Assembly;
string[] names = assembly.GetManifestResourceNames();
foreach (string name in names)
{
if (name.Equals(ResourceName) || name.EndsWith(dotResource))
{
resourceStream = assembly.GetManifestResourceStream(name);
break;
}
}
Debug.Assert(resourceStream != null, "the resource template" + ResourceName + " not found");
StreamReader sr = new StreamReader(resourceStream);
string xaml = sr.ReadToEnd();
actualControl = InitializeFromXaml(xaml);
sr.Close();
Debug.Assert(actualControl != null, "failed to initialize the control");
base.Width = actualControl.Width;
base.Height = actualControl.Height;
Loaded += new EventHandler(OnLoaded);
}
//forwards FindName to the actual control
public new DependencyObject FindName(string name)
{
return actualControl.FindName(name);
}
后面还有 93 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
