public ReportPdf(Stream Output, Layout Layout, Template Template, Dictionary<string, string> ConfigParams) : base(Output, Layout, Template, ConfigParams) { Rectangle pageSize = new Rectangle(mm2pt(Template.PageSize.Width), mm2pt(Template.PageSize.Height)); // Initialization m_Document = new Document(pageSize, mm2pt(Template.Margin.Left), mm2pt(Template.Margin.Right), mm2pt(Template.Margin.Top), mm2pt(Template.Margin.Bottom)); m_Writer = PdfWriter.GetInstance(m_Document, Output); m_Document.AddCreationDate(); m_Document.AddCreator("StrengthReport http://dev.progterv.info/strengthreport) and KeePass (http://keepass.info)"); m_Document.AddKeywords("report"); m_Document.AddTitle(Layout.Title+" (report)"); // Header HeaderFooter header = new HeaderFooter(new Phrase(Layout.Title+", "+DateTime.Now.ToString(), m_Template.ReportFooter.getFont()), false); header.Alignment = Template.ReportFooter.getAlignment(); m_Document.Header = header; // Footer HeaderFooter footer = new HeaderFooter(new Phrase(new Chunk("Page ", m_Template.ReportFooter.getFont())), new Phrase(new Chunk(".", m_Template.ReportFooter.getFont()))); footer.Alignment = Template.ReportFooter.getAlignment(); m_Document.Footer = footer; // TODO: Metadata // Open document m_Document.Open(); // Report Heading { PdfPTable reportTitle = new PdfPTable(1); PdfPCell titleCell = new PdfPCell(new Phrase(Layout.Title, m_Template.ReportHeader.getFont())); titleCell.Border = 0; titleCell.FixedHeight = mm2pt(m_Template.ReportHeader.Height); titleCell.VerticalAlignment = Element.ALIGN_MIDDLE; titleCell.HorizontalAlignment = m_Template.ReportHeader.getAlignment(); reportTitle.AddCell(titleCell); reportTitle.WidthPercentage = 100; m_Document.Add(reportTitle); } // Create main table m_Table = new PdfPTable(Layout.GetColumnWidths()); m_Table.WidthPercentage = 100; m_Table.HeaderRows = 1; foreach (LayoutElement element in Layout) { PdfPCell cell = new PdfPCell(new Phrase(element.Title, m_Template.Header.getFont())); cell.BackgroundColor = m_Template.Header.Background.ToColor(); cell.MinimumHeight = mm2pt(m_Template.Header.Height); cell.VerticalAlignment = Element.ALIGN_MIDDLE; m_Table.AddCell(cell); } m_colorRow = new CMYKColor[] { m_Template.Row.BackgroundA.ToColor(), m_Template.Row.BackgroundB.ToColor() }; }
public void AddRude(Layout l, Station s) { base.Add(s); this.m_htDBID2Station[s.ID] = s; this.m_htName2Station[s.ID] = s; s.InitAfterLoad(l); }
protected void btn_Click(object sender, EventArgs e) { try { // Para finalizar o Reg<T> trata um unico registro // a Classe 'Layout' é capaz de identificar e gerar multiplos tipos de registros // este exemplo é otimo para comparar linhas geradas e assim fazer um DEBUG Layout l; if (rblTipo.SelectedIndex == 0) // remessa //l = new Layout(typeof(CNAB400Header1Bradesco), typeof(CNAB400Remessa1Bradesco), typeof(CNAB400ArquivoTrailer)); l = new Layout(typeof(CNAB240HeaderLoteCaixa), typeof(CNAB240SegmentoPCaixa), typeof(CNAB240SegmentoQCaixa)); else // retorno // l = new Layout(typeof(CNAB400Header1Bradesco), typeof(CNAB400Retorno1Bradesco), typeof(CNAB400ArquivoTrailer)); l = new Layout(typeof(CNAB400SantanderHeader), typeof(CNAB400SantanderRemessa1), typeof(CNAB400SantanderTrailer)); l.Conteudo = txt.Text; lbl.Text = "Processo OK"; dtg1.DataSource = l.Table(l.GetLayoutType(0)); dtg1.DataBind(); dtg2.DataSource = l.Table(l.GetLayoutType(1)); dtg2.DataBind(); dtg3.DataSource = l.Table(l.GetLayoutType(2)); dtg3.DataBind(); lbl.Text = "Grids OK"; } catch (Exception ex) { lbl.Text = ex.Message + "<pre>" + ex.StackTrace + "</pre>"; } }
public DelimitedFileTests() { layout = new Layout<TestObject>.DelimitedLayout() .WithDelimiter(";") .WithQuote("\"") .HeaderLines(2) .WithMember(o => o.Id, set => set.WithLength(5).WithLeftPadding('0')) .WithMember(o => o.Description, set => set.WithLength(25).WithRightPadding(' ')) .WithMember(o => o.NullableInt, set => set.WithLength(5).AllowNull("=Null").WithLeftPadding('0')) .WithMember(o => o.NullableEnum, set => set.WithLength(10).AllowNull("").WithLeftPadding(' ')) .WithMember(o => o.Date, set => set.WithFormat(new CultureInfo("pt-PT"))); DateTime now = DateTime.UtcNow; objects = new List<TestObject>(); for (int i = 1; i <= 10; i++) { objects.Add(new TestObject { Id = i, Description = "Description " + i, NullableInt = i % 5 == 0 ? null : (int?)3, NullableEnum = i % 3 == 0 ? null : (Gender?)(i % 3), Date = now.AddDays(i) }); } }
public void LayoutConstructorTest() { string layout_file = string.Empty; // TODO: Initialize to an appropriate value DirectoryInfo project_dir = null; // TODO: Initialize to an appropriate value Layout target = new Layout(layout_file, project_dir); Assert.Inconclusive("TODO: Implement code to verify target"); }
public void Awake() { spriteBranco = hexPrefab.GetComponent<SpriteRenderer>().sprite; spritePreto = hexPreto.GetComponent<SpriteRenderer>().sprite; m_layout = new Layout(m_layout.orientation, new Vector2(hexPrefab.GetComponent<SpriteRenderer>().bounds.size.x / 2, hexPrefab.GetComponent<SpriteRenderer>().bounds.size.x / 2), m_layout.origin); }
public void RocketCommanderGame_Mouse_Test() { var game = new TestGame(); Layout layout = null; game.Initialized += (o, e) => { layout = new Layout("MouseState", game.Framework.AssetManager) { DestRect = new Rectangle(0.0f, 0.1f, 1.0f, 1.0f) }; var mouseBlock = new TextBlock(layout, game.Framework.AssetManager) { Font = game.Framework.AssetManager.DefaultFont, Foreground = Color.Red, Name = "MouseBlock" }; game.AddLayout(layout); }; game.Mouse.MouseMove += (o, e) => { var mouseBlock = layout.GetElement("MouseBlock") as TextBlock; mouseBlock.Text = game.Mouse.Position.ToString(); }; game.Run(); }
public void SetLayout(Rectangle windowSize, Layout layout) { int h = Position.Height / _elements.Count; int c = 0; Rectangle pos = new Rectangle(); if (layout == Layout.LeftAlign) { pos = Position; foreach (TextSprite ts in _elements) { pos.Y += c * h; ts.setRelatvePos(pos, windowSize.Width, windowSize.Height); c++; } } else if (layout == Layout.MiddleAlign) { pos = Position; foreach (TextSprite ts in _elements) { pos.Y += c * h; pos.Width = (int)(((float)h / ts.GetOriginalTextSize().Y) * ts.GetOriginalTextSize().X); pos.X = Position.X + Position.Width / 2 - pos.Width / 2; if (pos.X < Position.X) { pos.X = Position.X; pos.Width = Position.Width; } ts.setRelatvePos(pos, windowSize.Width, windowSize.Height); c++; } } }
public void Render(Layout layout, ProviderFactory loader) { int resolution = GetValue<int>("resolution"); var size = layout.GetPageSizeInPixels(resolution); var composed = new Image(size.ToDimensions(), ImageBaseType.Rgb); if (layout.Render(loader, new ImageRenderer(layout, composed, resolution))) ; // Fix me: check next couple of lines! #if false DialogState = DialogStateType.SrcImgValid; else DialogState = DialogStateType.SrcImgInvalid; #endif if (GetValue<bool>("flatten")) { composed.Flatten(); } if (GetValue<int>("color_mode") == 0) // ColorMode.GRAY) { composed.ConvertGrayscale(); } new Display(composed); Display.DisplaysFlush(); }
/// <summary> /// Creates a new ReportAbstract, it used in children as base() when contructing. /// </summary> /// <param name="Filename">The output file's path</param> /// <param name="layout">The layout (list of columns) of the report.</param> /// <param name="ConfigParams">Misc configuration parameters vary for each ReportFormat</param> public ReportAbstract(Stream output, Layout layout, Template template, Dictionary<string, string> configParams) { m_Output = output; m_Layout = layout; m_Template = template; m_ConfigParams = configParams; }
protected float GetWidth(Layout option, Rect rect) { if (option != null && option.width.HasValue) return option.width.Value; return width.HasValue ? width.Value : rect.width; }
public bool CustomFoldout(string label, bool value, string expandSymbol, string foldSymbol, GUIStyle style, Layout option) { Label((value ? foldSymbol : expandSymbol) + label, GUIHelper.FoldoutStyle, option); if (GUI.Button(LastRect, GUIContent.none, GUIStyle.none)) value = !value; return value; }
private void Add(DxfDocument dxf, Core2D.Project.XDocument document) { foreach (var page in document.Pages) { var layout = new Layout(page.Name) { PlotSettings = new PlotSettings() { PaperSizeName = $"{page.Template.Name}_({page.Template.Width}_x_{page.Template.Height}_MM)", LeftMargin = 0.0, BottomMargin = 0.0, RightMargin = 0.0, TopMargin = 0.0, PaperSize = new Vector2(page.Template.Width, page.Template.Height), Origin = new Vector2(0.0, 0.0), PaperUnits = PlotPaperUnits.Milimeters, PaperRotation = PlotRotation.NoRotation } }; dxf.Layouts.Add(layout); dxf.ActiveLayout = layout.Name; Add(dxf, page); } }
protected void btnTest_Click(object sender, EventArgs e) { Layout lay = new Layout(typeof(NFeV2detalhe)); lay.Conteudo = txtIn.Text; gv.DataSource = lay.Table(typeof(NFeV2detalhe)); gv.DataBind(); }
public LayoutSelectionGlyph(Layout layout) { if (layout == null) throw new ArgumentNullException("layout"); _layout = layout; }
public override void Enter() { this.layout = this.framework.AssetManager.Load(@"RocketCommander\GUI\Help.layout") as Layout; this.game.AddLayout(this.layout); GetButton("BackButton").MouseLeftButtonDown += backButton_MouseLeftButtonDown; }
public virtual void Setup(WindowComponent component, Layout.Component activatorInstance) { this.activatorInstance = activatorInstance; this.component = component; if (this.component != null) this.component.Setup(this); }
private void OpenDiv(Layout layout, bool writeHorizontalAlign, bool writeWrapping) { WriteBeginTag("div"); if (writeHorizontalAlign) { String alignment; switch (layout.Align) { case HorizontalAlign.Right: alignment = "text-align:right"; break; case HorizontalAlign.Center: alignment = "text-align:center"; break; default: alignment = "text-align:left"; break; } WriteAttribute("style", alignment); } if (writeWrapping) { WriteAttribute("mode", layout.Wrap == true ? "wrap" : "nowrap"); } Write('>'); _currentWrittenLayout = layout; }
public CommentLayoutGlyph(Layout layout) { if (layout == null) throw new ArgumentNullException("layout"); _layout = layout; }
public override UnityObject Object(GUIContent content, UnityObject value, System.Type type, bool allowSceneObjects, Layout option) { // If we pass an empty content, ObjectField will still reserve space for an empty label ~__~ return string.IsNullOrEmpty(content.text) ? EditorGUILayout.ObjectField(value, type, allowSceneObjects, option) : EditorGUILayout.ObjectField(content, value, type, allowSceneObjects, option); }
public void OnLayoutDeleted(Layout layout) { if (LayoutDeleted != null) { LayoutDeleted(new SingleItemEventArgs<Layout>(layout)); } }
public LayoutEditor(Layout layout) { InitializeComponent(); m_LayoutName = layout.Name; foreach (LayoutElement element in layout) layoutBindingSource.Add(element); }
/// <summary> /// Radio List constructor. /// </summary> /// <param name="name">Radio list name</param> public RadioList(string name) { this.name = name; layout = Forms.Layout.Vertical; items = new List<RadioListItem>(); itemKeys = new Dictionary<string, RadioListItem>(); }
public RenderSpecs(Layout layout, double dheight, double dwidth) : this(layout) { _desiredHeight = dheight; _desiredWidth = dwidth; _widthUnits = units.pts; _heightUnits = units.pts; }
public ReportConfig(Stream output, string format, Layout layout, Template template, List<PwGroup> groups, Dictionary<string, string> configParams) { m_Output = output; m_Format = format; m_Layout = layout; m_Template = template; m_Groups = groups; m_ConfigParams = configParams; }
public bool AddLayout(Layout layout) { if (this.layouts.Contains(layout)) return false; layout.Size = new Size(Width, Height); layout.GetVisualTree().ForEach(element => this.sceneManager.AddSprite(element)); this.layouts.Add(layout); return true; }
public ADBannerView(Type type, Layout layout) { if (_AlwaysFalseDummy) { FireBannerWasClicked(); FireBannerWasLoaded(); FireBannerFailedToLoad(); } this._bannerView = Native_CreateBanner((int) type, (int) layout); }
// TODO:Template in Screen public ReportScreen(Layout Layout, Dictionary<string, string> ConfigParams) : base(null, Layout, null, ConfigParams) { m_Layout = Layout; m_DataTable = new DataTable(); foreach (LayoutElement e in m_Layout) { DataColumn column = new DataColumn(e.Title, typeof(string)); m_DataTable.Columns.Add(column); } }
public override void Enter() { this.layout = this.framework.AssetManager.Load(@"RocketCommander\GUI\MainMenu.layout") as Layout; this.game.AddLayout(this.layout); GetButton("MissionsButton").MouseLeftButtonDown += missionsButton_MouseLeftButtonDown; GetButton("HelpButton").MouseLeftButtonDown += helpButton_MouseLeftButtonDown; GetButton("ExitButton").MouseLeftButtonDown += exitButton_MouseLeftButtonDown; game.EnableRoamingRocketScene(); }
void Start () { nodes = new List<GameObject> (); Parser parser = new Parser ("F:\\cse165\\p2\\project\\Assets\\Scripts\\dolphinNetwork.gml"); graph = parser.parse(); if (graph == null) return; layout = new Layout (graph); layout.init (); cubeInit (); }
/// <summary> /// This is where we hook into NLog, by overriding the Write method. /// </summary> /// <param name="logEvent">The NLog.LogEventInfo </param> protected override void Write(LogEventInfo logEvent) { // Store the current UI culture CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; // Set the current Locale to "en-US" for proper date formatting Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); byte[] msg = buildSyslogMessage(Facility, getSyslogSeverity(logEvent.Level), DateTime.Now, Sender, Layout.Render(logEvent)); sendMessage(SyslogServer, Port, msg); // Restore the original culture Thread.CurrentThread.CurrentCulture = currentCulture; }
public abstract void Label(GUIContent content, GUIStyle style, Layout option);
private static extern int PptrsInternal(Layout layout, UpLo uplo, int n, int nrhs, Double[] ap, Double[] b, int ldb);
public void Write() { var stringBuilder = new StringBuilder(); LokiTarget.LokiHttpClientFactory = _ => new NullLokiHttpClient(stringBuilder); var configuration = new LoggingConfiguration(); var lokiTarget = new LokiTarget { Endpoint = "http://grafana.lvh.me:3100", IncludeMdlc = true, Labels = { new LokiTargetLabel { Name = "env", Layout = Layout.FromString("${basedir}") }, new LokiTargetLabel { Name = "server", Layout = Layout.FromString("${machinename:lowercase=true}") }, new LokiTargetLabel { Name = "level", Layout = Layout.FromString("${level:lowercase=true}") } } }; var target = new BufferingTargetWrapper(lokiTarget) { BufferSize = 500 }; configuration.AddTarget("loki", target); var rule = new LoggingRule("*", LogLevel.Debug, target); configuration.LoggingRules.Add(rule); LogManager.Configuration = configuration; var log = LogManager.GetLogger(typeof(LokiTargetTests).FullName); for (var n = 0; n < 100; ++n) { using (MappedDiagnosticsLogicalContext.SetScoped("env", "dev")) { log.Fatal("Hello world"); } using (MappedDiagnosticsLogicalContext.SetScoped("server", Environment.MachineName)) { log.Info($"hello again {n}"); log.Info($"hello again {n * 2}"); log.Warn($"hello again {n * 3}"); } using (MappedDiagnosticsLogicalContext.SetScoped("cfg", "v1")) log.Error($"hello again {n * 4}"); try { throw new InvalidOperationException(); } catch (Exception e) { log.Error(e); } } LogManager.Shutdown(); Console.WriteLine(stringBuilder.ToString()); }
public static extern void Gemm(Layout layout, Transpose transA, Transpose transB, int m, int n, int k, Float alpha, Float[] a, int lda, Float[] b, int ldb, Float beta, Float[] c, int ldc);
public string[] BuildLogEntries(LogEventInfo logEvent, Layout layout) { var originalLogEntry = layout.Render(logEvent); return(splitOnNewLinePolicy.IsApplicable() ? splitOnNewLinePolicy.Apply(originalLogEntry) : new[] { originalLogEntry }); }
public override void OnGUI() { if (!(foldout = gui.Foldout(dictionaryName, foldout, Layout.sExpandWidth()))) { return; } if (memberValue == null) { #if DBG Log("Dictionary null " + dictionaryName); #endif memberValue = new Dictionary <TKey, TValue>(); } shouldRead |= (kvpList == null || memberValue.Count != kvpList.Count); if (shouldRead) { #if DBG Log("Reading " + dictionaryName); #endif kvpList = memberValue.ToKVPList(); shouldRead = false; } if (!Readonly) { #if PROFILE Profiler.BeginSample("DictionaryDrawer Header"); #endif using (gui.Indent()) { var pStr = FormatPair(addInfo.key, addInfo.value); var addKey = id + "add"; using (gui.Horizontal()) { foldouts[addKey] = gui.Foldout("Add pair:", foldouts[addKey], Layout.sWidth(65f)); gui.TextLabel(pStr); using (gui.State(kvpList.Count > 0)) { if (gui.ClearButton("entries")) { kvpList.Clear(); shouldWrite = true; } if (gui.RemoveButton("Last dictionary pair")) { kvpList.RemoveLast(); shouldWrite = true; } } if (gui.AddButton("pair", MiniButtonStyle.ModRight)) { AddPair(addInfo.key, addInfo.value); shouldWrite = true; } } if (foldouts[addKey]) { #if PROFILE Profiler.BeginSample("DictionaryDrawer AddingPair"); #endif using (gui.Indent()) { gui.Member(addKeyInfo, attributes, ignoreAddArea || !perKeyDrawing); gui.Member(addValueInfo, attributes, ignoreAddArea || !perValueDrawing); } #if PROFILE Profiler.EndSample(); #endif } } #if PROFILE Profiler.EndSample(); #endif } if (kvpList.Count == 0) { gui.HelpBox("Dictionary is empty"); } else { #if PROFILE Profiler.BeginSample("DictionaryDrawer Pairs"); #endif using (gui.Indent()) { for (int i = 0; i < kvpList.Count; i++) { var dKey = kvpList.Keys[i]; var dValue = kvpList.Values[i]; TValue val; if (memberValue.TryGetValue(dKey, out val)) { shouldRead |= !dValue.GenericEqual(val); } #if PROFILE Profiler.BeginSample("DictionaryDrawer KVP assignments"); #endif var pairStr = FormatPair(dKey, dValue); var entryKey = id + i + "entry"; foldouts[entryKey] = gui.Foldout(pairStr, foldouts[entryKey], Layout.sExpandWidth()); #if PROFILE Profiler.EndSample(); #endif if (!foldouts[entryKey]) { continue; } #if PROFILE Profiler.BeginSample("DictionaryDrawer SinglePair"); #endif using (gui.Indent()) { var keyMember = GetElement(keyElements, kvpList.Keys, i, entryKey + "key"); shouldWrite |= gui.Member(keyMember, !perKeyDrawing); var valueMember = GetElement(valueElements, kvpList.Values, i, entryKey + "value"); shouldWrite |= gui.Member(valueMember, !perValueDrawing); } #if PROFILE Profiler.EndSample(); #endif } } #if PROFILE Profiler.EndSample(); #endif shouldWrite |= memberValue.Count > kvpList.Count; } if (shouldWrite) { #if DBG Log("Writing " + dictionaryName); #endif memberValue = kvpList.ToDictionary(); shouldWrite = false; } }
public bool TaskHandler(StoryTask task) { bool done = false; switch (task.Instruction) { case "makeinterface2d": // Create a controller Controller = new Controller(); // Create a layout (can hold multiple planes and interfaces) MainLayout = new Layout(); // Create an interface MainInterface = new InterFace(UserCanvas.gameObject, "demo"); // Create a mapping and add it to the interface MainMapping = new Mapping(); MainMapping.ux_single_2d += Methods.Drag2D; MainMapping.ux_tap_2d += Methods.tapButton2D; MainInterface.AddMapping(MainMapping); // Create a free moving button and add it to the interface Button button; button = new Button("Freemoving"); button.AddCallback("freemovingcallback"); MainInterface.addButton(button); // Create a free moving button and add it to the interface button = new Button("Locked"); button.AddCallback("lockedcallback"); button.AddConstraint(Constraint.LockInPlace(button)); MainInterface.addButton(button); // Create a constrained button and add it to the interface. Coordinates are local. Constraint slideConstraint = new Constraint() { hardClamp = true, hardClampMin = new Vector2(-250f, 350f), hardClampMax = new Vector2(250f, 350f), edgeSprings = true, edgeSpringMin = new Vector2(-200f, 350f), edgeSpringMax = new Vector2(200f, 350f) }; button = new Button("Slide"); button.AddConstraint(slideConstraint); MainInterface.addButton(button); // Create a button with spring positions and add it to the interface. Constraint springConstraint = new Constraint() { hardClamp = true, hardClampMin = new Vector2(-250f, 250f), hardClampMax = new Vector2(250f, 250f), springs = true, springPositions = new Vector2[] { new Vector2(-200f, 250f), new Vector2(-100f, 250f), new Vector2(0f, 250f), new Vector2(100f, 250f), new Vector2(200f, 250f) } }; button = new Button("Springs"); button.AddConstraint(springConstraint); MainInterface.addButton(button); // Create two buttons with the same drag target, so they work as a group. button = new Button("Option1", GameObject.Find("MenuFree")); MainInterface.addButton(button); button = new Button("Option2", GameObject.Find("MenuFree")); MainInterface.addButton(button); // Create a button with orthogonal dragging (so either horizontal or vertical) and add it to the interface. Constraint verticalConstraint = new Constraint() { hardClamp = true, hardClampMin = new Vector2(0f, -200f), hardClampMax = new Vector2(0f, 200f) }; Constraint horizontalConstraint = new Constraint() { hardClamp = true, hardClampMin = new Vector2(-200f, -350f), hardClampMax = new Vector2(200f, -350f) }; button = new Button("Ortho"); button.AddOrthoConstraints(GameObject.Find("Layer"), horizontalConstraint, GameObject.Find("Sublayer"), verticalConstraint); //button.AddConstraint(circleConstraint); MainInterface.addButton(button); // Create a button with circular constraint and add it to the interface. // Works from 0,0 local position Constraint circleConstraint = new Constraint() { radiusClamp = true, radiusClampMin = 100f, radiusClampMax = 100f }; button = new Button("Circle"); button.AddConstraint(circleConstraint); MainInterface.addButton(button); // Create a free moving button and add it to the interface button = new Button("Exit"); button.AddConstraint(Constraint.LockInPlace(button)); button.AddCallback("startmenu"); MainInterface.addButton(button); // Just using single plane for demo, add the interface to it MainLayout.AddInterface(MainInterface); done = true; break; case "makeinterfaceplanes": // Create a controller Controller = new Controller(); // Create a layout (can hold multiple planes and interfaces) MainLayout = new Layout(); // Create a plane Plane UpperPlane = new Plane(GameObject.Find("UpperPlane")); Plane LowerPlane = new Plane(GameObject.Find("LowerPlane")); // Create an interface UpperInterface = new InterFace(UserCanvas.gameObject, "upper"); LowerInterface = new InterFace(UserCanvas.gameObject, "lower"); // Create a mapping and add it to the interface MainMapping = new Mapping(); MainMapping.ux_single_2d += Methods.Drag2D; MainMapping.ux_tap_2d += Methods.tapButton2D; // Add together. UpperInterface.AddMapping(MainMapping); UpperPlane.AddInterface(UpperInterface); LowerInterface.AddMapping(MainMapping); LowerPlane.AddInterface(LowerInterface); // Create buttons button = new Button("Button01"); UpperInterface.addButton(button); button = new Button("Button02"); LowerInterface.addButton(button); // Create an exit button and add it to the interface button = new Button("Exit"); button.AddConstraint(Constraint.LockInPlace(button)); button.AddCallback("startmenu"); UpperInterface.addButton(button); // Add to layout. MainLayout.AddPlane(UpperPlane); MainLayout.AddPlane(LowerPlane); done = true; break; case "makeinterfaceplanes3d": // Create a controller Controller = new Controller(); // Create a layout (can hold multiple planes and interfaces) MainLayout = new Layout(); // Create a plane Plane UpperPlane3d = new Plane(GameObject.Find("UpperPlane")); Plane LowerPlane3d = new Plane(GameObject.Find("LowerPlane")); // Create an interface UpperInterface = new InterFace(UserCanvas.gameObject, "upper"); LowerInterface = new InterFace(UserCanvas.gameObject, "lower"); // Create a mapping and add it to the interface MainMapping = new Mapping(); MainMapping.ux_single_none += Methods.OrbitCamera; MainMapping.ux_double_none += Methods.LateralCamera; MainMapping.ux_double_none += Methods.LongitudinalCamera; MainMapping.ux_single_2d += Methods.Drag2D; MainMapping.ux_tap_2d += Methods.tapButton2D; // Create an orbit cam with a pitch constraint. Constraint orbitConstraint = new Constraint() { pitchClamp = true, pitchClampMin = 15f, pitchClampMax = 85f }; UiCam3D uppercam = new UiCam3D(GameObject.Find("CameraUpper")); uppercam.AddContraint(orbitConstraint); UiCam3D lowercam = new UiCam3D(GameObject.Find("CameraLower")); lowercam.AddContraint(orbitConstraint); // Create an exit button and add it to the interface button = new Button("Exit"); button.AddConstraint(Constraint.LockInPlace(button)); button.AddCallback("startmenu"); UpperInterface.addButton(button); // Add together. UpperInterface.AddUiCam3D(uppercam); LowerInterface.AddUiCam3D(lowercam); UpperInterface.AddMapping(MainMapping); LowerInterface.AddMapping(MainMapping); UpperPlane3d.AddInterface(UpperInterface); LowerPlane3d.AddInterface(LowerInterface); // Add to layout MainLayout.AddPlane(UpperPlane3d); MainLayout.AddPlane(LowerPlane3d); done = true; break; case "interface": // Update the interface(s) and get result. UserCallBack result = Controller.updateUi(MainLayout); if (result.trigger) { Log("User tapped " + result.sender + ", starting storyline " + result.label); Director.Instance.NewStoryLine(result.label); } break; case "startallsamples": SceneManager.LoadScene("AllSamples", LoadSceneMode.Single); done = true; break; default: done = true; break; } return(done); }
public void SetElementSize(Size size) { Layout.LayoutChildIntoBoundingRegion(Element, new Rectangle(Element.X, Element.Y, size.Width, size.Height)); }
public void VerifyForeignKeysExist_IsChampionSampleIDExistLayoutExistWithException_ReturnString() { // Arrange var blastId = 1; var blastGroupId = 1; var blastEngine = new ECNBlastEngine(); var exceptionMsg = "UDF(s): "; ShimBlast.GetByBlastID_NoAccessCheckInt32Boolean = (id, child) => { var blast = new BlastRegular(); blast.BlastID = blastId; blast.GroupID = blastGroupId; blast.BlastType = BlastType.Champion.ToString(); blast.LayoutID = 1; blast.SampleID = 1; return(blast); }; ShimGroup.GetByGroupID_NoAccessCheckInt32 = (id) => { var group = new Group(); return(group); }; ShimDataFunctions.GetDataTableSqlCommand = (cmd) => { var table = new DataTable(); table.Columns.Add("LayoutID", typeof(string)); var row = table.NewRow(); row[0] = "1"; table.Rows.Add(row); var row2 = table.NewRow(); row2[0] = "1"; table.Rows.Add(row2); return(table); }; ShimLayout.GetByLayoutID_NoAccessCheckInt32Boolean = (id, child) => { var layout = new Layout(); layout.ContentSlot1 = 0; layout.TemplateID = 1; return(layout); }; ShimECNBlastEngine.AllInstances.ContentExistsInt32 = (eng, id) => { return("ContentExist"); }; ShimTemplate.GetByTemplateID_NoAccessCheckInt32 = (id) => { var template = new Template { TemplateSource = "TemplateSource", TemplateText = "TemplateText" }; return(template); }; ShimGroup.ValidateDynamicStringsForTemplateListOfStringInt32User = (list, groupId, user) => { throw new ECNException(new List <ECNError>() { new ECNError { ErrorMessage = "Exception from Template subject line. error text", } }); }; // Act var actualResult = typeof(ECNBlastEngine).CallMethod(METHOD_VerifyForeignKey, new object[] { blastId }, blastEngine).ToString(); // Assert StringAssert.Contains(actualResult, exceptionMsg); }
public void VerifyForeignKeysExist_IsChampionBlastIsNull_ReturnString() { // Arrange var blastId = 1; var blastGroupId = 1; var blastEngine = new ECNBlastEngine(); var exceptionMsg = "Blast ID:"; var firsTimeCall = true; ShimBlast.GetByBlastID_NoAccessCheckInt32Boolean = (id, child) => { if (firsTimeCall) { var blast = new BlastRegular(); blast.BlastID = blastId; blast.GroupID = blastGroupId; blast.BlastType = BlastType.Champion.ToString(); blast.LayoutID = 1; firsTimeCall = false; return(blast); } else { return(null); } }; ShimGroup.GetByGroupID_NoAccessCheckInt32 = (id) => { var group = new Group(); return(group); }; ShimDataFunctions.GetDataTableSqlCommand = (cmd) => { return(new DataTable()); }; ShimLayout.GetByLayoutID_NoAccessCheckInt32Boolean = (id, child) => { var layout = new Layout(); layout.ContentSlot1 = 0; layout.TemplateID = 1; return(layout); }; ShimECNBlastEngine.AllInstances.ContentExistsInt32 = (eng, id) => { return("ContentExist"); }; ShimTemplate.GetByTemplateID_NoAccessCheckInt32 = (id) => { var template = new Template { TemplateSource = "TemplateSource", TemplateText = "TemplateText" }; return(template); }; ShimGroup.ValidateDynamicStringsForTemplateListOfStringInt32User = (list, groupId, user) => { }; // Act var actualResult = typeof(ECNBlastEngine).CallMethod(METHOD_VerifyForeignKey, new object[] { blastId }, blastEngine).ToString(); // Assert StringAssert.Contains(actualResult, exceptionMsg); }
private void MonitorBreach(DragablzDragDeltaEventArgs e) { var mousePositionOnHeaderItemsControl = Mouse.GetPosition(_dragablzItemsControl); Orientation?breachOrientation = null; if (mousePositionOnHeaderItemsControl.X < -InterTabController.HorizontalPopoutGrace || (mousePositionOnHeaderItemsControl.X - _dragablzItemsControl.ActualWidth) > InterTabController.HorizontalPopoutGrace) { breachOrientation = Orientation.Horizontal; } else if (mousePositionOnHeaderItemsControl.Y < -InterTabController.VerticalPopoutGrace || (mousePositionOnHeaderItemsControl.Y - _dragablzItemsControl.ActualHeight) > InterTabController.VerticalPopoutGrace) { breachOrientation = Orientation.Vertical; } if (!breachOrientation.HasValue) { return; } var newTabHost = InterTabController.InterTabClient.GetNewHost(InterTabController.InterTabClient, InterTabController.Partition, this); if (newTabHost == null || newTabHost.TabablzControl == null || newTabHost.Container == null) { throw new ApplicationException("New tab host was not correctly provided"); } var item = _dragablzItemsControl.ItemContainerGenerator.ItemFromContainer(e.DragablzItem); var myWindow = Window.GetWindow(this); if (myWindow == null) { throw new ApplicationException("Unable to find owning window."); } newTabHost.Container.Width = myWindow.RestoreBounds.Width; newTabHost.Container.Height = myWindow.RestoreBounds.Height; var dragStartWindowOffset = e.DragablzItem.TranslatePoint(new Point(), myWindow); dragStartWindowOffset.Offset(e.DragablzItem.MouseAtDragStart.X, e.DragablzItem.MouseAtDragStart.Y); var borderVector = myWindow.WindowState == WindowState.Maximized ? myWindow.PointToScreen(new Point()) - new Point() : myWindow.PointToScreen(new Point()) - new Point(myWindow.Left, myWindow.Top); dragStartWindowOffset.Offset(borderVector.X, borderVector.Y); var dragableItemHeaderPoint = e.DragablzItem.TranslatePoint(new Point(), _dragablzItemsControl); var dragableItemSize = new Size(e.DragablzItem.ActualWidth, e.DragablzItem.ActualHeight); var floatingItemSnapShots = this.VisualTreeDepthFirstTraversal() .OfType <Layout>() .SelectMany(l => l.FloatingDragablzItems().Select(FloatingItemSnapShot.Take)) .ToList(); var interTabTransfer = new InterTabTransfer(item, e.DragablzItem, breachOrientation.Value, dragStartWindowOffset, e.DragablzItem.MouseAtDragStart, dragableItemHeaderPoint, dragableItemSize, floatingItemSnapShots); if (myWindow.WindowState == WindowState.Maximized) { var desktopMousePosition = Native.GetCursorPos(); newTabHost.Container.Left = desktopMousePosition.X - dragStartWindowOffset.X; newTabHost.Container.Top = desktopMousePosition.Y - dragStartWindowOffset.Y; } else { newTabHost.Container.Left = myWindow.Left; newTabHost.Container.Top = myWindow.Top; } newTabHost.Container.Show(); var contentPresenter = FindChildContentPresenter(item); RemoveFromSource(item); _itemsHolder.Children.Remove(contentPresenter); if (Items.Count == 0) { Layout.ConsolidateBranch(this); } if (_previousSelection != null && Items.Contains(_previousSelection)) { SelectedItem = _previousSelection; } else { SelectedItem = Items.OfType <object>().FirstOrDefault(); } foreach (var dragablzItem in _dragablzItemsControl.DragablzItems()) { dragablzItem.IsDragging = false; dragablzItem.IsSiblingDragging = false; } newTabHost.TabablzControl.ReceiveDrag(interTabTransfer); interTabTransfer.OriginatorContainer.IsDropTargetFound = true; e.Cancel = true; }
protected override void OnLayoutUnFocused(object sender, EventArgs args) { _isTexstBlockFocused = false; Layout.SignalEmit(States.Unfocused, ""); }
public void Append(IError error) { string formattedError = Layout.FormatError(error); Console.WriteLine(formattedError); }
public static PageModel CreatePageModel(Layout layout) { return(new FilmPageModel(layout)); }
public static string GetLayoutName(this Layout layout) { return(!string.IsNullOrWhiteSpace(layout.UrlSegment) ? layout.UrlSegment : string.Format("_{0}", Regex.Replace(layout.Name, @"[^\w//]+", ""))); }
public StateLayoutController(Layout <View> layout) => layoutWeakReference = new WeakReference <Layout <View> >(layout);
public static extern void Gemv(Layout layout, Transpose trans, int m, int n, Float alpha, Float[] a, int lda, Float[] x, int incx, Float beta, Float[] y, int incy);
public static extern int Svd(Layout layout, SvdJob jobu, SvdJob jobvt, int m, int n, Float[] a, int lda, Float[] s, Float[] u, int ldu, Float[] vt, int ldvt, Float[] superb);
/// <summary> /// Retrieve view for <paramref name="displayPosition"/> from intermediate cache. /// </summary> private View GetViewFromIntermediateCache(RecyclerView.Recycler recycler, int displayPosition) { if (_shouldBlockIntermediateCache) { return(null); } UnoViewHolder result = null; List <UnoViewHolder> views; var type = _owner.CurrentAdapter.GetItemViewType(displayPosition); if (!_intermediateCache.TryGetValue(type, out views)) { return(null); } //Remove views that are animating out views.RemoveAll(RemoveUnrecyclable); foreach (var holder in views) { //Look for an exact match if (holder.LayoutPosition == displayPosition) { result = holder; views.Remove(result); _owner.CurrentAdapter.RegisterPhaseBinding(result); //Restart phase binding, since this won't be rebound by adapter break; } } if (result == null && views.Count > 0) { // Get any match of correct type except views that could be reused without rebinding for (int i = views.Count - 1; i >= 0; i--) { var view = views[i]; if (!IsInTargetRange(view.LayoutPosition)) { result = view; views.RemoveAt(i); break; } } } if (result != null) { recycler.BindViewToPosition(result.ItemView, displayPosition); if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) { this.Log().Debug($"Returning cached view for position={displayPosition} and view type={type}. {views.Count} cached views remaining."); } return(result.ItemView); } return(null); bool RemoveUnrecyclable(UnoViewHolder holderInner) { var isUnrecyclable = !holderInner.IsRecyclable; if (isUnrecyclable) { Layout.RemoveAndRecycleView(holderInner.ItemView, recycler); } return(isUnrecyclable); } }
/// <summary> /// Creates GUI elements for fields common to all joints. /// </summary> protected virtual void BuildGUI(Joint joint, bool showOffsets) { this.showOffsets = showOffsets; targetField = new GUIGameObjectField(typeof(Rigidbody), new LocEdString("Target")); anchorField = new GUIGameObjectField(typeof(Rigidbody), new LocEdString("Anchor")); if (showOffsets) { targetOffsetField = new GUIVector3Field(new LocEdString("Target offset")); anchorOffsetField = new GUIVector3Field(new LocEdString("Anchor offset")); } breakForceField = new GUIFloatField(new LocEdString("Break force")); breakTorqueField = new GUIFloatField(new LocEdString("Break torque")); collisionField = new GUIToggleField(new LocEdString("Enable collision")); targetField.OnChanged += x => { joint.SetBody(JointBody.Target, (Rigidbody)x); MarkAsModified(); ConfirmModify(); }; anchorField.OnChanged += x => { joint.SetBody(JointBody.Anchor, (Rigidbody)x); MarkAsModified(); ConfirmModify(); }; if (showOffsets) { targetOffsetField.OnValueChanged += x => { joint.SetTransform(JointBody.Target, x, joint.GetRotation(JointBody.Target)); MarkAsModified(); }; targetOffsetField.OnFocusLost += ConfirmModify; targetOffsetField.OnConfirm += x => ConfirmModify(); anchorOffsetField.OnValueChanged += x => { joint.SetTransform(JointBody.Anchor, x, joint.GetRotation(JointBody.Anchor)); MarkAsModified(); }; anchorOffsetField.OnFocusLost += ConfirmModify; anchorOffsetField.OnConfirm += x => ConfirmModify(); } breakForceField.OnChanged += x => { joint.BreakForce = x; MarkAsModified(); }; breakForceField.OnFocusLost += ConfirmModify; breakForceField.OnConfirmed += ConfirmModify; breakTorqueField.OnChanged += x => { joint.BreakTorque = x; MarkAsModified(); }; breakTorqueField.OnFocusLost += ConfirmModify; breakTorqueField.OnConfirmed += ConfirmModify; collisionField.OnChanged += x => { joint.EnableCollision = x; MarkAsModified(); ConfirmModify(); }; Layout.AddElement(targetField); if (showOffsets) { Layout.AddElement(targetOffsetField); } Layout.AddElement(anchorField); if (showOffsets) { Layout.AddElement(anchorOffsetField); } Layout.AddElement(breakForceField); Layout.AddElement(breakTorqueField); Layout.AddElement(collisionField); }
/// <summary> /// Destroys all inspector GUI elements. /// </summary> internal void Destroy() { Layout.Destroy(); GUI.Destroy(); }
private static extern int PptriInternal(Layout layout, UpLo uplo, int n, Double[] ap);
public object PersistForm(PersistFormRequest request) { // Variables. var result = default(object); var formsRootId = GuidHelper.GetGuid(FormConstants.Id); var parentId = GuidHelper.GetGuid(request.ParentId); // Catch all errors. try { // Parse or create the form ID. var isNew = string.IsNullOrWhiteSpace(request.FormId); var formId = isNew ? Guid.NewGuid() : GuidHelper.GetGuid(request.FormId); // Get the fields. var fields = request.Fields.MakeSafe() .Select(x => { var fieldType = Type.GetType(x.TypeFullName); var fieldTypeInstance = FormFieldTypeCollection .FirstOrDefault(y => y.GetType() == fieldType); var field = new FormField(fieldTypeInstance) { Id = string.IsNullOrWhiteSpace(x.Id) ? Guid.NewGuid() : GuidHelper.GetGuid(x.Id), Alias = x.Alias, Name = x.Name, Label = x.Label, Category = x.Category, Validations = x.Validations.MakeSafe() .Select(y => GuidHelper.GetGuid(y)).ToArray(), FieldConfiguration = JsonHelper.Serialize(x.Configuration) }; return(field); }) .ToArray(); // Get the handlers. var handlers = request.Handlers.MakeSafe().Select(x => { var handlerType = Type.GetType(x.TypeFullName); var handlerTypeInstance = FormHandlerTypeCollection .FirstOrDefault(y => y.GetType() == handlerType); var handler = new FormHandler(handlerTypeInstance) { Id = string.IsNullOrWhiteSpace(x.Id) ? Guid.NewGuid() : GuidHelper.GetGuid(x.Id), Alias = x.Alias, Name = x.Name, Enabled = x.Enabled, HandlerConfiguration = JsonHelper.Serialize(x.Configuration) }; return(handler); }).ToArray(); // Get the ID path. var parent = parentId == Guid.Empty ? null : Entities.Retrieve(parentId); var path = parent == null ? new[] { formsRootId, formId } : parent.Path.Concat(new[] { formId }).ToArray(); // Create the form. var form = new Form() { Id = formId, Path = path, Alias = request.Alias, Name = request.Name, Fields = fields, Handlers = handlers }; // Persist the form. Persistence.Persist(form); // For new forms, automatically create a layout and a form configuration. var layoutNamePrefix = "Layout for "; var layoutNameSuffix = " (Autogenerated)"; var layoutAliasPrefix = "layout_"; var layoutAliasSuffix = "_autogenerated"; var autoLayoutData = JsonHelper.Serialize(new { rows = new[] { new { cells = new [] { new { columnSpan = 12, fields = form.Fields.Select(x => new { id = GuidHelper.GetString(x.Id) }) } } } }, formId = GuidHelper.GetString(form.Id), autopopulate = true }); if (isNew) { // Create new layout. var layoutId = Guid.NewGuid(); var layout = new Layout() { KindId = GuidHelper.GetGuid(app.Constants.Layouts.LayoutBasic.Id), Id = layoutId, Path = new[] { GuidHelper.GetGuid(LayoutConstants.Id), layoutId }, Name = layoutNamePrefix + request.Name + layoutNameSuffix, Alias = layoutAliasPrefix + request.Alias + layoutAliasSuffix, Data = autoLayoutData }; // Persist layout. LayoutPersistence.Persist(layout); // Create a new form configuration. var plainJsTemplateId = GuidHelper.GetGuid("f3fb1485c1d14806b4190d7abde39530"); var template = Config.Templates.FirstOrDefault(x => x.Id == plainJsTemplateId) ?? Config.Templates.FirstOrDefault(); var configId = Guid.NewGuid(); var configuredForm = new ConfiguredForm() { Id = configId, Path = path.Concat(new[] { configId }).ToArray(), Name = request.Name, TemplateId = template?.Id, LayoutId = layoutId }; // Persist form configuration. ConFormPersistence.Persist(configuredForm); } // Get existing layouts that should autopopulate. var layouts = GetFormLayouts(null) .Select(x => new { Layout = x, Configuration = x.DeserializeConfiguration() as LayoutBasicConfiguration }) .Where(x => x.Configuration != null) .Where(x => x.Configuration.FormId.HasValue && x.Configuration.FormId.Value == formId) .Where(x => x.Configuration.Autopopulate); //: Autopopulate the layouts. foreach (var existingLayout in layouts) { existingLayout.Layout.Data = autoLayoutData; var layoutName = existingLayout.Layout.Name ?? string.Empty; var layoutAlias = existingLayout.Layout.Alias ?? string.Empty; if (layoutName.StartsWith(layoutNamePrefix) && layoutName.EndsWith(layoutNameSuffix)) { existingLayout.Layout.Name = layoutNamePrefix + form.Name + layoutNameSuffix; } if (layoutAlias.StartsWith(layoutAliasPrefix) && layoutAlias.EndsWith(layoutAliasSuffix)) { existingLayout.Layout.Alias = layoutAliasPrefix + form.Name + layoutAliasSuffix; } LayoutPersistence.Persist(existingLayout.Layout); } // Success. result = new { Success = true, FormId = GuidHelper.GetString(formId) }; } catch (Exception ex) { // Error. Logger.Error <FormsController>(ex, PersistFormError); result = new { Success = false, Reason = UnhandledError }; } // Return the result. return(result); }
public void BuildPuzzle(int averageCount = 4) { Debug.Assert(puzzle == null); puzzle = new ChunkLayout(); // Find a starting letter on the first row BoundingRectangle r = Layout.Bounds; int loopCol; for (loopCol = r.Min.Column; loopCol <= r.Max.Column; loopCol++) { if (Layout.GetSquare(r.Min.Row, loopCol) != null) { break; } } Debug.Assert(loopCol <= r.Max.Column); // Start accumulation process from this initial square Stack <Square> myStack = new Stack <Square>(); myStack.Push(Layout.GetSquare(r.Min.Row, loopCol)); // We stop once all squares have been placed while (myStack.Count > 0) { Square sq = myStack.Pop(); if (sq != null && !sq.IsInChunk) { Chunk chunk = new Chunk(puzzle.Chunks.Count); chunk.AddSquare(sq); sq.IsInChunk = true; puzzle.AddChunk(chunk); Queue <Square> connectedSquares = new Queue <Square>(); // Examine 4 possible candidates around current square for (; ;) { int row = sq.Row; int column = sq.Column; sq = Layout.GetSquare(row + 1, column); if (sq != null && !sq.IsInChunk) { connectedSquares.Enqueue(sq); } sq = Layout.GetSquare(row - 1, column); if (sq != null && !sq.IsInChunk) { connectedSquares.Enqueue(sq); } sq = Layout.GetSquare(row, column + 1); if (sq != null && !sq.IsInChunk) { connectedSquares.Enqueue(sq); } sq = Layout.GetSquare(row, column - 1); if (sq != null && !sq.IsInChunk) { connectedSquares.Enqueue(sq); } if (connectedSquares.Count == 0) { break; } if (OkAccumulation(chunk.SquaresCount + 1, averageCount)) { sq = connectedSquares.Dequeue(); sq.IsInChunk = true; chunk.AddSquare(sq); } else { break; } } while (connectedSquares.Count > 0) { myStack.Push(connectedSquares.Dequeue()); } } } WriteLine(); WriteLine($"{puzzle.ChunksCount} chunks, {puzzle.SquaresCount} squares, initial pass"); PrintPuzzle(); // Group small chunks List <Chunk> smallChunks = puzzle.Chunks.Where(chunk => chunk.Squares.Count <= 2).ToList(); foreach (var chunk in smallChunks) { if (!chunk.IsDeleted) { for (; ;) { var adjacentChunk = puzzle.GetAdjacentChunks(chunk).OrderBy(ch => ch.Squares.Count).FirstOrDefault(); if (adjacentChunk == null) { break; } if (!OkAccumulation(chunk.SquaresCount + adjacentChunk.SquaresCount, averageCount)) { break; } chunk.AddSquares(adjacentChunk.Squares); puzzle.RemoveChunk(adjacentChunk); } } } WriteLine(); WriteLine($"{puzzle.ChunksCount} chunks, {puzzle.SquaresCount} squares, after grouping"); PrintPuzzle(); }
public JsonResult UpdateLogo(Layout x) { var result = false; if (x != null) { Layout xdb = db.Layout.FirstOrDefault(w => w.Id == x.Id); if (x.LogoFile != null) { string imageName = DateTime.Now.ToString("ssfff") + Regex.Replace(x.LogoFile.FileName, "[^A-Za-z0-9.]", ""); string imagePath = Path.Combine(Server.MapPath("~/Uploads/"), imageName); string oldImagePath = Path.Combine(Server.MapPath("~/Uploads/"), xdb.Logo); System.IO.File.Delete(oldImagePath); x.LogoFile.SaveAs(imagePath); xdb.Logo = imageName; } if (x.LogoFooterFile != null) { string imageName = DateTime.Now.ToString("ssfff") + Regex.Replace(x.LogoFooterFile.FileName, "[^A-Za-z0-9.]", ""); string imagePath = Path.Combine(Server.MapPath("~/Uploads/"), imageName); string oldImagePath = Path.Combine(Server.MapPath("~/Uploads/"), xdb.LogoFooter); System.IO.File.Delete(oldImagePath); x.LogoFooterFile.SaveAs(imagePath); xdb.LogoFooter = imageName; } if (x.About_ImageFile != null) { string imageName = DateTime.Now.ToString("ssfff") + Regex.Replace(x.About_ImageFile.FileName, "[^A-Za-z0-9.]", ""); string imagePath = Path.Combine(Server.MapPath("~/Uploads/"), imageName); string oldImagePath = Path.Combine(Server.MapPath("~/Uploads/"), xdb.About_Image); System.IO.File.Delete(oldImagePath); x.About_ImageFile.SaveAs(imagePath); xdb.About_Image = imageName; } if (x.SignatureFile != null) { string imageName = DateTime.Now.ToString("ssfff") + Regex.Replace(x.SignatureFile.FileName, "[^A-Za-z0-9.]", ""); string imagePath = Path.Combine(Server.MapPath("~/Uploads/"), imageName); string oldImagePath = Path.Combine(Server.MapPath("~/Uploads/"), xdb.Signature); System.IO.File.Delete(oldImagePath); x.SignatureFile.SaveAs(imagePath); xdb.Signature = imageName; } if (x.Promo_ImageFile != null) { string imageName = DateTime.Now.ToString("ssfff") + Regex.Replace(x.Promo_ImageFile.FileName, "[^A-Za-z0-9.]", ""); string imagePath = Path.Combine(Server.MapPath("~/Uploads/"), imageName); string oldImagePath = Path.Combine(Server.MapPath("~/Uploads/"), xdb.Promo_Image); System.IO.File.Delete(oldImagePath); x.Promo_ImageFile.SaveAs(imagePath); xdb.Promo_Image = imageName; } db.Entry(xdb).State = EntityState.Modified; db.Entry(xdb).Property(c => c.Phone).IsModified = false; db.Entry(xdb).Property(c => c.Email).IsModified = false; db.Entry(xdb).Property(c => c.Address).IsModified = false; db.SaveChanges(); result = true; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public void DeleteLayout(Layout layout) { throw new NotImplementedException(); }
protected override void OnLayoutFocused(object sender, EventArgs args) { Layout.SignalEmit(States.Focused, ""); }
private bool ShouldDragWindow(DragablzItemsControl sourceOfDragItemsControl) { return(Items.Count == 1 && (InterTabController == null || InterTabController.MoveWindowWithSolitaryTabs) && !Layout.IsContainedWithinBranch(sourceOfDragItemsControl)); }
public LayoutModel() { _layout = new Layout(_defaultLayout); }