本文整理汇总了C#中IModule类的典型用法代码示例。如果您正苦于以下问题:C# IModule类的具体用法?C# IModule怎么用?C# IModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IModule类属于命名空间,在下文中一共展示了IModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartAsyncUploading
private void StartAsyncUploading(IModule uploader, String name, byte[] bytes)
{
var backgroundWorker = new BackgroundWorker();
backgroundWorker.DoWork += (s, e) => e.Result = uploader.Upload(name, bytes);
backgroundWorker.RunWorkerCompleted += (s, e) => Clipboard.SetText((String) e.Result);
backgroundWorker.RunWorkerAsync();
}
示例2: SetModuleSettings
public override void SetModuleSettings(IModule module)
{
SvrTexture texture = (SvrTexture)module;
// Set the pixel format
switch (pixelFormatBox.SelectedIndex)
{
case 0: texture.PixelFormat = SvrPixelFormat.Rgb5a3; break;
case 1: texture.PixelFormat = SvrPixelFormat.Argb8888; break;
}
// Set the data format
switch (dataFormatBox.SelectedIndex)
{
case 0: texture.DataFormat = SvrDataFormat.Rectangle; break;
case 1: texture.DataFormat = SvrDataFormat.Index4ExternalPalette; break;
case 2: texture.DataFormat = SvrDataFormat.Index8ExternalPalette; break;
case 3: texture.DataFormat = SvrDataFormat.Index4; break;
case 4: texture.DataFormat = SvrDataFormat.Index8; break;
}
// Set the global index stuff
texture.HasGlobalIndex = hasGlobalIndexCheckBox.Checked;
if (texture.HasGlobalIndex)
{
uint globalIndex = 0;
if (!uint.TryParse(globalIndexTextBox.Text, out globalIndex))
{
globalIndex = 0;
}
texture.GlobalIndex = globalIndex;
}
}
示例3: GenerateResponse
private void GenerateResponse(IModule module, HttpListenerContext context)
{
// Process the request then close the stream. All logic is delegated
// to the supplied IModule implementer.
module.Process(context.Response.OutputStream, context);
context.Response.Close();
}
示例4: ModuleLayout
public ModuleLayout(IModule module)
{
this.InitializeComponent();
this.module = module;
this.module.setFrame(Window.Current.Content as Frame);
this.moduleName.Text = module.getName();
}
示例5: ClampOutput
public ClampOutput(IModule sourceModule)
{
SourceModule = sourceModule;
LowerBound = -1;
UpperBound = 1;
}
示例6: IntegerType
/// <summary>
/// Creates an <see cref="IntegerType"/> instance.
/// </summary>
/// <param name="module"></param>
/// <param name="name"></param>
/// <param name="enumerator"></param>
public IntegerType(IModule module, string name, Symbol type, ISymbolEnumerator symbols)
: base (module, name)
{
Types? t = GetExactType(type);
type.Assert(t.HasValue, "Unknown symbol for unsigned type!");
_type = t.Value;
_isEnumeration = false;
Symbol current = symbols.NextNonEOLSymbol();
if (current == Symbol.OpenBracket)
{
_isEnumeration = true;
symbols.PutBack(current);
_map = Lexer.DecodeEnumerations(symbols);
}
else if (current == Symbol.OpenParentheses)
{
symbols.PutBack(current);
_ranges = Lexer.DecodeRanges(symbols);
current.Assert(!_ranges.IsSizeDeclaration, "SIZE keyword is not allowed for ranges of integer types!");
}
else
{
symbols.PutBack(current);
}
}
示例7: ProductsController
public ProductsController(INews news, IModule module, IPhoto photo, ICacheManager cache)
{
_news = news;
_module = module;
_cache = cache;
_photo = photo;
}
示例8: Displace
public Displace(IModule mod0, IModule xDisplaceModule, IModule yDisplaceModule, IModule zDisplaceModule)
{
Module0 = mod0;
XDisplaceModule = xDisplaceModule;
YDisplaceModule = yDisplaceModule;
ZDisplaceModule = zDisplaceModule;
}
示例9: PersistModuleToFile
private static void PersistModuleToFile(string folder, IModule module, IObjectTree tree)
{
string fileName = Path.Combine(folder, module.Name + ".module");
using (StreamWriter writer = new StreamWriter(fileName))
{
writer.Write("#");
foreach (string dependent in module.Dependents)
{
writer.Write(dependent);
writer.Write(',');
}
writer.WriteLine();
foreach (IEntity entity in module.Entities)
{
IDefinition node = tree.Find(module.Name, entity.Name);
if (node == null)
{
continue;
}
uint[] id = node.GetNumericalForm();
/* 0: id
* 1: type
* 2: name
* 3: parent name
*/
writer.WriteLine(ObjectIdentifier.Convert(id) + "," + entity.GetType() + "," + entity.Name + "," + entity.Parent);
}
writer.Close();
}
}
示例10: LoadModule
public void LoadModule(IModule module)
{
if (this.modules.Contains (module))
throw new ArgumentException ();
this.modules.Add (module);
}
示例11: CfgManipulator
public CfgManipulator(IModule module, PeReader.DefaultHost host, Log.Log logger, MethodCfg methodCfg) {
this.host = host;
this.logger = logger;
this.module = module;
this.methodCfg = methodCfg;
}
示例12: TranslatePoint
public TranslatePoint(IModule mod0, double xTrans, double yTrans, double zTrans)
{
Module0 = mod0;
XTranslation = xTrans;
YTranslation = yTrans;
ZTranslation = zTrans;
}
示例13: CompressedCacheEntry
public CompressedCacheEntry(IModule destination, HttpListenerContext context)
{
Created = DateTime.Now;
using (MemoryStream memory = new MemoryStream())
{
// Store the raw document.
destination.Process(memory, context);
Content = memory.ToArray();
// Attempt to deflate the document, store if size is reduced.
using (MemoryStream deflateMemory = new MemoryStream())
using (DeflateStream deflate = new DeflateStream(deflateMemory, CompressionLevel.Optimal))
{
deflate.Write(Content, 0, Content.Length);
if (deflateMemory.Length < Content.Length)
{
Deflated = deflateMemory.ToArray();
IsDeflated = true;
}
else
{
IsDeflated = false;
}
}
}
}
示例14: SubscribeModule
public virtual bool SubscribeModule(IModule m)
{
if (m.Type == typeof(ControlModule))
{
var t = m as ControlModule;
if(!cmdic.ContainsValue(t))
{
cmdic.Add(t.Text, t);
}
return true;
}
if (m.Type == typeof(AnalysisModule))
{
var t = m as AnalysisModule;
if (!amdic.ContainsValue(t))
{
amdic.Add(t.Text, t);
}
return true;
}
if (m.Type == typeof(SignalModule))
{
var t = m as SignalModule;
if (!smdic.ContainsValue(t))
{
smdic.Add(t.Text, t);
}
return true;
}
return false;
}
示例15: LoadModule
public void LoadModule(string ModuleName)
{
if (ModuleName == "Dummy") return;
Assembly a = null;
try {
a = Assembly.LoadFrom(ModuleName);
}
catch {
throw new ModuleLoadException(string.Format("Не могу загрузить сборку \"{0}\"", ModuleName));
}
Type[] allTypes = a.GetTypes();
foreach (Type type in allTypes) // ищем во всех классах интерфейс IModule
{
Type IModule = type.GetInterface("IModule");
if (IModule != null) {
_module = (IModule) Activator.CreateInstance(type);
break;
}
}
if (_module == null)
throw new ModuleLoadException(string.Format("В сборке \"{0}\" не найден интерфейс IModule.", ModuleName));
_module.Init();
}