Example #1
0
 /// <summary>
 /// Retrieves the instance information for the provided instance, or null of there is no current instance information.
 /// </summary>
 /// <param name="Item"></param>
 /// <returns></returns>
 public Object GetPerElementData(Object Item)
 {
     if (_extendedData.TryGetValue(Item, out Object result))
     {
         //we got a result- return it.
         return(result);
     }
     else
     {
         return(null);
     }
 }
        /// <summary>
        /// Returns an existing or creates a new view model for the specified search hit.
        /// </summary>
        /// <param name="searchHit">Search hit for which a view model should be returned, or created.</param>
        /// <param name="parent">Parent enumerable</param>
        /// <returns>Created or existing view model.</returns>
        public static SearchHitViewModel GetOrCreateSearchHitViewModel(Engine.Interfaces.ISearchHit searchHit, ObservableEnumerable parent)
        {
            SearchHitViewModel viewModel = null;

            if (!mViewModels.TryGetValue(searchHit, out viewModel))
            {
                viewModel = new SearchHitViewModel(searchHit, parent);
                mViewModels.Add(searchHit, viewModel);
            }
            return(viewModel);
        }
Example #3
0
        /// <summary> Gets the source of a specified owner. </summary>
        /// <param name="owner"></param>
        /// <returns>returns the TraceSource or null if the owner owns no source.</returns>
        public static TraceSource GetOwnedSource(object owner)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }
            TraceSource source = null;

            lock (addlock)
                ownedTraceSources.TryGetValue(owner, out source);
            return(source);
        }
Example #4
0
        public static LuaSandbox GetSandbox(Lua thread)
        {
            // this is just placeholder.
            // we shouldnt be calling a sandbox with no thread--construct a sandbox properly
            if (thread == null)
            {
                return(new LuaSandbox());
            }

            lock (SandboxForThread)
            {
                if (SandboxForThread.TryGetValue(thread, out var sandbox))
                {
                    return(sandbox);
                }

                // for now: throw exception (I want to manually creating them)
                // return CreateSandbox(thread);
                throw new InvalidOperationException("HOARY GORILLA HIJINX");
            }
        }