예제 #1
0
        private FormEditBug GetEditBugFormInstance(int connectionId, int bugId, Bug cachedBug, out bool existInstance)
        {
            FormEditBug result = null;

            string key = connectionId.ToString() + "," + bugId.ToString();

            existInstance = false;

            if (this.ContainsKey(key))
            {
                int keyIndex = this.IndexOfKey(key);

                result = this.Values[keyIndex];

                existInstance = true;
            }
            else
            {
                MyLogger.Write(String.Format("Generate new edit window for {0}-{1}", bugId, connectionId), "GetEditBugFormInstance", LoggingCategory.General);


                FormEditBug newInstance = FormInstanceDictionary.LoadForm(bugId, connectionId, cachedBug);

                if (newInstance != null)
                {
                    this.Add(key, newInstance);

                    result = newInstance;

                    existInstance = false;
                }
                else
                {
                    result = null;

                    existInstance = false;
                }
            }

            return(result);
        }