コード例 #1
0
        /// <summary>
        /// This function create the AddCharacterWindow and modify the database if needed (adding a character)
        /// </summary>
        public void OnFire()
        {
            //Show the window
            var w = new AddPlaceWindow(m_wd);

            w.ShowDialog();

            AddPlaceDatas datas = w.DataContext as AddPlaceDatas;

            //Commit the Dialog
            if (datas.PlaceAdded)
            {
                String key = datas.PlaceIconKey;
                m_wd.CommitDB.AddPlace(new Place {
                    Name = datas.Name, Icon = key, Story = datas.PlaceStory
                });
                if (datas.IconDefined)
                {
                    AddPlaceDatas data = (w.DataContext as AddPlaceDatas);
                    if (data.IconDefined)
                    {
                        using (FileStream fs = new FileStream(data.IconPath, FileMode.Open))
                            m_wd.AddResource(fs, key);
                    }
                }
            }
        }
コード例 #2
0
        void ButtonAddPlace_Click(object sender, RoutedEventArgs e)
        {
            AddPlaceWindow addPlaceWindow = new AddPlaceWindow(this);
            bool?          isAdded        = addPlaceWindow.ShowDialog();

            if (isAdded.HasValue && isAdded.Value)
            {
                UpdatePlaces();
                UpdateAttractions();
            }
        }