Esempio n. 1
0
        private void Click_Load(object sender, RoutedEventArgs e)
        {
            System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
            if (button == null)
            {
                return;
            }

            FolderBrowserDialog fbd    = new FolderBrowserDialog();
            DialogResult        result = fbd.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string path = fbd.SelectedPath;

                if (button.CommandParameter.ToString() == "1")
                {
                    ArtSet1 = new ArtSet(path);
                    ArtSet1.Load();
                    NotifyPropertyChanged("ArtSet1");
                }
                else if (button.CommandParameter.ToString() == "2")
                {
                    ArtSet2 = new ArtSet(path);
                    ArtSet2.Load();
                    NotifyPropertyChanged("ArtSet2");
                }
            }
        }
Esempio n. 2
0
        private void MoveSelectedItems(IList sourceSelection, ArtSet destination, IList destinationSelection)
        {
            if (sourceSelection == null || destination == null || destinationSelection == null || destinationSelection.Count < 1)
            {
                return;
            }

            ArtAsset destAsset = destinationSelection[0] as ArtAsset;

            if (destAsset == null)
            {
                return;
            }

            int idx = destAsset.Index;

            if (idx < 0 || idx >= destination.Items.Count)
            {
                return;
            }

            foreach (ArtAsset asset in sourceSelection)
            {
                if (idx < destination.Items.Count)
                {
                    ArtAsset clone = asset.Clone() as ArtAsset;
                    if (clone != null)
                    {
                        clone.Index            = idx;
                        clone.ArtInstance      = destination.ArtInstance;
                        clone.TileDataInstance = destination.TileDataInstance;

                        if (ModifyTileData)
                        {
                            clone.ItemDatum = asset.ItemDatum;
                            clone.LandDatum = asset.LandDatum;
                        }
                        else
                        {
                            ArtAsset existingDestinationAsset = null;

                            if (m_displayItemData)
                            {
                                existingDestinationAsset = destination.Items[idx];
                            }
                            else
                            {
                                existingDestinationAsset = destination.Land[idx];
                            }

                            if (existingDestinationAsset != null)
                            {
                                clone.ItemDatum = existingDestinationAsset.ItemDatum;
                                clone.LandDatum = existingDestinationAsset.LandDatum;
                            }
                        }

                        if (m_displayItemData)
                        {
                            destination.Items.RemoveAt(idx);
                            destination.Items.Insert(idx, clone);
                        }
                        else
                        {
                            destination.Land.RemoveAt(idx);
                            destination.Land.Insert(idx, clone);
                        }
                        clone.Save();
                        idx++;
                    }
                }
            }
        }