public Design(JToken json) { if (json == null) { throw new ArgumentNullException(nameof(json)); } var jsonLayoutComponent = json[JsonNames.LayoutComponent]; if (jsonLayoutComponent != null) { m_layoutComponent = (LayoutComponent)ComponentFactory.Singleton.Create(jsonLayoutComponent); } var jsonBlockComponents = json[JsonNames.BlockComponents]; if (jsonBlockComponents != null) { var blockComponents = new ComponentList(jsonBlockComponents); foreach (var blockComponent in blockComponents) { m_layoutComponent.Children.Add(blockComponent); } } var jsonParameters = json[JsonNames.Parameters]; m_parameters = jsonParameters != null ? new DesignParameterCollection(jsonParameters) : new DesignParameterCollection(); }
private static XDesign_LayoutPreview XDesign_LayoutPreview(LayoutComponent layoutComponent, int size) { var blockSize = new Dimension(12, DimensionUnits.Inch); var layoutWidth = blockSize * layoutComponent.ColumnCount; var layoutHeight = blockSize * layoutComponent.RowCount; var maxDimension = layoutWidth > layoutHeight ? layoutWidth : layoutHeight; var scale = new DimensionScale(maxDimension.Value, maxDimension.Unit, size, DimensionUnits.Pixel); var pageLayoutNode = new PageLayoutNode(layoutWidth * scale, layoutHeight * scale); pageLayoutNode.LayoutSites[0].Node = layoutComponent.Expand(false); pageLayoutNode.UpdateBounds(PathOrientation.CreateDefault(), scale); var result = new XDesign_LayoutPreview() { width = (int)(layoutWidth * scale).Value, height = (int)(layoutHeight * scale).Value, layoutSites = XDesign_LayoutSites(pageLayoutNode, Palettes.Rainbow) }; return(result); }
public OriComponent(LiveSplitState state) { try { mem = new OriMemory(); settings = new OriSettings(this); mem.AddLogItems(keys); mapDisplay = new LayoutComponent("LiveSplit.OriDE.dll", new OriMapDisplayComponent(mem)); foreach (string key in keys) { currentValues[key] = ""; } if (state != null) { Model = new TimerModel() { CurrentState = state }; state.OnReset += OnReset; state.OnPause += OnPause; state.OnResume += OnResume; state.OnStart += OnStart; state.OnSplit += OnSplit; state.OnUndoSplit += OnUndoSplit; state.OnSkipSplit += OnSkipSplit; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private bool TryApplyLayout(LayoutComponent Layout) { if (CheckLayoutFit(Layout, 1)) { Layout.gameObject.SetActive(true); ApplyLayoutBounds(Layout); var Duplicate = DuplicateLayout(Layout); ScoringComponent[] ScoringComps = Layout.GetComponentsInChildren <ScoringComponent>(); foreach (var comp in ScoringComps) { TargetLocations.Add(comp); var Pickable = comp.GetComponent <Pickable>(); foreach (var pickPointsCollider in Pickable.pickPointsColliders) { pickPointsCollider.GetComponent <MeshRenderer>().enabled = false; } } var ScoringComps2 = Duplicate.GetComponentsInChildren <ScoringComponent>(); foreach (var comp in ScoringComps2) { FurnitureLocations.Add(comp); } return(true); } return(false); }
public static void Main(string[] args) { var hostBuilder = Host.CreateDefaultBuilder(args); _ = hostBuilder.ConfigureLogging(logging => { // Add logging support to Azure BLOB's and the servers file system. // This logging is only active when App Service Logs are enabled through the Azure portal. // _ = logging.AddAzureWebAppDiagnostics(); // Enable logging data to be transmitted to Application Insights. // //_ = logging.AddApplicationInsights(); }); _ = hostBuilder.ConfigureServices(services => { // Configure the logging associated with AddAzureWebAppDiagnostics above. // _ = services.Configure <AzureFileLoggerOptions>(options => { }); _ = services.Configure <AzureBlobLoggerOptions>(options => { }); }); _ = hostBuilder.ConfigureWebHostDefaults(builder => builder.UseStartup <Startup>()); var host = hostBuilder.Build(); using (var serviceScope = host.Services.CreateScope()) { var services = serviceScope.ServiceProvider; try { var quiltContextFactory = services.GetRequiredService <IQuiltContextFactory>(); var nodeFactory = new CompositeNodeFactory(); nodeFactory.Add(new DatabaseNodeFactory(quiltContextFactory)); nodeFactory.Add(new BuiltInQuiltLayoutNodeFactory()); BlockComponent.Configure(nodeFactory); LayoutComponent.Configure(nodeFactory); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Startup> >(); logger.LogError(ex, "An error occurred."); throw; } } GlobalFontSettings.FontResolver = new ReportFontResolver(); GlobalFontSettings.DefaultFontEncoding = PdfFontEncoding.WinAnsi; host.Run(); }
private void ApplyLayoutBounds(LayoutComponent Layout) { for (int x = Layout.OccFromX; x <= Layout.OccToX; x++) { for (int z = Layout.OccFromZ; z <= Layout.OccToZ; z++) { LevelGrid[x, z] = 0; } } }
public static void ConfigureFactories(IServiceProvider services) { var quiltContextFactory = services.GetRequiredService <IQuiltContextFactory>(); var nodeFactory = new CompositeNodeFactory(); nodeFactory.Add(new DatabaseNodeFactory(quiltContextFactory)); nodeFactory.Add(new BuiltInQuiltLayoutNodeFactory()); BlockComponent.Configure(nodeFactory); LayoutComponent.Configure(nodeFactory); }
public static LayoutComponent CreateLayoutComponent(XDesign_DesignLayout xDesignLayout) { var result = LayoutComponent.Create( xDesignLayout.layoutCategory ?? Constants.DefaultComponentCategory, xDesignLayout.layoutName, CreateFabricStyleList(xDesignLayout.fabricStyles), xDesignLayout.rowCount, xDesignLayout.columnCount, xDesignLayout.blockCount); return(result); }
void MoveButton_Click(object sender, EventArgs e) { string[] SplitID = ((CswImageButton)sender).ID.Split('_'); string Direction = SplitID[0]; Int32 LayoutComponentId = Convert.ToInt32(SplitID[1]); LayoutComponent Component = Components[LayoutComponentId]; Int32 NewDisplayRow = Component.DisplayRow; Int32 NewDisplayColumn = Component.DisplayColumn; switch (Direction) { case "North": NewDisplayRow--; break; case "East": NewDisplayColumn++; break; case "South": NewDisplayRow++; break; case "West": NewDisplayColumn--; break; } // Find existing component in that slot if (NewDisplayRow > 0 && NewDisplayColumn > 0) { LayoutComponent SwapComponent = null; foreach (LayoutComponent OtherComponent in Components.Values) { if (OtherComponent.DisplayRow == NewDisplayRow && OtherComponent.DisplayColumn == NewDisplayColumn) { SwapComponent = OtherComponent; break; } } if (SwapComponent != null) { SwapComponent.DisplayRow = Component.DisplayRow; SwapComponent.DisplayColumn = Component.DisplayColumn; } Component.DisplayRow = NewDisplayRow; Component.DisplayColumn = NewDisplayColumn; if (OnMoveComponent != null) { OnMoveComponent(Component.LayoutComponentId, Component.DisplayRow, Component.DisplayColumn); if (SwapComponent != null) { OnMoveComponent(SwapComponent.LayoutComponentId, SwapComponent.DisplayRow, SwapComponent.DisplayColumn); } } ReinitComponents(); } // if( NewDisplayRow > 0 && NewDisplayColumn > 0 ) } // MoveButton_Click()
protected Design(Design prototype) { if (prototype == null) { throw new ArgumentNullException(nameof(prototype)); } if (prototype.m_layoutComponent != null) { m_layoutComponent = (LayoutComponent)prototype.m_layoutComponent.Clone(); } m_parameters = prototype.m_parameters.Clone(); }
private bool CheckLayoutFit(LayoutComponent Layout, int GridLayer) { for (int x = Layout.FromX; x < Layout.ToX; x++) { for (int z = Layout.FromZ; z < Layout.ToZ; z++) { if (LevelGrid[x, z] != GridLayer) { return(false); } } } return(true); }
public OriComponent() { try { mem = new OriMemory(); settings = new OriSettings(this); mem.AddLogItems(keys); mapDisplay = new LayoutComponent("LiveSplit.OriDE.dll", new OriMapDisplayComponent(mem)); foreach (string key in keys) { currentValues[key] = ""; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static Design CreateEmptyDesign() { var fabricStyles = new FabricStyleList(); var design = new Design() { Width = new Dimension(48, DimensionUnits.Inch), Height = new Dimension(48, DimensionUnits.Inch) }; var component = LayoutComponent.Create("Standard", "Quilt Layout", fabricStyles, 3, 3, 2); design.LayoutComponent = component; return(design); }
private static XDesign_DesignLayout XDesign_DesignLayout(LayoutComponent layoutComponent) { if (layoutComponent == null) { return(null); } var result = new XDesign_DesignLayout() { layoutName = layoutComponent.Name, fabricStyles = XDesign_FabricStyles(layoutComponent.FabricStyles), rowCount = layoutComponent.RowCount, columnCount = layoutComponent.ColumnCount, blockCount = layoutComponent.BlockCount }; return(result); }
public async Task <string> CreateDesignAsync(string userId, string designName) { using var log = BeginFunction(nameof(DesignUserService), nameof(CreateDesignAsync), userId, designName); try { await Assert(SecurityPolicy.IsAuthorized, userId).ConfigureAwait(false); var fabricStyles = new FabricStyleList { new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Red), new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Green), new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Blue) }; var provider = new BuiltInQuiltLayoutComponenProvider(); var entry = provider.GetComponent(LayoutComponent.TypeName, Constants.DefaultComponentCategory, BuiltInQuiltLayoutComponenProvider.ComponentName_Checkerboard); var design = new Design.Core.Design() { Width = new Dimension(48, DimensionUnits.Inch), Height = new Dimension(48, DimensionUnits.Inch) }; var component = LayoutComponent.Create(entry.Category, entry.Name, fabricStyles, 3, 3, entry.BlockCount); design.LayoutComponent = component; var ownerReference = CreateOwnerReference.FromUserId(userId); var ownerId = await DesignMicroService.AllocateOwnerAsync(ownerReference).ConfigureAwait(false); var mDesignSpecification = BusinessDataFactory.Create_MDesign_DesignSpecification(design); var id = await DesignMicroService.CreateDesignAsync(ownerId, designName, mDesignSpecification, GetUtcNow()).ConfigureAwait(false); var result = id.ToString(); log.Result(result); return(result); } catch (Exception ex) { log.Exception(ex); throw; } }
/// <summary> /// Constructor. /// </summary> /// <param name="component">The component to look at</param> public LayoutControl(LayoutComponent component) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); _layoutComponent = component; // rather than binding directly to the component, create a binding source // this is the only way that we can pull data from the component on demand _bindingSource = new BindingSource(); _bindingSource.DataSource = _layoutComponent; //these values are just constants, so we won't databind them, it's unnecessary. _imageBoxRows.Minimum = 1; _imageBoxColumns.Minimum = 1; _tileRows.Minimum = 1; _tileColumns.Minimum = 1; _imageBoxRows.Maximum = _layoutComponent.MaximumImageBoxRows; _imageBoxColumns.Maximum = _layoutComponent.MaximumImageBoxColumns; _tileRows.Maximum = _layoutComponent.MaximumTileRows; _tileColumns.Maximum = _layoutComponent.MaximumTileColumns; // bind control values _tileColumns.DataBindings.Add("Value", _bindingSource, "TileColumns", true, DataSourceUpdateMode.OnPropertyChanged); _tileRows.DataBindings.Add("Value", _bindingSource, "TileRows", true, DataSourceUpdateMode.OnPropertyChanged); _imageBoxColumns.DataBindings.Add("Value", _bindingSource, "ImageBoxColumns", true, DataSourceUpdateMode.OnPropertyChanged); _imageBoxRows.DataBindings.Add("Value", _bindingSource, "ImageBoxRows", true, DataSourceUpdateMode.OnPropertyChanged); // bind control enablement _imageBoxColumns.DataBindings.Add("Enabled", _bindingSource, "ImageBoxSectionEnabled", true, DataSourceUpdateMode.OnPropertyChanged); _imageBoxRows.DataBindings.Add("Enabled", _bindingSource, "ImageBoxSectionEnabled", true, DataSourceUpdateMode.OnPropertyChanged); _applyImageBoxes.DataBindings.Add("Enabled", _bindingSource, "ImageBoxSectionEnabled", true, DataSourceUpdateMode.OnPropertyChanged); _tileColumns.DataBindings.Add("Enabled", _bindingSource, "TileSectionEnabled", true, DataSourceUpdateMode.OnPropertyChanged); _tileRows.DataBindings.Add("Enabled", _bindingSource, "TileSectionEnabled", true, DataSourceUpdateMode.OnPropertyChanged); _applyTiles.DataBindings.Add("Enabled", _bindingSource, "TileSectionEnabled", true, DataSourceUpdateMode.OnPropertyChanged); }
private LayoutComponent DuplicateLayout(LayoutComponent Layout) { var Duplicate = Instantiate(Layout.gameObject, Vector3.zero, Quaternion.identity); Duplicate.transform.localScale = Vector3.one; var Comp = Duplicate.GetComponent <LayoutComponent>(); for (int i = 0; i < SizeX; i++) { for (int j = 0; j < SizeZ; j++) { if (CanPlaceDuplicate(i, j, Mathf.RoundToInt(Comp.RequiredSpace.x), Mathf.RoundToInt(Comp.RequiredSpace.y))) { Duplicate.transform.position = new Vector3(i, 0f, j); return(Comp); } } } return(Comp); }
public static XDesign_Layout XDesign_Layout(LayoutComponent layoutComponent, int size) { if (layoutComponent == null) { return(null); } var id = layoutComponent.Name.Replace(" ", "").Replace("/", ""); var result = new XDesign_Layout() { id = id, layoutCategory = layoutComponent.Category, layoutName = layoutComponent.Name, fabricStyles = XDesign_FabricStyles(layoutComponent.FabricStyles), rowCount = layoutComponent.RowCount, columnCount = layoutComponent.ColumnCount, blockCount = layoutComponent.BlockCount, preview = XDesign_LayoutPreview(layoutComponent, size) }; return(result); }
public async Task <XDesign_Layout[]> GetLayoutsAsync(int rowCount, int columnCount, int size) { using var log = BeginFunction(nameof(DesignAjaxService), nameof(GetLayoutsAsync)); try { await Task.CompletedTask.ConfigureAwait(false); var layoutList = new List <XDesign_Layout>(); var provider = new BuiltInQuiltLayoutComponenProvider(); foreach (var entry in provider.GetComponents(LayoutComponent.TypeName, Constants.DefaultComponentCategory)) { var fabricStyles = new FabricStyleList { new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Red), new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Green), new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Blue) }; var component = LayoutComponent.Create(entry.Category, entry.Name, fabricStyles, rowCount, columnCount, entry.BlockCount); var data = Create.XDesign_Layout(component, size); layoutList.Add(data); } var result = layoutList.ToArray(); log.Result(result); return(result); } catch (Exception ex) { log.Exception(ex); throw; } }
/// <summary> /// Sets the layout of the current imageviewer to the specified number of imageboxes. /// </summary> /// <param name="rows">The number of rows to show.</param> /// <param name="columns">The number of columns to show.</param> public void SetImageBoxLayout(int rows, int columns) { LayoutComponent.SetImageBoxLayout(Context.Viewer, rows, columns); }
static async Task Main(string[] args) { var hostBuilder = Host.CreateDefaultBuilder(args); _ = hostBuilder.ConfigureWebJobs((context, builder) => { // Hack required until the WebJobs team gets its act together. // var configProviders = (context.Configuration as ConfigurationRoot).Providers as List <IConfigurationProvider>; if (configProviders.Count(c => c.GetType() == typeof(JsonConfigurationProvider) && (c as JsonConfigurationProvider).Source.Path == "appsettings.json") > 1) { _ = configProviders.Remove(configProviders.Last(c => c.GetType() == typeof(JsonConfigurationProvider) && (c as JsonConfigurationProvider).Source.Path == "appsettings.json")); } if (configProviders.Count(c => c.GetType() == typeof(EnvironmentVariablesConfigurationProvider)) > 1) { _ = configProviders.Remove(configProviders.Last(c => c.GetType() == typeof(EnvironmentVariablesConfigurationProvider))); } _ = builder.AddTimers(); _ = builder.AddAzureStorageCoreServices(); _ = builder.AddAzureStorage(); }); _ = hostBuilder.ConfigureLogging(logging => { // Add logging support to Azure BLOB's and the servers file system. // This logging is only active when App Service Logs are enabled through the Azure portal. // _ = logging.AddAzureWebAppDiagnostics(); // Enable logging data to be transmitted to Application Insights. // //_ = logging.AddApplicationInsights(); }); _ = hostBuilder.ConfigureServices(services => { // Configure the logging associated with AddAzureWebAppDiagnostics above. // _ = services.Configure <AzureFileLoggerOptions>(options => { }); _ = services.Configure <AzureBlobLoggerOptions>(options => { }); }); _ = hostBuilder.ConfigureServices((context, services) => { // Register application configuration. // _ = services .Configure <ApplicationOptions>(context.Configuration.GetSection(ConfigurationSectionNames.Application)) .Configure <DatabaseOptions>(context.Configuration.GetSection(ConfigurationSectionNames.Application)) .AddSingleton <IConfigureOptions <ApplicationOptions>, ApplicationOptionsConfig>() .AddSingleton <IConfigureOptions <DatabaseOptions>, DatabaseOptionsConfig>(); _ = services .AddCoreServices(options => options.UseStaticUserId(BuiltInUsers.AdminUser)) .AddDatabaseServices() .AddMicroServices(options => options.ExcludeUserManagement()) .AddMicroEventServices(); //_ = services.AddApplicationInsightsTelemetryWorkerService(); }); var host = hostBuilder.Build(); using (var serviceScope = host.Services.CreateScope()) { var services = serviceScope.ServiceProvider; try { var quiltContextFactory = services.GetRequiredService <IQuiltContextFactory>(); var nodeFactory = new CompositeNodeFactory(); nodeFactory.Add(new DatabaseNodeFactory(quiltContextFactory)); nodeFactory.Add(new BuiltInQuiltLayoutNodeFactory()); BlockComponent.Configure(nodeFactory); LayoutComponent.Configure(nodeFactory); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred."); throw; } } using (host) { await host.RunAsync(); } }
public void SetComponent(IApplicationComponent component) { _component = (LayoutComponent)component; }