本文整理汇总了C#中Toolkit类的典型用法代码示例。如果您正苦于以下问题:C# Toolkit类的具体用法?C# Toolkit怎么用?C# Toolkit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Toolkit类属于命名空间,在下文中一共展示了Toolkit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize(TehModAPI api)
{
toolkit = Toolkit.GetToolkit();
api.RegisterMenu(this, "Add World Features");
api.AddOption(this, "Add Snow Biome", "addSnow", 2);
api.AddOption(this, "Convert Dirt to Snow", "convertSnow", 2);
api.AddOption(this, "Convert World to Snow", "convertWorldSnow", 2);
api.AddOption(this, "Add Dungeon", "addDungeon", 2);
api.AddOption(this, "Add Hell House", "addHell", 2);
api.AddOption(this, "Add Floating Island", "addIsland", 2);
api.AddOption(this, "Add Floating Island House", "addIslandHouse", 2);
api.AddOption(this, "Add Mine House", "addMineHouse", 2);
api.AddOption(this, "Start Hardmode", "startHm", 2);
api.AddOption(this, "Start Hardmode (No Biome Changes)", "startHm2", 2);
api.AddOption(this, "Stop Hardmode", "stopHm", 2);
api.AddOption(this, "Convert Corruption to Hallow", "convertCorruption", 2);
api.AddOption(this, "Convert Corruption to Normal", "convertCorruptionNormal", 2);
api.AddOption(this, "Convert Hallow to Corruption", "convertHallow", 2);
api.AddOption(this, "Convert Hallow to Normal", "convertHallowNormal", 2);
api.AddOption(this, "Start Goblin Invasion", "startGoblin", 2);
api.AddOption(this, "Start Frost Legion Invasion", "startFrost", 2);
api.AddOption(this, "Stop Invasion", "stopInvade", 2);
api.AddOption(this, "Christmas", "xMas", 0);
api.AddOption(this, "Quit Without Saving World", "exitNoSave", 2);
}
示例2: MainForm
public MainForm()
{
InitializeComponent();
_toolkit = new Toolkit(new LambdaLogger(LogToListBox));
_sessionSaver = new IsolatedStorageProvider<MainFormSettings>();
}
示例3: InitForToolkit
internal void InitForToolkit (Toolkit tk)
{
if (ToolkitEngine != tk) {
// Gather existing font property before switching handler
var fname = Family;
var size = Size;
var style = Style;
var weight = Weight;
var stretch = Stretch;
var oldHandler = ToolkitEngine.FontBackendHandler;
ToolkitEngine = tk;
handler = tk.FontBackendHandler;
if (fname == oldHandler.SystemFont.Family)
Backend = handler.WithSettings (handler.SystemFont.Backend, size, style, weight, stretch);
else if (fname == oldHandler.SystemMonospaceFont.Family)
Backend = handler.WithSettings (handler.SystemMonospaceFont.Backend, size, style, weight, stretch);
else if (fname == oldHandler.SystemSansSerifFont.Family)
Backend = handler.WithSettings (handler.SystemSansSerifFont.Backend, size, style, weight, stretch);
else if (fname == oldHandler.SystemSerifFont.Family)
Backend = handler.WithSettings (handler.SystemSerifFont.Backend, size, style, weight, stretch);
else {
var fb = handler.Create (fname, size, style, weight, stretch);
Backend = fb ?? handler.WithSettings(handler.GetSystemDefaultFont (), size, style, weight, stretch);
}
}
}
示例4: TextLayout
internal TextLayout(Toolkit tk)
{
ToolkitEngine = tk;
handler = ToolkitEngine.TextLayoutBackendHandler;
Backend = handler.Create ();
Setup ();
}
示例5: Font
internal Font (object backend, Toolkit toolkit)
{
if (toolkit != null)
ToolkitEngine = toolkit;
handler = ToolkitEngine.FontBackendHandler;
if (backend == null)
throw new ArgumentNullException ("backend");
Backend = backend;
}
示例6: Context
internal Context(object backend, Toolkit toolkit, ContextBackendHandler handler, bool getGlobalStyles = true)
: base(backend, toolkit, handler)
{
this.handler = handler;
if (getGlobalStyles) {
styles = globalStyles;
if (styles != StyleSet.Empty)
handler.SetStyles (Backend, styles);
}
}
示例7: Draw
void Draw(object ctx, Rectangle bounds, ImageDescription idesc, Toolkit toolkit)
{
var c = new Context (ctx, toolkit);
if (idesc.Styles != StyleSet.Empty)
c.SetStyles (idesc.Styles);
c.Reset (null);
c.Save ();
c.GlobalAlpha = idesc.Alpha;
OnDraw (c, bounds);
c.Restore ();
}
示例8: InitForToolkit
public void InitForToolkit (Toolkit t)
{
if (ToolkitEngine != t) {
var handler = t.GradientBackendHandler;
var backend = CreateGradientBackend (handler);
SetBackend (handler, backend);
if (stops != null)
foreach (var stop in stops)
handler.AddColorStop (backend, stop.Key, stop.Value);
}
}
示例9: Initialize
public static void Initialize (string backendType)
{
if (engine != null)
return;
toolkit = Toolkit.Load (backendType, false);
toolkit.SetActive ();
engine = toolkit.Backend;
mainLoop = new UILoop (toolkit);
UIThread = System.Threading.Thread.CurrentThread;
toolkit.EnterUserCode ();
}
示例10: InitForToolkit
internal void InitForToolkit (Toolkit tk)
{
if (ToolkitEngine != tk) {
// Gather existing font property before switching handler
var fname = Family;
var size = Size;
var style = Style;
var weight = Weight;
var stretch = Stretch;
ToolkitEngine = tk;
handler = tk.FontBackendHandler;
var fb = handler.Create (fname, size, style, weight, stretch);
Backend = fb ?? handler.GetSystemDefaultFont ();
}
}
示例11: AppWindow
public AppWindow()
{
nativeToolkit = Toolkit.Load (ToolkitType.Cocoa);
HBox box = new HBox ();
var b = new Button ("Gtk Test Window");
b.Clicked += HandleClicked;
box.PackStart (b);
b = new Button ("Cocoa Test Window");
b.Clicked += HandleClickedCocoa;
box.PackStart (b);
Content = box;
}
示例12: AppWindow
public AppWindow ()
{
nativeToolkit = Toolkit.Load (ToolkitType.Cocoa);
HBox box = new HBox ();
var b = new Button ("Gtk Test Window");
b.Clicked += HandleClicked;
box.PackStart (b, BoxMode.FillAndExpand);
b = nativeToolkit.CreateObject<Button> ();
b.Label = "Cocoa Test Window";
b.Clicked += HandleClickedCocoa;
var wped = Toolkit.CurrentEngine.WrapWidget (b);
box.PackStart (wped, BoxMode.FillAndExpand);
Content = box;
}
示例13: ExportHostObjectMaterials
/// <summary>
/// Exports materials for host object.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="hostObject">The host object.</param>
/// <param name="elemHnd">The host IFC handle.</param>
/// <param name="geometryElement">The geometry element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
/// <param name="levelId">The level id.</param>
/// <param name="direction">The IFCLayerSetDirection.</param>
/// <param name="containsBRepGeometry">True if the geometry contains BRep geoemtry. If so, we will export an IfcMaterialList. If null, we will calculate.</param>
/// <returns>True if exported successfully, false otherwise.</returns>
public static bool ExportHostObjectMaterials(ExporterIFC exporterIFC, HostObject hostObject,
IFCAnyHandle elemHnd, GeometryElement geometryElement, ProductWrapper productWrapper,
ElementId levelId, Toolkit.IFCLayerSetDirection direction, bool? containsBRepGeometry)
{
IList<IFCAnyHandle> elemHnds = new List<IFCAnyHandle>();
elemHnds.Add(elemHnd);
// Setting doesContainBRepGeometry to false below preserves the original behavior that we created IfcMaterialLists for all geometries.
// TODO: calculate, or pass in, a valid bool value for Ceilings, Roofs, and Wall Sweeps.
bool doesContainBRepGeometry = containsBRepGeometry.HasValue ? containsBRepGeometry.Value : false;
return ExportHostObjectMaterials(exporterIFC, hostObject, elemHnds, geometryElement, productWrapper, levelId, direction, doesContainBRepGeometry);
}
示例14: CreateWindowStyle
/// <summary>
/// Creates an IfcWindowStyle, and assigns it to the file.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="guid">The GUID.</param>
/// <param name="ownerHistory">The owner history.</param>
/// <param name="name">The name.</param>
/// <param name="description">The description.</param>
/// <param name="applicableOccurrence">The attribute optionally defines the data type of the occurrence object.</param>
/// <param name="propertySets">The property set(s) associated with the type.</param>
/// <param name="representationMaps">The mapped geometries associated with the type.</param>
/// <param name="elementTag">The tag that represents the entity.</param>
/// <param name="operationType">The operation type.</param>
/// <param name="constructionType">The construction type.</param>
/// <param name="paramTakesPrecedence"> True if the parameter given in the attached lining and panel properties exactly define the geometry,
/// false if the attached style shape takes precedence.</param>
/// <param name="sizeable">True if the attached IfcMappedRepresentation (if given) can be sized (using scale factor of transformation), false if not.</param>
/// <returns>The handle.</returns>
public static IFCAnyHandle CreateWindowStyle(IFCFile file, string guid, IFCAnyHandle ownerHistory,
string name, string description, string applicableOccurrence, HashSet<IFCAnyHandle> propertySets,
IList<IFCAnyHandle> representationMaps, string elementTag, IFCWindowStyleConstruction constructionType,
Toolkit.IFCWindowStyleOperation operationType, bool paramTakesPrecedence, bool sizeable)
{
ValidateTypeProduct(guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMaps, elementTag);
IFCAnyHandle windowStyle = CreateInstance(file, IFCEntityType.IfcWindowStyle);
IFCAnyHandleUtil.SetAttribute(windowStyle, "ConstructionType", constructionType);
IFCAnyHandleUtil.SetAttribute(windowStyle, "OperationType", operationType);
IFCAnyHandleUtil.SetAttribute(windowStyle, "ParameterTakesPrecedence", paramTakesPrecedence);
IFCAnyHandleUtil.SetAttribute(windowStyle, "Sizeable", sizeable);
SetTypeProduct(windowStyle, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMaps, elementTag);
return windowStyle;
}
示例15: CreateCache
public static Content CreateCache(Toolkit tk, IReadOnlyZetboxContext ctx)
{
var result = new Content();
// All View Descriptors for the given Toolkit
result._allVDCache = new ReadOnlyCollection<ViewDescriptor>(
ctx.GetQuery<ViewDescriptor>().WithEagerLoading().Where(obj => obj.Toolkit == tk).ToList());
// Dictionary by Kind
result._vdCache = result._allVDCache.Where(obj => obj.ControlKind != null).GroupBy(obj => obj.ControlKind)
.ToDictionary(g => g.Key.ExportGuid, g => new ReadOnlyCollection<ViewDescriptor>(g.ToList()));
return result;
}