Пример #1
0
        // drag enter
        void dragEnter(object sender, DragEventArgs e)
        {
            Console.WriteLine("enter");
            var paths = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (paths != null && paths.Length == 1 && MinecraftWorld.IsValidWorld(paths[0]))
            {
                e.Effects = DragDropEffects.Copy;
                toggleDragDropGrid(true);
            }
            else
            {
                e.Effects = DragDropEffects.None;
                toggleDragDropGrid(false, true);
            }
        }
Пример #2
0
        async void addWorldClick(object sender, RoutedEventArgs e)
        {
            var ofd = new OpenFileDialog
            {
                Title  = Res.GetStr("selectZip"),
                Filter = Res.GetStr("zipFilter")
            };

            if (ofd.ShowDialog() ?? false)
            {
                if (MinecraftWorld.IsValidWorld(ofd.FileName))
                {
                    await reloadWorldsList(MinecraftWorld.ExtractWorldZip(ofd.FileName, server.Location));
                }
                else
                {
                    MessageBox.Show(Res.GetStr("invalidZip"), Res.GetStr("invalidWorld"),
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }