private void btnCancel_Click(object sender, EventArgs e)
 {
     if (!__cQuoteService.IsLogin)
     {
         __cQuoteService.Dispose();
         __cQuoteService = null;
     }
     this.DialogResult = DialogResult.Cancel;
 }
Esempio n. 2
0
        internal void RemoveQuoteService(string dataSource)
        {
            int  iIndex = -1;
            bool bHave  = false;

            lock (__cIndexs) {
                if (__cIndexs.TryGetValue(dataSource, out iIndex))
                {
                    iIndex = __cIndexs[dataSource];

                    AbstractQuoteService cCurrent = __cQuoteServices[iIndex];
                    cCurrent.Dispose();                      //釋放資源

                    int iLast = __cQuoteServices.Count - 1;
                    if (iLast > 0 && iLast > iIndex)
                    {
                        AbstractQuoteService cLast = __cQuoteServices[iLast];

                        __cIndexs[cLast.DataSource] = iIndex;
                        __cQuoteServices[iIndex]    = cLast;
                    }

                    __cIndexs.Remove(dataSource);
                    __cQuoteServices.RemoveAt(iLast);
                    bHave = true;
                }
            }

            if (bHave)
            {
                if (onQuoteServiceSwitchChanged != null)
                {
                    onQuoteServiceSwitchChanged(this, new QuoteServiceSwitchChangedEvent(dataSource, false));
                }
            }
        }