Ejemplo n.º 1
0
 /// <summary>
 /// 更新ListFamilies的DisplayWeight
 /// </summary>
 private void UpdateListFamiliesDisplayWeight()
 {
     ListFamily.BeginTransaction();
     for (int i = 0; i < lstListFamilies.Items.Count; i++)
     {
         DataRowView fd         = lstListFamilies.Items[i] as DataRowView;
         ListFamily  listFamily = ListFamily.GetListFamilyById(fd[ListFamily.FIELD_NAME_ID].ToString());
         listFamily.DisplayWeight = i;
         ListFamily.UpdateListFamily(listFamily);
     }
     ListFamily.CommitTransaction();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 移动ListFamily
        /// </summary>
        /// <param name="moveDirection"></param>
        private void MoveListFamily(MoveDirection moveDirection)
        {
            int flag = Convert.ToInt16(moveDirection);

            if ((lstListFamiliesSelectedIndex - flag > -1) && (lstListFamiliesSelectedIndex - flag < listFamiliesDataTable.Rows.Count))
            {
                selectedListFamily.DisplayWeight -= flag;
                ListFamily listFamily = ListFamily.GetListFamilyById(listFamiliesDataTable.Rows[lstListFamiliesSelectedIndex - flag][ListFamily.FIELD_NAME_ID].ToString());
                listFamily.DisplayWeight += flag;

                ListFamily.UpdateListFamily(selectedListFamily);
                ListFamily.UpdateListFamily(listFamily);

                lstListFamiliesSelectedIndex -= flag;
                ReadListFamiles();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// lstListFamilies 的 SelectionChanged 事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lstListFamilies_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (lstListFamilies.SelectedIndex != -1)
            {
                if (selectedListFamily.SortType == SortType.Manual)
                {
                    UpdateListChildrenDisplayWeight();
                }

                DataRowView fd = lstListFamilies.SelectedItem as DataRowView;
                selectedListFamily                     = ListFamily.GetListFamilyById(fd[ListFamily.FIELD_NAME_ID].ToString());
                lstListFamiliesSelectedIndex           = lstListFamilies.SelectedIndex;
                listChildrenDisplayPart.SelectionIndex = 0;
                tbListFamilyName.Text                  = string.Format("{0}:", selectedListFamily.Title);

                ReadListChildren();
            }
        }