public DataStorage() { hosts = new List<HostItem>(); HostItem newHost = new HostItem() { FirstName = "Пафос", LastName = "Паллас", Description = "Отель на берегу моря. Все включено", Price = 12500 }; hosts.Add(newHost); }
/// <summary> /// Creates an identical copy of the <see cref="HostItem"/>. /// </summary> /// <returns>An object that represents an <see cref="HostItem"/> that has the same <see cref="ToolboxItem"/>, forecolor and backcolor associated with it as the cloned item.</returns> public override Item Clone() { HostItem hostItem = new HostItem(this._item, this._projectSpecific); hostItem.BackColor = this.BackColor; hostItem.ForeColor = this.ForeColor; return hostItem; }
public DynamicDispatchWrapper(HostItem hostItem, IDispatch dispatch) { this.hostItem = hostItem; this.dispatch = dispatch; }
public DynamicDispatchExWrapper(HostItem hostItem, IDispatchEx dispatchEx) { this.hostItem = hostItem; this.dispatchEx = dispatchEx; }
private object MarshalToScriptInternal(object obj, HostItemFlags flags, HashSet <Array> marshaledArraySet) { if (obj == null) { if (engineFlags.HasFlag(WindowsScriptEngineFlags.MarshalNullAsDispatch)) { return(nullDispatch); } return(DBNull.Value); } if (obj is Undefined) { return(null); } if (obj is Nonexistent) { return(null); } if (obj is Nothing) { return(nullDispatch); } if (engineFlags.HasFlag(WindowsScriptEngineFlags.MarshalDateTimeAsDate) && (obj is DateTime)) { return(obj); } if (engineFlags.HasFlag(WindowsScriptEngineFlags.MarshalDecimalAsCurrency) && (obj is decimal)) { return(new CurrencyWrapper(obj)); } if (obj is HostItem hostItem) { if ((hostItem.Engine == this) && (hostItem.Flags == flags)) { return(obj); } obj = hostItem.Target; } var hostTarget = obj as HostTarget; if ((hostTarget != null) && !(hostTarget is IHostVariable)) { obj = hostTarget.Target; } if (obj is ScriptItem scriptItem) { if (scriptItem.Engine == this) { return(scriptItem.Unwrap()); } } if (engineFlags.HasFlag(WindowsScriptEngineFlags.MarshalArraysByValue)) { if ((obj is Array array) && ((hostTarget == null) || (typeof(Array).IsAssignableFrom(hostTarget.Type)))) { bool alreadyMarshaled; if (marshaledArraySet != null) { alreadyMarshaled = marshaledArraySet.Contains(array); } else { marshaledArraySet = new HashSet <Array>(); alreadyMarshaled = false; } if (!alreadyMarshaled) { marshaledArraySet.Add(array); var dimensions = Enumerable.Range(0, array.Rank).ToArray(); var marshaledArray = Array.CreateInstance(typeof(object), dimensions.Select(array.GetLength).ToArray(), dimensions.Select(array.GetLowerBound).ToArray()); array.Iterate(indices => marshaledArray.SetValue(MarshalToScriptInternal(array.GetValue(indices), flags, marshaledArraySet), indices)); return(marshaledArray); } // COM interop can't handle circularly referenced arrays return(MarshalToScriptInternal(null, flags, marshaledArraySet)); } } return(HostItem.Wrap(this, hostTarget ?? obj, flags)); }
private void FillHostSummary(HostItem host) { View hostView = FindViewById<LinearLayout> (Resource.Id.hostSummary); TextView txtFullName = hostView.FindViewById<TextView> (Resource.Id.name); txtFullName.Text = host.FirstName + " " + host.LastName; TextView txtDescription = hostView.FindViewById<TextView> (Resource.Id.description); txtDescription.Text = host.Description; }
public int Add(object value) { ToolboxItemContainer item = (ToolboxItemContainer) value; if (item != null) { HostItem hostItem = new HostItem(item.GetToolboxItem(null)); if (this._tab != null) { this._tab.Items.Add(hostItem); } else if (this._toolbox.GeneralCategory != null) { this._toolbox.GeneralCategory.Items.Add(hostItem); } else { if (this._toolbox.Categories.Count == 0) { this._toolbox.Categories.Add(this._toolbox.CreateNewTab(Resources.ToolboxTabDefaultName)); } this._toolbox.Categories[this._toolbox.Categories.Count - 1].Items.Add(hostItem); } } return -1; }