/// <summary> /// Replaces this container from the parent with a different container /// </summary> /// <param name="container">container that replaces this container</param> public void ReplaceWith(BaseContainer container) { if (ParentContainer != null) { ParentContainer.ReplaceChild(this, container); } }
public void AddService(Type serviceType, object serviceInstance, bool promote) { if (serviceType == null) { throw new ArgumentNullException("serviceType"); } if (serviceInstance == null) { throw new ArgumentNullException("serviceInstance"); } if (!(serviceInstance is ServiceCreatorCallback) && !serviceType.IsInstanceOfType(serviceInstance)) { throw new ArgumentException( CommonResourceUtil.GetString(Resources.ServiceProvider_InvalidServiceInstance, serviceType.FullName, "serviceInstance")); } if (promote && ParentContainer != null) { ParentContainer.AddService(serviceType, serviceInstance, promote); return; } lock (this) { if (Services.ContainsKey(serviceType)) { throw new InvalidOperationException( CommonResourceUtil.GetString(Resources.ServiceProvider_ServiceAlreadyExists, serviceType.FullName)); } Services.Add(serviceType, serviceInstance); } }
public void UpdateParent(DataModel.ParentContainer parent) { try { var parents = Context.GetTable <ParentContainer>(); var record = parents.Where(x => x.Id.Equals(parent.Id)).FirstOrDefault(); record = parent; Context.SubmitChanges(ConflictMode.FailOnFirstConflict); } catch (ChangeConflictException e) { foreach (ObjectChangeConflict occ in Context.ChangeConflicts) { MetaTable metaTable = Context.Mapping.GetTable(occ.Object.GetType()); ParentContainer entityInConflict = (ParentContainer)occ.Object; foreach (var conflict in occ.MemberConflicts) { object currentValue = conflict.CurrentValue; object originalValue = conflict.OriginalValue; object databaseValue = conflict.DatabaseValue; MemberInfo mi = conflict.Member; Console.WriteLine("Change conflict detected on Member: {0}, Current: {1}, Original: {2}, Database: {3}", mi.Name, currentValue, originalValue, databaseValue); } } } }
private void btnBack_Click(object sender, System.EventArgs e) { DialogResult result = XtraMessageBox.Show("هل تريد الحفظ قبل الخروج؟", "تنبيه", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); switch (result) { case DialogResult.Yes: btnSave_Click(null, null); if (ParentContainer != null) { ParentContainer.CollapseLeftPanel(false); ParentContainer.ShowInvoiceContainer(false); } this.Visible = false; break; case DialogResult.No: if (ParentContainer != null) { ParentContainer.CollapseLeftPanel(false); ParentContainer.ShowInvoiceContainer(false); } this.Visible = false; break; case DialogResult.Cancel: return; } }
void UpdateTabstrip() { var hadSplit = hasSplit; var hasMultipleViews = currentContainer != null && currentContainer.GetAllViews().Skip(1).Any(); tabstrip.Visible = hasMultipleViews && (supportedModes & DocumentViewContainerMode.Tabs) != 0; hasSplit = (this.supportedModes & DocumentViewContainerMode.VerticalSplit) != 0 || (this.supportedModes & DocumentViewContainerMode.HorizontalSplit) != 0; if (hasSplit && !hadSplit) { var currentActive = tabstrip.ActiveTab; var tab = new Tab(tabstrip, GettextCatalog.GetString("Split")); tabstrip.AddTab(tab); tabstrip.ActiveTab = currentActive; tab.Activated += TabActivated; } else if (!hasSplit && hadSplit) { tabstrip.RemoveTab(tabstrip.TabCount - 1); } // If this container is showing tabs and it is inside another container, give the parent the // chance to show the tabstrip in its own tab area, to avoid tab stacking ParentContainer?.UpdateAttachedTabstrips(); // This might be a container that has children with tabs. Maybe now it is possible to embed the // child tabstrips into this container's tab area. Let's try! UpdateAttachedTabstrips(); }
protected virtual bool OnCursorIsInArea() { //control rectangle if (!(new Rectangle(Vector2.Zero, new Vector2(1, 1))).Contains(MousePosition)) { return(false); } if (ParentContainer != null && ParentContainer.IsControlCursorCoveredByOther(this)) { return(false); } //!!!!было ////click mask //if( !string.IsNullOrEmpty( clickMask ) ) //{ //if( needUpdateClickTextureMask ) //{ // clickTextureMask = TextureMaskManager.GetMask( clickMask ); // needUpdateClickTextureMask = false; //} //if( clickTextureMask != null ) //{ // Vec2 pos = clickMaskTextureCoord.LeftTop + clickMaskTextureCoord.GetSize() * MousePosition; // if( !clickTextureMask.GetValue( pos ) ) // return false; //} //} return(true); }
public void SetTitle(string label, Xwt.Drawing.Image icon, string accessibilityDescription) { Title = label; Icon = icon; AccessibilityDescription = accessibilityDescription; ParentContainer?.SetViewTitle(this, label, icon, accessibilityDescription); }
public void AddService(Type serviceType, ServiceCreatorCallback callback, bool promote) { if (serviceType == null) { throw new ArgumentNullException("serviceType"); } if (callback == null) { throw new ArgumentNullException("callback"); } if (promote && ParentContainer != null) { ParentContainer.AddService(serviceType, callback, promote); return; } lock (this) { if (Services.ContainsKey(serviceType)) { throw new InvalidOperationException( CommonResourceUtil.GetString(Resources.ServiceProvider_ServiceAlreadyExists, serviceType.FullName)); } Services.Add(serviceType, callback); } }
private (TItem, bool) ItemCanBeDropped() { if (!TransactionInProgress) { return(default(TItem), false); } var item = ParentContainer.GetTransactionItem(); if (item == null) { return(default(TItem), false); } var canBeDropped = true; if (DropAllowed != null) { canBeDropped = DropAllowed(item); } else if (ParentContainer.DropAllowed != null) { canBeDropped = ParentContainer.DropAllowed(item, Name); } return(item, canBeDropped); }
public void SetUpNestedContainer() { NestedContainer = ParentContainer.GetNestedContainer(); var url = Config.Environment.Equals("DEV", StringComparison.InvariantCultureIgnoreCase) ? Config.WebSiteUrlLocal: Config.WebSiteUrl; WebSite = new ForecastingWebSite(url, Config.Browser); }
public void PrepareNewGraph() { graphObjects.Clear(); if (ParentContainer != null) { ParentContainer.PrepareNewGraph(); } }
public void SetCryptedString(string key, string value) { if (key == null) { throw new ArgumentNullException(nameof(key)); } ParentContainer.SetCryptedString(KeyPrefix + key, value); }
/// <summary> /// Move this container to a new parent /// </summary> /// <param name="newParent">new parent</param> public void MoveTo(BaseContainer newParent) { if (ParentContainer != null) { ParentContainer.RemoveChild(this); } newParent.AddChild(this); }
public string GetDecryptedStringOrDefault(string key, string defaultValue = null) { if (key == null) { throw new ArgumentNullException(nameof(key)); } return(ParentContainer.Get(KeyPrefix + key, defaultValue)); }
public T Get <T>(string key, T defaultValue = default(T)) { if (key == null) { throw new ArgumentNullException(nameof(key)); } return(ParentContainer.Get(KeyPrefix + key, defaultValue)); }
public bool Exists(string key) { if (key == null) { throw new ArgumentNullException(nameof(key)); } return(ParentContainer.Exists(KeyPrefix + key)); }
void Ex01() { Fixture = TestFixtures.CreateFixture <TestFixtures.SimpleFixture>("FixtureMethod"); Container.Add(Fixture); ParentContainer.EnsureParent(); Expect("the parent of the added fixture is set to the parent fixture container", () => Fixture.ParentFixture == ParentContainer); }
public void Clear() { var keysToRemove = Keys.ToArray(); foreach (var key in keysToRemove) { ParentContainer.Remove(key); } }
void Ex02() { Fixture = new FixtureContainer(typeof(TestFixtures.SimpleFixture)); Container.Add(Fixture); ParentContainer.EnsureParent(); Expect("the parent of the added fixture container is set to the fixture container", () => Fixture.ParentFixture == Container); }
public virtual void AddFlowElementToMap(FlowElement element) { if (element != null && !string.IsNullOrWhiteSpace(element.Id)) { flowElementMap[element.Id] = element; if (ParentContainer != null) { ParentContainer.AddFlowElementToMap(element); } } }
private IEnumerable <TItem> GetItems() { Func <TItem, bool> predicate = (item) => ParentContainer.ItemsFilter(item, Name); if (ItemsFilter != null) { predicate = ItemsFilter; } return((ParentContainer?.Items ?? Enumerable.Empty <TItem>()).Where(predicate).ToArray()); }
public override void Initialize() { command = new RemindMeCommand() { ParentModule = this }; ParentContainer.GetModule <CommandRootModule>().AddCommands(command); this.GetClock().OnMinutePassed += Update; ParentShard.ReactionAdded += ReactionAdded; ParentShard.ReactionRemoved += ReactionRemoved; }
public void AddFlowElementToMap(FlowElement element) { if (element != null && (!string.IsNullOrEmpty(element.Id))) { flowElementMap.Add(element.Id, element); if (ParentContainer != null) { ParentContainer.AddFlowElementToMap(element); } } }
private async Task OnDragStartHandler() { if (ParentContainer == null) { return; } dragging = true; ParentContainer.StartTransaction(Item, ZoneName, OnDroppedSucceeded, OnDroppedCanceled); await DragStarted.InvokeAsync(); }
public bool HasAncestorWith(Func <IContainer, bool> criteria) { if (ParentContainer == null) { return(false); } if (criteria(ParentContainer)) { return(true); } return(ParentContainer.HasAncestorWith(criteria)); }
public void AddFlowElement(FlowElement element) { flowElementList.Add(element); element.ParentContainer = this; if (!string.IsNullOrEmpty(element.Id)) { flowElementMap.Add(element.Id, element); if (ParentContainer != null) { ParentContainer.AddFlowElementToMap(element); } } }
private async Task OnDragEndHandler(DragEventArgs e) { if (dragging) { dragging = false; await ParentContainer?.CancelTransaction(); } else { await DragEnded.InvokeAsync(Item); } }
void Ex03() { var fixtures = new[] { TestFixtures.CreateFixture <TestFixtures.SimpleFixture>("FixtureMethod"), TestFixtures.CreateFixture <TestFixtures.SimpleFixture>("FixtureMethod"), TestFixtures.CreateFixture <TestFixtures.SimpleFixture>("FixtureMethod") }; Container.AddRange(fixtures); ParentContainer.EnsureParent(); Expect("the parent of each added fixture is set to the parent fixture container.", () => fixtures.All(f => f.ParentFixture == ParentContainer)); }
void Ex04() { var fixtureContainers = new IFixture[] { new FixtureContainer(typeof(TestFixtures.SimpleFixture)), new FixtureContainer(typeof(TestFixtures.SimpleFixture)), new FixtureContainer(typeof(TestFixtures.SimpleFixture)) }; Container.AddRange(fixtureContainers); ParentContainer.EnsureParent(); Expect("the parent of each added fixture container is set to the fixture container.", () => fixtureContainers.All(f => f.ParentFixture == Container)); }
public void AddServicePromotedWithCallback() { using (ParentContainer parentContainer = new ParentContainer()) { using (TestContainer testContainer = new TestContainer(parentContainer)) { testContainer.AddService(typeof(SayHelloService), new ServiceCreatorCallback(SayHelloServiceCreatorCallback), true); SayHelloService sayHello = testContainer.GetService(typeof(SayHelloService)) as SayHelloService; Assert.AreEqual(1, testContainer.services.Count); Assert.AreEqual(1, parentContainer.services.Count); Assert.IsNotNull(sayHello); Assert.IsTrue(serviceCallbackExecuted); } } }
public void AddServicePromotedWithCallback() { using (ParentContainer parentContainer = new ParentContainer()) { using (TestContainer testContainer = new TestContainer(parentContainer)) { testContainer.AddService(typeof(SayHelloService), new ServiceCreatorCallback(SayHelloServiceCreatorCallback), true); SayHelloService sayHello = testContainer.GetService(typeof(SayHelloService)) as SayHelloService; Assert.AreEqual(1, testContainer.services.Count); Assert.AreEqual(1, parentContainer.services.Count); Assert.IsNotNull(sayHello); Assert.IsTrue(serviceCallbackExecuted); } } }