示例#1
0
        private void UpdateSources(SourceViewModel sourceUpdated)
        {
            int index = m_allSources.IndexOf(m_sourceUpdated);

            if (index >= 0)
            {
                if (sourceUpdated == null)
                {
                    m_allSources.RemoveAt(index);
                }
                else
                {
                    m_allSources[index] = sourceUpdated;
                }
            }
            else
            {
                for (int i = 0; i < m_allSources.Count; i++)
                {
                    string name = m_allSources[i].Name;
                    if (name == sourceUpdated.Name)
                    {
                        sourceUpdated = null;
                    }
                    else if (name.CompareTo(sourceUpdated.Name) > 0)
                    {
                        m_allSources.Insert(i, sourceUpdated);
                    }
                    else
                    {
                        continue;
                    }
                    break;
                }
            }
            m_sourceUpdated = sourceUpdated;
        }
示例#2
0
 private void UpdateSources(SourceViewModel sourceUpdated)
 {
     int index = m_allSources.IndexOf (m_sourceUpdated);
      if (index >= 0)
      {
     if (sourceUpdated == null)
        m_allSources.RemoveAt (index);
     else
        m_allSources[index] = sourceUpdated;
      }
      else
      {
     for (int i = 0; i < m_allSources.Count; i++)
     {
        string name = m_allSources[i].Name;
        if (name == sourceUpdated.Name)
           sourceUpdated = null;
        else if (name.CompareTo (sourceUpdated.Name) > 0)
           m_allSources.Insert (i, sourceUpdated);
        else
           continue;
        break;
     }
      }
      m_sourceUpdated = sourceUpdated;
 }