private async Task OpenTextureBrowser()
        {
            if (!_document.TryGetTarget(out var doc))
            {
                return;
            }

            using (var tb = new TextureBrowser(doc))
            {
                await tb.Initialise(_translation.Value);

                tb.SetTextureList(await GetTextureList(doc));
                tb.SetSelectedTextures(GetSelectedTextures());
                tb.ShowDialog();
                if (tb.SelectedTexture != null)
                {
                    _textBox.Text = tb.SelectedTexture;
                }
            }
        }
예제 #2
0
        public async Task Invoke(IContext context, CommandParameters parameters)
        {
            var md = context.Get <MapDocument>("ActiveDocument");

            if (md == null)
            {
                return;
            }
            using (var tb = new TextureBrowser(md))
            {
                await tb.Initialise(_translation.Value);

                if (tb.ShowDialog() == DialogResult.OK && !String.IsNullOrWhiteSpace(tb.SelectedTexture))
                {
                    var tex = tb.SelectedTexture;
                    var at  = new ActiveTexture {
                        Name = tex
                    };
                    MapDocumentOperation.Perform(md, new TrivialOperation(x => x.Map.Data.Replace(at), x => x.Update(at)));
                }
            }
        }
예제 #3
0
        private async void BrowseTexture(TextBox box)
        {
            var doc = GetDocument();

            if (doc == null)
            {
                return;
            }

            using (var tb = new TextureBrowser(doc))
            {
                await tb.Initialise(_translation.Value);

                if (await tb.ShowDialogAsync() != DialogResult.OK)
                {
                    return;
                }
                if (tb.SelectedTexture == null)
                {
                    return;
                }
                box.Text = tb.SelectedTexture;
            }
        }