public static FormInstanceDictionary GetInstance()
        {
            if (_instance == null)
            {
                _instance = new FormInstanceDictionary();
            }

            return(_instance);
        }
Exemple #2
0
        private void FormEditBug_FormClosing(object sender, FormClosingEventArgs e)
        {
            ucEditBug.IsFormClosed = true;

            FormInstanceDictionary formManager = FormInstanceDictionary.GetInstance();

            formManager.RemoveEditBugFormInstance(_connectionId, _bugNo);

            if (ucEditBug.UpdateSuccessfully == true)
            {
                if (UpdatedBug != null)
                {
                    //IBugBSI bugInterface = (IBugBSI)BLControllerFactory.GetRegisteredConcreteFactory(_userID);

                    //ucEditBug.BugToUpdate =  bugInterface.GetBug(ucEditBug.BugToUpdate.Id);

                    UpdatedBug(this, new UpdatedBugEventArgs(ucEditBug.BugToUpdate));
                }
            }
        }
        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);
        }