Exemplo n.º 1
0
        //更新该条的参数
        private void  updateMaterial(object sender, RoutedEventArgs e)
        {
            if (!openDataBase)
            {
                MessageBox.Show("打开数据库失败!", "警告");
                return;
            }
            // 修改该条材料和新建材料使用同一个window
            NewMaterialWindow nmw         = new NewMaterialWindow();
            ListBoxItem       listBoxItem = (ListBoxItem)listBox.SelectedItem;

            if (listBoxItem == null)
            {
                return;
            }
            int index = Convert.ToInt32(listBoxItem.Tag);
            Dictionary <string, Dictionary <string, string> > currentChoosed = new Dictionary <string, Dictionary <string, string> >();

            foreach (KeyValuePair <string, Dictionary <string, string> > kvp in totalMaterials[index])
            {
                Dictionary <string, string> _dic = new Dictionary <string, string>();
                foreach (KeyValuePair <string, string> _kvp in kvp.Value)
                {
                    _dic.Add(_kvp.Key, _kvp.Value);
                }
                currentChoosed.Add(kvp.Key, _dic);
            }
            nmw.setPreUpdateMaterialData(1, currentChoosed, index);
            nmw.PassValuesEvent += new NewMaterialWindow.PassValuesHandler(receivedUpdateMaterial);
            nmw.Show();
        }
Exemplo n.º 2
0
        private void newMaterial(object sender, RoutedEventArgs e)
        {
            if (!openDataBase)
            {
                MessageBox.Show("打开数据库失败!", "警告");
                return;
            }
            NewMaterialWindow nmw = new NewMaterialWindow();

            nmw.setPreUpdateMaterialData(0, null, -1);
            nmw.PassValuesEvent += new NewMaterialWindow.PassValuesHandler(receivedNewMaterialWindowData);
            nmw.Show();
        }