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); } } }
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); }
internal TextLayout(Toolkit tk) { ToolkitEngine = tk; handler = ToolkitEngine.TextLayoutBackendHandler; Backend = handler.Create (); Setup (); }
public MainForm() { InitializeComponent(); _toolkit = new Toolkit(new LambdaLogger(LogToListBox)); _sessionSaver = new IsolatedStorageProvider<MainFormSettings>(); }
internal Font (object backend, Toolkit toolkit) { if (toolkit != null) ToolkitEngine = toolkit; handler = ToolkitEngine.FontBackendHandler; if (backend == null) throw new ArgumentNullException ("backend"); Backend = backend; }
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); } }
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); } }
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 (); }
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 (); }
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 (); } }
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; }
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; }
public override void RefreshData() { var val = MainFormCurrentNodeText(""); if (val == "Data Triggers") { val = "New"; } this.Text = "Data Trigger - " + val + " - " + this.AdminProxy.Connection.ServerName + (Toolkit.IsProcessElevated() ? " - Administrator " : ""); if (ddlAssembly.Items.Count == 0) { initAssemblyDropDown(ddlAssembly, getPhysicalFolder(), "< Pick One >", new Type[] { typeof(IDataviewReadDataTrigger), typeof(IDataviewSaveDataTrigger), typeof(ITableReadDataTrigger), typeof(ITableSaveDataTrigger) }); } Sync(true, delegate() { initDataViewDropDown(ddlDataview, true, "(Any)", -1); initTableDropDown(ddlTable, true, "(Any)", -1); chkEnabled.Checked = true; if (ID > -1) { var dt = AdminProxy.ListTriggers(ID).Tables["list_triggers"]; if (dt.Rows.Count > 0) { var dr = dt.Rows[0]; var path = dr["virtual_file_path"].ToString().Replace("~/", getPhysicalFolder()).Replace("/", @"\").Replace(@"\\", @"\"); var assemblyName = Path.GetFileName(path); ddlAssembly.SelectedIndex = ddlAssembly.FindString(assemblyName); if (ddlAssembly.SelectedIndex < 0) { ddlAssembly.SelectedIndex = 0; } ddlDataview.SelectedIndex = ddlDataview.FindString(dr["dataview_name"].ToString()); ddlTable.SelectedIndex = ddlTable.FindString(dr["table_name"].ToString()); chkEnabled.Checked = dr["is_enabled"].ToString().ToUpper() == "Y"; if (!inspectAssemblyFile()) { MessageBox.Show(this, getDisplayMember("RefreshData{body}", "Could not locate the file at {0}. Please verify it exists or upload a new version.", path), getDisplayMember("RefreshData{title}", "File Not Found")); } ddlClass.SelectedIndex = ddlClass.FindStringExact(dr["fully_qualified_class_name"].ToString()); txtTitle.Text = dr["title"].ToString(); txtDescription.Text = dr["description"].ToString(); } } MarkClean(); }); }
public void Beam() { var k3d = new Toolkit(); var logger = new MessageLogger(); double length = 4.0; var p0 = new Point3(0, 0, 0); var p1 = new Point3(length, 0, 0); var axis = new Line3(p0, p1); var resourcePath = @""; // get a material from the material table in the folder 'Resources' var materialPath = Path.Combine(resourcePath, "Materials/MaterialProperties.csv"); var inMaterials = k3d.Material.ReadMaterialTable(materialPath); var material = inMaterials.Find(x => x.name == "Steel"); // get a cross section from the cross section table in the folder 'Resources' var crosecPath = Path.Combine(resourcePath, "CrossSections/CrossSectionValues.bin"); CroSecTable inCroSecs = k3d.CroSec.ReadCrossSectionTable(crosecPath, out var info); var crosec_family = inCroSecs.crosecs.FindAll(x => x.family == "FRQ"); var crosec_initial = crosec_family.Find(x => x.name == "FRQ45/5"); // attach the material to the cross section crosec_initial.setMaterial(material); // create the column var beams = k3d.Part.LineToBeam(new List <Line3> { axis }, new List <string>() { "B1" }, new List <CroSec>() { crosec_initial }, logger, out var out_points); // create supports var supports = new List <Support> { k3d.Support.Support(p0, new List <bool>() { true, true, true, true, false, false }), k3d.Support.Support(p1, new List <bool>() { false, true, true, false, false, false }) }; // create a Point-load var loads = new List <Load> { k3d.Load.PointLoad(p1, new Vector3(0, 0, -100)) }; // create the model var model = k3d.Model.AssembleModel(beams, supports, loads, out info, out var mass, out var cog, out var message, out var warning); // calculate the natural vibrations int from_shape_ind = 1; int shapes_num = 1; int max_iter = 100; double eps = 1e-8; var disp_dummy = new List <double>(); var scaling = EigenShapesScalingType.matrix; model = k3d.Algorithms.NaturalVibes(model, from_shape_ind, shapes_num, max_iter, eps, disp_dummy, scaling, out List <double> nat_frequencies, out List <double> modal_masses, out List <Vector3> participation_facs, out List <double> participation_facs_disp, out model); Assert.AreEqual(nat_frequencies[0], 8.9828263788644716, 1e-8); }
public ActionResult GetPaymentPercentChart(string projectGuid) { return(ActionUtils.Json(() => { var project = m_dbAdapter.Project.GetProjectByGuid(projectGuid); CommUtils.Assert(project.CnabsDealId.HasValue, "CNABS deal id is null."); DealService dealService = new DealService(); var dealData = dealService.GetDealData(project.CnabsDealId.Value); CommUtils.Assert(dealData.ClosingDate.HasValue, "查找计息日失败"); var closingDate = dealData.ClosingDate; //Load note info var notes = m_dbAdapter.Dataset.GetNotes(project.ProjectId); var cnabsNotes = new ProjectLogicModel(CurrentUserName, project).Notes; var noteDict = Toolkit.GetNoteDictionary(project, notes, cnabsNotes); var noteInfos = notes.ConvertAll(x => noteDict[x.NoteId]); //Load dataset info var datasetViewModels = new List <DatasetViewModel>(); var dealSchedule = NancyUtils.GetDealSchedule(project.ProjectId); var datasets = m_dbAdapter.Dataset.GetDatasetByProjectId(project.ProjectId); foreach (var dataset in datasets) { var noteDatas = m_dbAdapter.Dataset.GetNoteDatas(dataset.DatasetId); var datasetViewModel = Toolkit.GetDatasetViewModel(dataset, dealSchedule.PaymentDates, noteDict, noteDatas); datasetViewModels.Add(datasetViewModel); } datasetViewModels.Reverse(); var dataSeries = new DataSeries(); dataSeries.name = "汇总"; dataSeries.data = new List <Vector>(); dataSeries.data.Add(new Vector(closingDate.Value, 100f)); var sumNotional = noteInfos.Sum(x => x.Notional); var endingBalance = sumNotional; if (sumNotional.HasValue && sumNotional.Value != 0) { foreach (var datasetViewModel in datasetViewModels) { var detail = datasetViewModel.SumPaymentDetail; endingBalance -= detail.PrincipalPaid; dataSeries.data.Add(new Vector(datasetViewModel.PaymentDay.Value, (endingBalance.Value / sumNotional.Value) * 100)); } } var dataSeriesList = new List <DataSeries>(); dataSeriesList.Add(dataSeries); Dictionary <string, List <Vector> > series = new Dictionary <string, List <Vector> >(); Dictionary <string, decimal> endingBalances = new Dictionary <string, decimal>(); foreach (var noteInfo in noteInfos) { var key = noteInfo.Name; series[key] = new List <Vector>(); endingBalances[key] = noteInfo.Notional.Value; series[key].Add(new Vector(closingDate.Value, 100d)); } foreach (var datasetViewModel in datasetViewModels) { foreach (var noteData in datasetViewModel.NoteDatas) { var key = noteData.NoteInfo.Name; endingBalances[key] -= noteData.PaymentDetail.PrincipalPaid.Value; series[key].Add(new Vector(datasetViewModel.PaymentDay.Value, (100 * endingBalances[key] / noteData.NoteInfo.Notional.Value))); } } foreach (var key in series.Keys) { var ds = new DataSeries(); ds.name = key; ds.data = series[key]; dataSeriesList.Add(ds); } return ActionUtils.Success(dataSeriesList); })); }
public void TwoPointLoads() { var k3d = new Toolkit(); var logger = new MessageLogger(); double length = 4.0; var p0 = new Point3(0, 0, 0); var p1 = new Point3(length, 0, 0); var axis = new Line3(p0, p1); var resourcePath = @""; // get a material from the material table in the folder 'Resources' var materialPath = Path.Combine(resourcePath, "Materials/MaterialProperties.csv"); var inMaterials = k3d.Material.ReadMaterialTable(materialPath); var material = inMaterials.Find(x => x.name == "Steel"); // get a cross section from the cross section table in the folder 'Resources' var crosecPath = Path.Combine(resourcePath, "CrossSections/CrossSectionValues.bin"); CroSecTable inCroSecs = k3d.CroSec.ReadCrossSectionTable(crosecPath, out var info); var crosec_family = inCroSecs.crosecs.FindAll(x => x.family == "FRQ"); var crosec_initial = crosec_family.Find(x => x.name == "FRQ45/5"); // attach the material to the cross section crosec_initial.setMaterial(material); // create the column var beams = k3d.Part.LineToBeam(new List <Line3> { axis }, new List <string>() { "B1" }, new List <CroSec>() { crosec_initial }, logger, out var out_points); // create supports var supports = new List <Support> { k3d.Support.Support(p0, new List <bool>() { true, true, true, true, true, true }), }; // create a Point-load var loads = new List <Load> { k3d.Load.PointLoad(p1, new Vector3(0, 100, 0), new Vector3(), "LC0"), k3d.Load.PointLoad(p1, new Vector3(0, 0, 50), new Vector3(), "LC1") }; // create the model var model = k3d.Model.AssembleModel(beams, supports, loads, out info, out var mass, out var cog, out var message, out var is_warning); // calculate the displacements ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning, out model); Assert.AreEqual(54.338219302231252, outMaxDisp[0], 1e-5); Assert.AreEqual(27.169109651115626, outMaxDisp[1], 1e-5); }
private void TerrainVizWindow_Load(object sender, EventArgs e) { Console.WriteLine(@"in load"); Toolkit.Init(); OpenGLWindow = new OpenGLControlWrapper { Dock = DockStyle.Fill }; OpenGLWindow.MouseDown += OnMouseDownHandler; OpenGLWindow.MouseMove += OnMouseMoveHandler; OpenGLWindow.MouseUp += OnMouseUpHandler; OpenGLWindow.Paint += ogl_Paint; panel1.Controls.Add(OpenGLWindow); OpenGLWindow.Loaded = true; CreateShaders(); OpenGLWindow.TheWorld = new World(); LoadObjects(Patches); var world = OpenGLWindow.TheWorld; GL.ClearColor(Color.Black); //SetupViewport(); GL.Enable(EnableCap.Lighting); // Turn off lighting to get color GL.Enable(EnableCap.Light0); GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); //?? GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.ShadeModel(ShadingModel.Smooth); // Enable Light 0 and set its parameters. GL.Light(LightName.Light0, LightParameter.Position, new Vector4(world.Sun.Position.ToFloat(), 1f)); const float ambient = 0.4f; const float diffuse = 1f; GL.Light(LightName.Light0, LightParameter.Ambient, new[] { ambient, ambient, ambient, 1.0f }); //GL.Light(LightName.Light0, LightParameter.Ambient, new[] { 0.6f, 0.6f, 0.6f, 1.0f }); GL.Light(LightName.Light0, LightParameter.Diffuse, new[] { diffuse, diffuse, diffuse, 1.0f }); GL.Light(LightName.Light0, LightParameter.Specular, new[] { 1f, 1f, 1f, 1.0f }); GL.Light(LightName.Light0, LightParameter.SpotExponent, new[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.LightModel(LightModelParameter.LightModelAmbient, new[] { 0f, 0f, 0f, 1.0f }); GL.LightModel(LightModelParameter.LightModelLocalViewer, 0); GL.LightModel(LightModelParameter.LightModelTwoSide, 0); //GL.Material(MaterialFace.Front, MaterialParameter.Ambient, new float[] { 0.3f, 0.3f, 0.3f, 1.0f }); //GL.Material(MaterialFace.Front, MaterialParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); //GL.Material(MaterialFace.Front, MaterialParameter.Specular, new float[] { 0.5f, 0.5f, 0.5f, 1.0f }); //GL.Material(MaterialFace.Front, MaterialParameter.Emission, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.ColorMaterial); // lets me use colors rather than changing materials //GL.Enable(EnableCap.CullFace); GL.Enable(EnableCap.Normalize); // Do I need this? (this make a difference, although I don't know why) GL.PointSize(5f); GL.Enable(EnableCap.PointSmooth); GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); //world.Fetcher.Frame = LadeeStateFetcher.StateFrame.MoonFixed; //var t = TimeUtilities.DateTimeToTime42(new DateTime(2014, 1, 1)); //UpdateToTime(t); OpenGLWindow.CameraMode = new ArcBall(OpenGLWindow, OpenGLWindow.TheWorld.ViewTarget) { RelativePosition = new Vector3d(0d, 10000 * Kilometers, 0d) }; //OGLDelegate.CameraMode = new JoystickCamera(OGLDelegate, OGLDelegate.TheWorld.ViewTarget) { Eye = new Vector3d(10f, 10f, 10f)}; OpenGLWindow.TheWorld.Tick(); }
public void Load(Widget w) { var wb = (IGtkWidgetBackend)Toolkit.GetBackend(w); box.Add(wb.Widget); }
internal Context(object backend, Toolkit toolkit, ContextBackendHandler handler) : base(backend, toolkit, handler) { this.handler = handler; }
private JMenuBar AddMenuBar() { JMenuBar menubar = new JMenuBar(); int shortcutMask = Toolkit.GetDefaultToolkit().GetMenuShortcutKeyMask(); int shiftShortcutMask = Toolkit.GetDefaultToolkit().GetMenuShortcutKeyMask() | InputEvent.ShiftDownMask; JMenu fileMenu = new JMenu("File"); menubar.Add(fileMenu); JMenu editMenu = new JMenu("Edit"); menubar.Add(editMenu); JMenu classifierMenu = new JMenu("Classifier"); menubar.Add(classifierMenu); /* * FILE MENU */ JMenuItem openFile = new JMenuItem("Open File"); openFile.SetMnemonic('O'); openFile.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkO, shortcutMask)); openFile.AddActionListener(actor); fileMenu.Add(openFile); JMenuItem loadURL = new JMenuItem("Load URL"); loadURL.SetMnemonic('L'); loadURL.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkU, shortcutMask)); loadURL.AddActionListener(actor); fileMenu.Add(loadURL); fileMenu.Add(new JSeparator()); saveUntagged = new JMenuItem("Save Untagged File"); saveUntagged.SetMnemonic('S'); saveUntagged.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkS, shortcutMask)); saveUntagged.AddActionListener(actor); saveUntagged.SetEnabled(false); fileMenu.Add(saveUntagged); JMenuItem saveUntaggedAs = new JMenuItem("Save Untagged File As ..."); saveUntaggedAs.SetMnemonic('U'); saveUntaggedAs.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkS, shiftShortcutMask)); saveUntaggedAs.AddActionListener(actor); fileMenu.Add(saveUntaggedAs); saveTaggedAs = new JMenuItem("Save Tagged File As ..."); saveTaggedAs.SetMnemonic('T'); saveTaggedAs.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkT, shortcutMask)); saveTaggedAs.AddActionListener(actor); saveTaggedAs.SetEnabled(false); fileMenu.Add(saveTaggedAs); if (!IsMacOSX()) { // don't need if on Mac, since it has its own Quit on application menu! fileMenu.Add(new JSeparator()); JMenuItem exit = new JMenuItem("Exit"); exit.SetMnemonic('x'); exit.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkQ, shortcutMask)); exit.AddActionListener(actor); fileMenu.Add(exit); } /* * EDIT MENU */ JMenuItem cut = new JMenuItem("Cut"); cut.SetMnemonic('X'); cut.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkX, shortcutMask)); cut.AddActionListener(actor); editMenu.Add(cut); JMenuItem copy = new JMenuItem("Copy"); copy.SetMnemonic('C'); copy.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkC, shortcutMask)); copy.AddActionListener(actor); editMenu.Add(copy); JMenuItem paste = new JMenuItem("Paste"); paste.SetMnemonic('V'); paste.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkV, shortcutMask)); paste.AddActionListener(actor); editMenu.Add(paste); JMenuItem clear = new JMenuItem("Clear"); clear.SetMnemonic('C'); // clear.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, shortcutMask)); // used for load CRF clear.AddActionListener(actor); editMenu.Add(clear); /* * CLASSIFIER MENU */ JMenuItem loadCRF = new JMenuItem("Load CRF from File"); loadCRF.SetMnemonic('R'); loadCRF.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkR, shortcutMask)); loadCRF.AddActionListener(actor); classifierMenu.Add(loadCRF); JMenuItem loadResourceCRF = new JMenuItem("Load CRF from Classpath"); // loadCRF.setMnemonic('R'); // loadCRF.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, shortcutMask)); loadResourceCRF.AddActionListener(actor); classifierMenu.Add(loadResourceCRF); JMenuItem loadDefaultCRF = new JMenuItem("Load Default CRF"); loadDefaultCRF.SetMnemonic('L'); loadDefaultCRF.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkL, shortcutMask)); loadDefaultCRF.AddActionListener(actor); classifierMenu.Add(loadDefaultCRF); extract = new JMenuItem("Run NER"); extract.SetMnemonic('N'); extract.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkN, shortcutMask)); extract.AddActionListener(actor); classifierMenu.Add(extract); return(menubar); }
public void Initialize() { //Create Mesh var mesh = new Mesh3(); mesh.AddVertex(0, 0, 0); mesh.AddVertex(0, 1, 0); mesh.AddVertex(0, 2, 0); mesh.AddVertex(1, 0, 0); mesh.AddVertex(1, 1, 0); mesh.AddVertex(1, 2, 0); mesh.AddVertex(2, 0, 0); mesh.AddVertex(2, 1, 0); mesh.AddVertex(2, 2, 0); mesh.AddFace(0, 3, 4); mesh.AddFace(1, 4, 5); mesh.AddFace(3, 6, 7); mesh.AddFace(4, 7, 8); mesh.AddFace(0, 4, 1); mesh.AddFace(1, 5, 2); mesh.AddFace(3, 7, 4); mesh.AddFace(4, 8, 5); //Create Model var k3d = new Toolkit(); var supportConditions = new List <bool>() { true, true, true, true, true, true }; var supports = new List <Support> { k3d.Support.Support(new Point3(0, 0, 0), supportConditions), k3d.Support.Support(new Point3(0, 1, 0), supportConditions), k3d.Support.Support(new Point3(0, 2, 0), supportConditions) }; var loads = new List <Load> { k3d.Load.PointLoad(new Point3(2, 2, 0), new Vector3(0, 0, -5)), k3d.Load.PointLoad(new Point3(2, 1, 0), new Vector3(0, 0, -5)), k3d.Load.PointLoad(new Point3(2, 0, 0), new Vector3(0, 0, -5)), }; var logger = new MessageLogger(); var crosec = k3d.CroSec.ReinforcedConcreteStandardShellConst(25, 0, null, new List <double> { 4, 4, -4, -4 }, 0); var shells = k3d.Part.MeshToShell(new List <Mesh3> { mesh }, null, new List <CroSec> { crosec }, logger, out var nodes); var model = k3d.Model.AssembleModel(shells, supports, loads, out var info, out var mass, out var cog, out var message, out var any_warning); model = k3d.Algorithms.AnalyzeThI(model, out var maxDisplacements, out var gravityForce, out var elasticEnergy, out var warning); //Create projection Vector Vector3 proj_vect = new Vector3(0, 0, -1); //Create other definition var tol = 1E-12; var delta = 0.02; _model = model; _projectionVector = proj_vect; _tol = tol; _delta = delta; }
public void EmitText(FormattedText markup) { var iterEnd = EndIter; var textmark = CreateMark(null, iterEnd, true); Insert(ref iterEnd, markup.Text); foreach (var attr in markup.Attributes) { var iterEndAttr = GetIterAtMark(textmark); iterEndAttr.ForwardChars(attr.StartIndex); var attrStart = CreateMark(null, iterEndAttr, true); iterEndAttr.ForwardChars(attr.Count); var tag = new Gtk.TextTag(null); if (attr is BackgroundTextAttribute) { var xa = (BackgroundTextAttribute)attr; tag.BackgroundGdk = xa.Color.ToGtkValue(); } else if (attr is ColorTextAttribute) { var xa = (ColorTextAttribute)attr; tag.ForegroundGdk = xa.Color.ToGtkValue(); } else if (attr is FontWeightTextAttribute) { var xa = (FontWeightTextAttribute)attr; tag.Weight = (Pango.Weight)(int) xa.Weight; } else if (attr is FontStyleTextAttribute) { var xa = (FontStyleTextAttribute)attr; tag.Style = (Pango.Style)(int) xa.Style; } else if (attr is UnderlineTextAttribute) { var xa = (UnderlineTextAttribute)attr; tag.Underline = xa.Underline ? Pango.Underline.Single : Pango.Underline.None; } else if (attr is StrikethroughTextAttribute) { var xa = (StrikethroughTextAttribute)attr; tag.Strikethrough = xa.Strikethrough; } else if (attr is FontTextAttribute) { var xa = (FontTextAttribute)attr; tag.FontDesc = (Pango.FontDescription)Toolkit.GetBackend(xa.Font); } else if (attr is LinkTextAttribute) { var xa = (LinkTextAttribute)attr; Uri uri = xa.Target; if (uri == null) { Uri.TryCreate(markup.Text.Substring(xa.StartIndex, xa.Count), UriKind.RelativeOrAbsolute, out uri); } var link = new Link { Href = uri }; tag.Underline = Pango.Underline.Single; tag.ForegroundGdk = Toolkit.CurrentEngine.Defaults.FallbackLinkColor.ToGtkValue(); Links [tag] = link; } TagTable.Add(tag); ApplyTag(tag, GetIterAtMark(attrStart), iterEndAttr); DeleteMark(attrStart); } DeleteMark(textmark); }
private void StartInternalWork() { Toolkit.TraceWriteLine("특정 스크린 마우스 이동 방지를 시작합니다."); _oldMousePoint.Clear(); _isStartMouseWork = true; Screen primaryScreen = Screen.PrimaryScreen; Screen preventScreen = Screen.AllScreens[_preventMoveScreenIndex]; Point useCurrentPt = Point.Empty; try { while (_isStartMouseWork) { Thread.Sleep(Interval); MousePoint mousePoint = MouseNative.GetCursorPoint(); if (!mousePoint.IsEmpty) { useCurrentPt.X = mousePoint.X; useCurrentPt.Y = mousePoint.Y; _oldMousePoint.Push(useCurrentPt); // 오래된 좌표 삭제 if (_oldMousePoint.Count >= _oldMousePointClear) { Stack <Point> reversePoints = new Stack <Point>(); int count = 0; foreach (Point point in _oldMousePoint.Reverse()) { bool isBreak = (_autoOldMousePointClear) ? !preventScreen.Bounds.Contains(point) : count >= _lessThanOldMousePointClear; if (isBreak) { break; } reversePoints.Push(point); count++; } _oldMousePoint.Clear(); _oldMousePoint = reversePoints; string text = String.Format("오래된 마우스 좌표를 삭제하였습니다. 삭제개수:{0}", count); Toolkit.TraceWriteLine(text); } // 특정 스크린에 좌표가 오기전의 좌표를 찾는다. Point lastPreventScreenOutsidePoint = Point.Empty; foreach (Point point in _oldMousePoint) { if (!preventScreen.Bounds.Contains(point)) { lastPreventScreenOutsidePoint = point; break; } } int x = lastPreventScreenOutsidePoint.X; int y = lastPreventScreenOutsidePoint.Y; // 비어 있을 경우 주 모니터 중앙으로 if (lastPreventScreenOutsidePoint.IsEmpty) { Point primaryCenterPoint = ScreenUtility.GetPrimaryScreenBoundsCenterPoint(); x = primaryCenterPoint.X; y = primaryCenterPoint.Y; } if (preventScreen.Bounds.Contains(useCurrentPt)) { MouseNative mouseNative = new MouseNative(); mouseNative.SetCursorPoint(x, y); mouseNative.MouseEvent(MouseEventFlags.MOVE); mouseNative.SetCursorPoint(x, y); string text = String.Format("{0} 스크린으로 마우스가 넘어갔습니다. 마우스 이동 처리를 시작합니다.", preventScreen.Bounds.ToString()); Toolkit.TraceWriteLine(text); text = String.Format("마우스를 (X={0}, Y={1}) 좌표로 이동을 완료하였습니다.", x, y); Toolkit.TraceWriteLine(text); if (IsSetMouseCursorPointAfterOldPointClear) { _oldMousePoint.Clear(); _oldMousePoint.Push(new Point(x, y)); Toolkit.TraceWrite("기존에 있는 모든 좌표를 삭제하고 마지막 이동한 좌표를 추가합니다."); } } } } } catch (Exception ex) { Toolkit.DebugWriteLine(ex); } }
static void Main(string[] args) { Toolkit.Execute <Program>(args); }
protected override void Initialise() { Toolkit.SetCommandExceptionHandler((con, err, ex, ob) => err.WrapLine(ex.ToString().Red())); base.HelpCommand <HelpCommand>(c => c.Topic); base.Initialise(); }
public ActionResult ChangeTaskStatus(string shortCode, string newTaskStatus, string comment) { return(ActionUtils.Json(() => { var task = m_dbAdapter.Task.GetTask(shortCode); var logicModel = Platform.GetProject(task.ProjectId); var oldStatus = task.TaskStatus; var newStatus = CommUtils.ParseEnum <TaskStatus>(newTaskStatus); if (newStatus == TaskStatus.Waitting && IsOverdue(task)) { newStatus = TaskStatus.Overdue; } var taskEx = CheckChangeTaskStatus(task, newStatus); //如果当前工作状态从完成修改为开始,修改后续工作的状态为未完成 if (oldStatus == TaskStatus.Finished && newStatus != TaskStatus.Finished) { var subsequentTasks = m_dbAdapter.Task.GetSubsequentTasksRecursively(shortCode); subsequentTasks = subsequentTasks.Where(x => x.TaskStatus == TaskStatus.Finished).ToList(); subsequentTasks.ForEach(x => new TaskLogicModel(logicModel, x).Stop(comment)); } var taskLogicModel = new TaskLogicModel(logicModel, task); //修改当前工作状态 if ((task.TaskStatus == TaskStatus.Error || task.TaskStatus == TaskStatus.Waitting || task.TaskStatus == TaskStatus.Overdue) && newStatus == TaskStatus.Finished) { taskLogicModel.Start(comment).Finish(comment); } else { m_dbAdapter.Task.ChangeTaskStatus(task, newStatus, comment); } //增加Activity logicModel.Activity.Add(task.ProjectId, ActivityObjectType.Task, task.ShortCode, "修改工作[" + task.Description + "]的工作状态为:" + Toolkit.ToCnString(newStatus)); //触发工作状态改变事件 if (taskEx != null) { taskEx.InvokeStatusChanged(oldStatus, newStatus); } return ActionUtils.Success(Toolkit.ToCnString(newStatus)); })); }
internal Context(object backend, Toolkit toolkit) : base(backend, toolkit, toolkit.ContextBackendHandler) { handler = ToolkitEngine.ContextBackendHandler; }
public ActionResult GetProjectSeriesList(int filterByCreatedDays = -1, string filterByStage = "") { return(ActionUtils.Json(() => { //Check param filterByStage var stages = new List <ProjectSeriesStage>(); if (!string.IsNullOrEmpty(filterByStage)) { stages = filterByStage.Split('|').ToList().ConvertAll(x => CommUtils.ParseEnum <ProjectSeriesStage>(x)); } var uids = m_dbAdapter.Permission.GetObjectUids(CurrentUserName, PermissionObjectType.ProjectSeries, PermissionType.Read); var projectSeriesList = m_dbAdapter.ProjectSeries.GetByGuids(uids); projectSeriesList = projectSeriesList.OrderBy(x => x.EstimatedFinishTime).ThenBy(x => x.CreateTime).ToList(); var projectSeriesLogicModelList = projectSeriesList.Where(x => { if (filterByCreatedDays >= 0 && (DateTime.Now - x.CreateTime).TotalDays > filterByCreatedDays) { return false; } if (!string.IsNullOrEmpty(filterByStage)) { return stages.Contains(x.Stage); } return true; }).ToList().ConvertAll(x => new ProjectSeriesLogicModel(CurrentUserName, x)); var dict = new Dictionary <string, string>(); var dictStatus = new Dictionary <string, string>(); //已完成工作数,未完成工作数,成员数(包含创建者、负责人) var dictTaskCount = new Dictionary <string, Tuple <int, int> >(); var dictPersonCount = new Dictionary <string, int>(); foreach (var projectSeriesLogicModel in projectSeriesLogicModelList) { var projectSeries = projectSeriesLogicModel.Instance; dictStatus[projectSeries.Guid] = "准备"; dict[projectSeries.Guid] = "0.00%"; dictTaskCount[projectSeries.Guid] = new Tuple <int, int>(0, 0); var allMembers = new List <string>(); if (projectSeriesLogicModel.CurrentProject != null) { projectSeriesLogicModel.CurrentProject.Team.Chiefs.Select(x => x.UserName).ToList(); } var logicModel = new ProjectSeriesLogicModel(CurrentUserName, projectSeries); if (logicModel.CurrentProject != null) { var project = logicModel.CurrentProject.Instance; var teamMembers = m_dbAdapter.TeamMember.GetByProjectId(project.ProjectId); var teamMemberUserNames = teamMembers.Select(x => x.UserName).ToList(); var teamAdmins = m_dbAdapter.TeamAdmin.GetByProjectId(project.ProjectId); var teamAdminUserNames = teamAdmins.Select(x => x.UserName).ToList(); allMembers.AddRange(teamMemberUserNames); allMembers.AddRange(teamAdminUserNames); var tasks = m_dbAdapter.Task.GetTasksByProjectId(project.ProjectId); var finishedTaskCount = tasks.Count(x => x.TaskStatus == TaskStatus.Finished); if (tasks.Count != 0) { dict[projectSeries.Guid] = CommUtils.Percent(finishedTaskCount, tasks.Count); dictStatus[projectSeries.Guid] = finishedTaskCount == 0 ? "准备" : (finishedTaskCount == tasks.Count ? "完成" : "进行中"); dictTaskCount[projectSeries.Guid] = new Tuple <int, int>(finishedTaskCount, tasks.Count); } } allMembers = allMembers.Distinct(StringComparer.OrdinalIgnoreCase).ToList(); dictPersonCount[projectSeries.Guid] = allMembers.Count; } var allUserNames = projectSeriesLogicModelList.Select(x => x.Instance.PersonInCharge) .Concat(projectSeriesLogicModelList.Select(x => x.Instance.CreateUserName)).Distinct(StringComparer.OrdinalIgnoreCase).ToArray(); var nicknames = UserService.GetNicknames(allUserNames); var result = projectSeriesLogicModelList.ConvertAll(logicModel => { var x = logicModel.Instance; return new { name = x.Name, guid = x.Guid, type = x.Type.ToString(), personInCharge = new { userName = x.PersonInCharge, realName = nicknames.ContainsKey(x.Name) ? nicknames[x.Name] : x.Name, }, createUser = new { userName = x.CreateUserName, realName = nicknames.ContainsKey(x.Name) ? nicknames[x.Name] : x.Name, }, isCreator = IsCurrentUser(x.CreateUserName), createTimeStamp = x.CreateTime.ToString("yyyy-MM-dd"), estimatedFinishTime = Toolkit.DateToString(x.EstimatedFinishTime), remainingDayCount = x.EstimatedFinishTime.HasValue ? ((int)(x.EstimatedFinishTime.Value - DateTime.Today).TotalDays).ToString() : "-", percentCompleted = dict[x.Guid], finishedTaskCount = dictTaskCount[x.Guid].Item1, taskCount = dictTaskCount[x.Guid].Item2, status = dictStatus[x.Guid], stage = x.Stage.ToString(), currentProjectGuid = (logicModel.CurrentProject == null ? "" : logicModel.CurrentProject.Instance.ProjectGuid), permission = new { write = m_dbAdapter.Permission.HasPermission(CurrentUserName, x.Guid, PermissionType.Write) }, personCount = dictPersonCount[x.Guid], }; }); return ActionUtils.Success(result); })); }
internal TextLayout(Toolkit tk) { ToolkitEngine = null; InitForToolkit (tk); }
internal static bool IsKeyDown(KeyCode key) { return(Toolkit.IsKeyDown((Common.Win32Lib.Win32.VKey)key)); }
private string guestLogin() { return(Login(Toolkit.GetSetting("AnonymousUserName", "guest"), Toolkit.GetSetting("AnonymousPassword", "guest"))); }
protected XwtObject () { ToolkitEngine = Toolkit.CurrentEngine; }
//// Steps for resolving a ViewModel to View //// 1. Find all ViewModel requested Views matching the ControlKind //// 2. Find all Views supporting the ViewModel matching the ControlKind //// 3. Find all Views supporting the ViewModel without ControlKind /// <summary> /// Look up the ViewDescriptor for this presentable model and ControlKind /// </summary> /// <param name="self"></param> /// <param name="tk"></param> /// <param name="requestedControlKind"></param> /// <returns></returns> public static ViewDescriptor GetViewDescriptor( this ViewModelDescriptor self, Toolkit tk, ControlKind requestedControlKind) { // Checks if (self == null) throw new ArgumentNullException("self"); #region Cache Management PrimeCaches(tk, self.ReadOnlyContext); var key = new ViewDescriptorCache.Key(self.ViewModelRef, tk, requestedControlKind); if (_viewDescriptorCache.ContainsKey(key)) return _viewDescriptorCache[key]; #endregion // If the ViewModel has a more specific DefaultKind respect its choice if (self.DefaultEditorKind != null && requestedControlKind != null && self.DefaultEditorKind.AndParents().Select(i => i.ExportGuid).Contains(requestedControlKind.ExportGuid)) { if (requestedControlKind != self.DefaultEditorKind) { Logging.Log.DebugFormat("Using more specific default kind: {0} -> {1}", requestedControlKind.Name, self.DefaultEditorKind.Name); } requestedControlKind = self.DefaultEditorKind; } else { requestedControlKind = self.SecondaryControlKinds .FirstOrDefault( sck => sck.AndParents() .Select(i => i.ExportGuid) .Contains(requestedControlKind.ExportGuid) ) ?? requestedControlKind; } ViewDescriptor result = null; ICollection<ViewDescriptor> candidates; if (requestedControlKind != null) { candidates = _viewCaches[tk].GetDescriptors(requestedControlKind); } else { candidates = _viewCaches[tk].GetDescriptors(); } if (candidates.Count == 0) { // Try parent var parent = self.ViewModelRef.Parent != null ? self.ViewModelRef.Parent.GetViewModelDescriptor() : null; if (parent != null) { result = GetViewDescriptor(parent, tk, requestedControlKind); } else { Logging.Log.WarnFormat("Couldn't find ViewDescriptor for '{1}' matching ControlKind: '{0}'", requestedControlKind, self.ViewModelRef); } } else if (candidates.Count == 1) { result = candidates.First(); } else { var allTypes = GetAllTypes(self); // As allTypes is sorted from most specific to least specific first or default is perfect. var match = allTypes.SelectMany(t => candidates.Where(c => c.SupportedViewModels.Contains(t))).FirstOrDefault(); // Try the most common if (match == null) { match = allTypes.SelectMany(t => candidates.Where(c => c.SupportedViewModels.Count == 0)).FirstOrDefault(); } // Log a warning if nothing found if (match == null) { Logging.Log.WarnFormat("Couldn't find ViewDescriptor for '{1}' matching ControlKind: '{0}'", requestedControlKind, self.GetType().FullName); } result = match; } _viewDescriptorCache[key] = result; return result; }
public Key( TypeRef vmd, Toolkit tk, ControlKind ck) { this.vmd = vmd.ExportGuid; this.tk = tk; this.ck = ck != null ? ck.ExportGuid : Guid.Empty; }
void HandleWidgetClicked(object sender, EventArgs e) { Toolkit.Invoke(EventSink.OnClicked); }
public bool ContainsKey(Toolkit key) { return _cache.ContainsKey(key); }
static void Main(string[] args) { Toolkit.Init(new ToolkitOptions { Backend = PlatformBackend.PreferNative, EnableHighResolution = true }); Version = Assembly.GetEntryAssembly().GetCustomAttribute <AssemblyInformationalVersionAttribute>().InformationalVersion; Console.Title = $"Ryujinx Console {Version}"; string systemPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine); Environment.SetEnvironmentVariable("Path", $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")};{systemPath}"); // Hook unhandled exception and process exit events GLib.ExceptionManager.UnhandledException += (GLib.UnhandledExceptionArgs e) => ProcessUnhandledException(e.ExceptionObject as Exception, e.IsTerminating); AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => ProcessUnhandledException(e.ExceptionObject as Exception, e.IsTerminating); AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) => ProgramExit(); // Initialize the configuration ConfigurationState.Initialize(); // Initialize the logger system LoggerModule.Initialize(); // Initialize Discord integration DiscordIntegrationModule.Initialize(); string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"); string globalBasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx"); string globalConfigurationPath = Path.Combine(globalBasePath, "Config.json"); // Now load the configuration as the other subsystems are now registered if (File.Exists(localConfigurationPath)) { ConfigurationPath = localConfigurationPath; ConfigurationFileFormat configurationFileFormat = ConfigurationFileFormat.Load(localConfigurationPath); ConfigurationState.Instance.Load(configurationFileFormat, ConfigurationPath); } else if (File.Exists(globalConfigurationPath)) { ConfigurationPath = globalConfigurationPath; ConfigurationFileFormat configurationFileFormat = ConfigurationFileFormat.Load(globalConfigurationPath); ConfigurationState.Instance.Load(configurationFileFormat, ConfigurationPath); } else { // No configuration, we load the default values and save it on disk ConfigurationPath = globalConfigurationPath; // Make sure to create the Ryujinx directory if needed. Directory.CreateDirectory(globalBasePath); ConfigurationState.Instance.LoadDefault(); ConfigurationState.Instance.ToFileFormat().SaveConfig(globalConfigurationPath); } PrintSystemInfo(); Profile.Initialize(); Application.Init(); string globalProdKeysPath = Path.Combine(globalBasePath, "system", "prod.keys"); string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys"); if (!File.Exists(globalProdKeysPath) && !File.Exists(userProfilePath) && !Migration.IsMigrationNeeded()) { GtkDialog.CreateWarningDialog("Key file was not found", "Please refer to `KEYS.md` for more info"); } MainWindow mainWindow = new MainWindow(); mainWindow.Show(); if (args.Length == 1) { mainWindow.LoadApplication(args[0]); } Application.Run(); }
/// <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; }
private void StartInternalWork() { Toolkit.TraceWriteLine("특정 스크린 프로세스 창 이동 방지를 시작합니다."); _isStartWindowWorker = true; Screen preventScreen = Screen.AllScreens[PreventMoveSceenIndex]; while (_isStartWindowWorker) { foreach (Process process in Process.GetProcesses()) { if (ExceptProcessNames.Contains(process.ProcessName)) { continue; } // 프로세스의 모든 윈도우 핸들 찾아서 처리할지 여부 if (_processAllWindowsHandleSetPosProcessNames.Contains(process.ProcessName)) { // TODO: 특정 프로세스의 모든 윈도우 핸들을 찾아서 처리할지 여부도 이벤트핸들러로 정의 필요 foreach (IntPtr windowHandle in WindowManager.GetProcessWindowHandles(process.Id)) { string windowText = WindowManager.GetWindowText(windowHandle); WindowPlacement wp = new WindowPlacement(); if (User32.GetWindowPlacement(windowHandle, ref wp)) { RECT rect = RECT.Empty; User32.GetWindowRect(windowHandle, out rect); // TODO: WindowPlacement ShowCmd.Maximize, ShowCmd.ShowMaximized 크기 20정도 줄이기 if (wp.ShowCmd == ShowWindowCommand.Maximize || wp.ShowCmd == ShowWindowCommand.ShowMaximized) { // outRect 사이즈를 줄여야 함 rect.Deflate(20, 20); } if (IsNearPreventScreenStartPositionOrEndPosition(preventScreen, ref rect)) { } if (ProcessAllWindowsHandleSetPos.Invoke(this, new ProcessAllSetWindowPosEventArgs(process, windowHandle, wp, windowText))) { if (preventScreen.BoundsContains(rect.ToPoints())) { ProcessSetWindowPos(windowHandle, rect); string text = String.Format("ProcessSetWindowPos ProcessName={0}, Handle={1}, ShowWindowCommand={2}, Text={3}", process.ProcessName, windowHandle, wp.ShowCmd.ToString(), windowText); Toolkit.TraceWriteLine(text); } } } } } else { WindowPlacement wp = new WindowPlacement(); if (User32.GetWindowPlacement(process.MainWindowHandle, ref wp)) { RECT rect; User32.GetWindowRect(process.MainWindowHandle, out rect); // TODO: WindowPlacement ShowCmd.Maximize, ShowCmd.ShowMaximized 크기 20정도 줄이기 if (wp.ShowCmd == ShowWindowCommand.Maximize || wp.ShowCmd == ShowWindowCommand.ShowMaximized) { // outRect 사이즈를 줄여야 함 rect.Deflate(20, 20); } if (IsNearPreventScreenStartPositionOrEndPosition(preventScreen, ref rect)) { } if (preventScreen.BoundsContains(rect.ToPoints())) { ProcessSetWindowPos(process.MainWindowHandle, rect); string text = String.Format("ProcessSetWindowPos ProcessName={0}, Handle={1}, ShowWindowCommand={2}, Title={3}", process.ProcessName, process.MainWindowHandle, wp.ShowCmd.ToString(), process.MainWindowTitle); Toolkit.TraceWriteLine(text); } } } } } }
/// <summary> /// Exports materials for host object. /// </summary> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="hostObject">The host object.</param> /// <param name="elemHnds">The host IFC handles.</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</param> /// <returns>True if exported successfully, false otherwise.</returns> public static bool ExportHostObjectMaterials(ExporterIFC exporterIFC, HostObject hostObject, IList<IFCAnyHandle> elemHnds, GeometryElement geometryElement, ProductWrapper productWrapper, ElementId levelId, Toolkit.IFCLayerSetDirection direction, bool containsBRepGeometry) { if (hostObject == null) return true; //nothing to do if (elemHnds == null || (elemHnds.Count == 0)) return true; //nothing to do IFCFile file = exporterIFC.GetFile(); using (IFCTransaction tr = new IFCTransaction(file)) { if (productWrapper != null) productWrapper.ClearFinishMaterials(); double scaledOffset = 0.0, scaledWallWidth = 0.0, wallHeight = 0.0; Wall wall = hostObject as Wall; if (wall != null) { scaledWallWidth = UnitUtil.ScaleLength(wall.Width); scaledOffset = -scaledWallWidth / 2.0; BoundingBoxXYZ boundingBox = wall.get_BoundingBox(null); if (boundingBox != null) wallHeight = boundingBox.Max.Z - boundingBox.Min.Z; } ElementId typeElemId = hostObject.GetTypeId(); IFCAnyHandle materialLayerSet = ExporterCacheManager.MaterialLayerSetCache.Find(typeElemId); // Roofs with no components are only allowed one material. We will arbitrarily choose the thickest material. IFCAnyHandle primaryMaterialHnd = ExporterCacheManager.MaterialLayerSetCache.FindPrimaryMaterialHnd(typeElemId); if (IFCAnyHandleUtil.IsNullOrHasNoValue(materialLayerSet)) { HostObjAttributes hostObjAttr = hostObject.Document.GetElement(typeElemId) as HostObjAttributes; if (hostObjAttr == null) return true; //nothing to do List<ElementId> matIds = new List<ElementId>(); List<double> widths = new List<double>(); List<MaterialFunctionAssignment> functions = new List<MaterialFunctionAssignment>(); ElementId baseMatId = CategoryUtil.GetBaseMaterialIdForElement(hostObject); CompoundStructure cs = hostObjAttr.GetCompoundStructure(); if (cs != null) { //TODO: Vertically compound structures are not yet supported by export. if (!cs.IsVerticallyHomogeneous() && !MathUtil.IsAlmostZero(wallHeight)) cs = cs.GetSimpleCompoundStructure(wallHeight, wallHeight / 2.0); for (int i = 0; i < cs.LayerCount; ++i) { ElementId matId = cs.GetMaterialId(i); if (matId != ElementId.InvalidElementId) { matIds.Add(matId); } else { matIds.Add(baseMatId); } widths.Add(cs.GetLayerWidth(i)); // save layer function into ProductWrapper, // it's used while exporting "Function" of Pset_CoveringCommon functions.Add(cs.GetLayerFunction(i)); } } if (matIds.Count == 0) { matIds.Add(baseMatId); widths.Add(cs != null ? cs.GetWidth() : 0); functions.Add(MaterialFunctionAssignment.None); } // We can't create IfcMaterialLayers without creating an IfcMaterialLayerSet. So we will simply collate here. IList<IFCAnyHandle> materialHnds = new List<IFCAnyHandle>(); IList<int> widthIndices = new List<int>(); double thickestLayer = 0.0; for (int ii = 0; ii < matIds.Count; ++ii) { // Require positive width for IFC2x3 and before, and non-negative width for IFC4. if (widths[ii] < -MathUtil.Eps()) continue; bool almostZeroWidth = MathUtil.IsAlmostZero(widths[ii]); if (ExporterCacheManager.ExportOptionsCache.FileVersion != IFCVersion.IFC4 && almostZeroWidth) continue; if (almostZeroWidth) widths[ii] = 0.0; IFCAnyHandle materialHnd = CategoryUtil.GetOrCreateMaterialHandle(exporterIFC, matIds[ii]); if (primaryMaterialHnd == null || (widths[ii] > thickestLayer)) { primaryMaterialHnd = materialHnd; thickestLayer = widths[ii]; } widthIndices.Add(ii); materialHnds.Add(materialHnd); if ((productWrapper != null) && (functions[ii] == MaterialFunctionAssignment.Finish1 || functions[ii] == MaterialFunctionAssignment.Finish2)) { productWrapper.AddFinishMaterial(materialHnd); } } int numLayersToCreate = widthIndices.Count; if (numLayersToCreate == 0) return false; if (!containsBRepGeometry) { IList<IFCAnyHandle> layers = new List<IFCAnyHandle>(numLayersToCreate); for (int ii = 0; ii < numLayersToCreate; ii++) { int widthIndex = widthIndices[ii]; double scaledWidth = UnitUtil.ScaleLength(widths[widthIndex]); IFCAnyHandle materialLayer = IFCInstanceExporter.CreateMaterialLayer(file, materialHnds[ii], scaledWidth, null); layers.Add(materialLayer); } string layerSetName = exporterIFC.GetFamilyName(); materialLayerSet = IFCInstanceExporter.CreateMaterialLayerSet(file, layers, layerSetName); ExporterCacheManager.MaterialLayerSetCache.Register(typeElemId, materialLayerSet); ExporterCacheManager.MaterialLayerSetCache.RegisterPrimaryMaterialHnd(typeElemId, primaryMaterialHnd); } else { foreach (IFCAnyHandle elemHnd in elemHnds) { CategoryUtil.CreateMaterialAssociations(exporterIFC, elemHnd, matIds); } } } // IfcMaterialLayerSetUsage is not supported for IfcWall, only IfcWallStandardCase. IFCAnyHandle layerSetUsage = null; for (int ii = 0; ii < elemHnds.Count; ii++) { IFCAnyHandle elemHnd = elemHnds[ii]; if (IFCAnyHandleUtil.IsNullOrHasNoValue(elemHnd)) continue; SpaceBoundingElementUtil.RegisterSpaceBoundingElementHandle(exporterIFC, elemHnd, hostObject.Id, levelId); if (containsBRepGeometry) continue; HashSet<IFCAnyHandle> relDecomposesSet = IFCAnyHandleUtil.GetRelDecomposes(elemHnd); IList<IFCAnyHandle> subElemHnds = null; if (relDecomposesSet != null && relDecomposesSet.Count == 1) { IFCAnyHandle relAggregates = relDecomposesSet.First(); if (IFCAnyHandleUtil.IsTypeOf(relAggregates, IFCEntityType.IfcRelAggregates)) subElemHnds = IFCAnyHandleUtil.GetAggregateInstanceAttribute<List<IFCAnyHandle>>(relAggregates, "RelatedObjects"); } bool hasSubElems = (subElemHnds != null && subElemHnds.Count != 0); bool isRoof = IFCAnyHandleUtil.IsTypeOf(elemHnd, IFCEntityType.IfcRoof); if (!hasSubElems && !isRoof && !IFCAnyHandleUtil.IsTypeOf(elemHnd, IFCEntityType.IfcWall)) { if (layerSetUsage == null) { bool flipDirSense = true; if (wall != null) { // if we have flipped the center curve on export, we need to take that into account here. // We flip the center curve on export if it is an arc and it has a negative Z direction. LocationCurve locCurve = wall.Location as LocationCurve; if (locCurve != null) { Curve curve = locCurve.Curve; Plane defPlane = new Plane(XYZ.BasisX, XYZ.BasisY, XYZ.Zero); bool curveFlipped = GeometryUtil.MustFlipCurve(defPlane, curve); flipDirSense = !(wall.Flipped ^ curveFlipped); } } else if (hostObject is Floor) { flipDirSense = false; } double offsetFromReferenceLine = flipDirSense ? -scaledOffset : scaledOffset; IFCDirectionSense sense = flipDirSense ? IFCDirectionSense.Negative : IFCDirectionSense.Positive; layerSetUsage = IFCInstanceExporter.CreateMaterialLayerSetUsage(file, materialLayerSet, direction, sense, offsetFromReferenceLine); } ExporterCacheManager.MaterialLayerRelationsCache.Add(layerSetUsage, elemHnd); } else { if (hasSubElems) { foreach (IFCAnyHandle subElemHnd in subElemHnds) { if (!IFCAnyHandleUtil.IsNullOrHasNoValue(subElemHnd)) ExporterCacheManager.MaterialLayerRelationsCache.Add(materialLayerSet, subElemHnd); } } else if (!isRoof) { ExporterCacheManager.MaterialLayerRelationsCache.Add(materialLayerSet, elemHnd); } else if (primaryMaterialHnd != null) { ExporterCacheManager.MaterialLayerRelationsCache.Add(primaryMaterialHnd, elemHnd); } } } tr.Commit(); return true; } }
public override object GetNativeWidget(Widget w) { IGtkWidgetBackend wb = (IGtkWidgetBackend)Toolkit.GetBackend(w); return(wb.Widget); }
public ActionResult Index(string shortCode) { if (string.IsNullOrEmpty(shortCode)) { return(RedirectToAction("Index", "Schedule")); } var task = m_dbAdapter.Task.GetTask(shortCode); var project = m_dbAdapter.Project.GetProjectById(task.ProjectId); task.ProjectName = project.Name; var taskViewModel = Toolkit.ConvertTask(task); GetPrevAndNextTaskShortCode(taskViewModel, task); taskViewModel.ProjectGuid = project.ProjectGuid; taskViewModel.TaskHandler = Platform.UserProfile.GetDisplayRealNameAndUserName(taskViewModel.TaskHandler); taskViewModel.PrevTaskNameArray = new List <string>(); taskViewModel.PrevTaskShortCodeArray = new List <string>(); foreach (var prevTaskId in task.PrevTaskIdArray) { var prevTask = m_dbAdapter.Task.GetTask(prevTaskId); taskViewModel.PrevTaskShortCodeArray.Add(prevTask.ShortCode); taskViewModel.PrevTaskNameArray.Add(prevTask.Description); } //Get task extension info. if (task.TaskExtensionId.HasValue) { var taskExtension = m_dbAdapter.Task.GetTaskExtension(task.TaskExtensionId.Value); taskExtension.TaskExtensionHandler = Platform.UserProfile.GetDisplayRealNameAndUserName(taskExtension.TaskExtensionHandler); taskViewModel.TaskExtension = Toolkit.ConvertTaskExtension(taskExtension); var instance = TaskExFactory.CreateInstance(taskViewModel.TaskExtension.Type, shortCode, CurrentUserName); if (instance != null) { //扩展工作页面初始化时的异常返回错误信息 object entity; try { entity = instance.GetEntity(); } catch (ApplicationException e) { entity = e.Message; } taskViewModel.TaskExtension.Info = entity; } } //Get task status history info. var taskStatusHitory = m_dbAdapter.Task.GetTaskStatusHistory(task.TaskId); if (taskStatusHitory != null) { var usernameCache = new Dictionary <string, string>(); taskViewModel.TaskStatusHistory = new List <TaskStatusHistoryViewModel>(); foreach (var item in taskStatusHitory) { var viewModel = Toolkit.ConvertTaskStatusHistory(item); string name = string.Empty; if (usernameCache.ContainsKey(viewModel.TimeStampUserName)) { name = usernameCache[viewModel.TimeStampUserName]; } else { name = m_dbAdapter.Authority.GetNameByUserName(viewModel.TimeStampUserName); usernameCache[viewModel.TimeStampUserName] = name; } name = string.IsNullOrEmpty(name) ? viewModel.TimeStampUserName : (name + "(" + viewModel.TimeStampUserName + ")"); viewModel.TimeStampUserName = name; taskViewModel.TaskStatusHistory.Add(viewModel); } } taskViewModel.ProjectSeriesStage = ProjectSeriesStage.存续期; if (project.ProjectSeriesId.HasValue && project.TypeId.HasValue && project.TypeId.Value == 1) { taskViewModel.ProjectSeriesStage = ProjectSeriesStage.发行; var projectSeries = m_dbAdapter.ProjectSeries.GetById(project.ProjectSeriesId.Value); taskViewModel.ProjectSeriesGuid = projectSeries.Guid; } return(View(taskViewModel)); }
/// <summary> /// Looks up the default ViewDesriptor matching the ViewModel and Toolkit; /// uses the ViewModelDescriptor's DefaultVisualType /// </summary> /// <param name="pmd">the specified ViewModelDescriptor</param> /// <param name="tk">the specified Toolkit</param> /// <returns>the default ViewDescriptor to display this ViewModel with this Toolkit</returns> public static ViewDescriptor GetViewDescriptor( this ViewModelDescriptor pmd, Toolkit tk) { return GetViewDescriptor(pmd, tk, GetDefaultEditorKind(pmd)); }
public override object GetNativeImage(Xwt.Drawing.Image image) { var pix = (GtkImage)Toolkit.GetBackend(image); return(pix.ToPixbuf(ApplicationContext, image.Size.Width, image.Size.Height)); }
private static void PrimeCaches(Toolkit? tk, IReadOnlyZetboxContext ctx) { if (_pmdCache == null) { _pmdCache = new ViewModelDescriptorCache(ctx); } if (tk.HasValue && !_viewCaches.ContainsKey(tk.Value)) { _viewCaches[tk.Value] = ViewDescriptorToolkitCache.Content.CreateCache(tk.Value, ctx); } }
public override object GetNativeParentWindow(Widget w) { IGtkWidgetBackend wb = (IGtkWidgetBackend)Toolkit.GetBackend(w); return(wb.Widget.Toplevel as Gtk.Window); }
public Content this[Toolkit key] { get { return _cache[key]; } set { _cache[key] = value; ItemAdded(); } }
public override bool HasNativeParent(Widget w) { IGtkWidgetBackend wb = (IGtkWidgetBackend)Toolkit.GetBackend(w); return(wb.Widget.Parent != null); }
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; }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); m_toolkit = Toolkit.Initialize(this, ServiceLocatorOptions.All); m_toolkit.CommandManager.AddAllCommandsFrom(Assembly.GetExecutingAssembly()); }
/// <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); }
public void MeshLoadProfiling() { var k3d = new Toolkit(); var logger = new MessageLogger(); int nBeams = 20; int nFaces = 1500; double lengthBeams = 10.0; double xIncBeam = lengthBeams / nBeams; double xIncMesh = lengthBeams / nFaces; double limit_dist = xIncBeam / 100.0; // create beams var lines = new List <Line3>(); var nodeI = new Point3(0, 0, 0); for (int beamInd = 0; beamInd < nBeams; ++beamInd) { var nodeK = new Point3(nodeI.X + xIncBeam, 0, 0); lines.Add(new Line3(nodeI, nodeK)); nodeI = nodeK; } var builderElements = k3d.Part.LineToBeam(lines, new List <string>(), new List <CroSec>(), logger, out List <Point3> outPoints); // create a MeshLoad var mesh = new Mesh3((nFaces + 1) * 2, nFaces); mesh.AddVertex(new Point3(0, -0.5, 0)); mesh.AddVertex(new Point3(0, 0.5, 0)); for (var faceInd = 0; faceInd < nFaces; ++faceInd) { mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, -0.5, 0)); mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, 0.5, 0)); var nV = mesh.Vertices.Count; mesh.AddFace(nV - 4, nV - 3, nV - 1, nV - 2); } UnitsConversionFactory ucf = UnitsConversionFactory.Conv(); UnitConversion m = ucf.m(); var baseMesh = m.toBaseMesh(mesh); // create a mesh load var load = k3d.Load.MeshLoad(new List <Vector3>() { new Vector3(0, 0, -1) }, baseMesh); // create a support var support = k3d.Support.Support(new Point3(0, 0, 0), k3d.Support.SupportFixedConditions); // assemble the model var model = k3d.Model.AssembleModel(builderElements, new List <Support>() { support }, new List <Load>() { load }, out var info, out var mass, out var cog, out var message, out var runtimeWarning); // calculate the model model = k3d.Algorithms.AnalyzeThI(model, out var outMaxDisp, out var outG, out var outComp, out var warning); Assert.AreEqual(outMaxDisp[0], 2.8232103119228276, 1E-5); }
internal ApplicationContext (Toolkit toolkit) { this.toolkit = toolkit; }
public Context(object backend, Toolkit toolkit, ContextBackendHandler handler) : base(backend, toolkit, handler) { this.handler = handler; }
internal Context(object backend, Toolkit toolkit) : this(backend, toolkit, toolkit.ContextBackendHandler) { }
internal static void Main(string[] args) { CurrentHost = new Host(); // file system FileSystem = FileSystem.FromCommandLineArgs(args, CurrentHost); FileSystem.CreateFileSystem(); CurrentRoute = new CurrentRoute(CurrentHost, Renderer); Options.LoadOptions(); Renderer = new NewRenderer(CurrentHost, Interface.CurrentOptions, FileSystem); Renderer.CameraTrackFollower = new TrackFollower(CurrentHost); TrainManager = new TrainManager(CurrentHost, Renderer, Interface.CurrentOptions, FileSystem); if (Renderer.Screen.Width == 0 || Renderer.Screen.Height == 0) { Renderer.Screen.Width = 960; Renderer.Screen.Height = 600; } string error; if (!CurrentHost.LoadPlugins(FileSystem, Interface.CurrentOptions, out error, TrainManager, Renderer)) { MessageBox.Show(error, @"OpenBVE", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // command line arguments List <string> filesToLoad = new List <string>(); if (args.Length != 0) { for (int i = 0; i < args.Length; i++) { if (args[i] != null) { if (System.IO.File.Exists(args[i])) { for (int j = 0; j < CurrentHost.Plugins.Length; j++) { if (CurrentHost.Plugins[j].Route != null && CurrentHost.Plugins[j].Route.CanLoadRoute(args[i])) { string File = System.IO.Path.Combine(Application.StartupPath, "RouteViewer.exe"); if (System.IO.File.Exists(File)) { System.Diagnostics.Process.Start(File, args[i]); } continue; } if (CurrentHost.Plugins[j].Object != null && CurrentHost.Plugins[j].Object.CanLoadObject(args[i])) { filesToLoad.Add(args[i]); } } } else if (args[i].ToLowerInvariant() == "/enablehacks") { //Deliberately undocumented option for debugging use Interface.CurrentOptions.EnableBveTsHacks = true; for (int j = 0; j < CurrentHost.Plugins.Length; j++) { if (CurrentHost.Plugins[j].Object != null) { CompatabilityHacks enabledHacks = new CompatabilityHacks { BveTsHacks = true, CylinderHack = false, BlackTransparency = true }; CurrentHost.Plugins[j].Object.SetCompatibilityHacks(enabledHacks); } } } } } if (filesToLoad.Count != 0) { Files = filesToLoad; } } var options = new ToolkitOptions { Backend = PlatformBackend.PreferX11 }; Toolkit.Init(options); // initialize camera currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntiAliasingLevel); currentGameWindow = new ObjectViewer(Renderer.Screen.Width, Renderer.Screen.Height, currentGraphicsMode, "Object Viewer", GameWindowFlags.Default) { Visible = true, TargetUpdateFrequency = 0, TargetRenderFrequency = 0, Title = "Object Viewer" }; currentGameWindow.Run(); // quit Renderer.TextureManager.UnloadAllTextures(); formTrain.WaitTaskFinish(); }
internal void InitForToolkit(Toolkit tk) { if (ToolkitEngine == null || ToolkitEngine != tk) { // If this is a re-initialization we dispose the previous state if (handler != null) { Dispose (); GC.ReRegisterForFinalize (this); } ToolkitEngine = tk; handler = ToolkitEngine.TextLayoutBackendHandler; Backend = handler.Create (); Setup (); font = (Font)tk.ValidateObject (font); if (font != null) handler.SetFont (Backend, font); if (text != null) handler.SetText (Backend, text); if (width != -1) handler.SetWidth (Backend, width); if (height != -1) handler.SetHeight (Backend, height); if (attributes != null && attributes.Count > 0) foreach (var attr in attributes) handler.AddAttribute (Backend, attr); } }
internal Context(object backend, Toolkit toolkit) : this(backend, toolkit, toolkit.ContextBackendHandler) { }
internal UILoop(Toolkit toolkit) { this.toolkit = toolkit; }
public string GetVersion() { return(Toolkit.GetApplicationVersion()); }