コード例 #1
0
        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)));
                }
            }
        }