示例#1
0
        private async void ReloadFile()
        {
            BeginLoading($"Reloading: {mappingFilename}");
            while (openedForms.Count > 0)
            {
                openedForms[0].Close();
            }

            try
            {
                if (mapping != null)
                {
                    await Task.Run(() => mapping.Mapping.Reload());
                }
                else
                {
                    mapping = await Task.Run(() => new MappingViewModel(mappingFilename));
                }
            }
            catch (Exception e)
            {
                HandleMappingLoadingException(e, mappingFilename);
                EndLoading("Reloading failed.");
                return;
            }

            BuildMapping();
            EnableMappingActions(true);
            EndLoading($"Mapping reloaded in {mapping.Mapping.LoadTime} ms");
            tbSearch.AutoCompleteCustomSource = mapping.GetNewNamesCollection();
        }
示例#2
0
        private async Task OpenFile(string filename)
        {
            mappingFilename = filename;
            Text            = $"{APP_TITLE} - {PathUtils.GetFilename(filename)}";
            Configs.Instance.AddRecent(filename);

            BeginLoading($"Loading: {filename}");

            while (openedForms.Count > 0)
            {
                openedForms[0].Close();
            }

            try
            {
                mapping = await Task.Run(() => new MappingViewModel(filename));
            }
            catch (Exception e)
            {
                EnableMappingActions(false);
                commandManager.SetEnabled(Actions.ReloadFile, true);
                HandleMappingLoadingException(e, filename);
                EndLoading("Loading failed.");
                return;
            }

            BuildMapping();
            EnableMappingActions(true);
            EndLoading($"Mapping loaded in {mapping.Mapping.LoadTime} ms");

            AttachPDB(Configs.Instance.GetRecentPdb(mapping.Mapping.Filename), false);

            tbSearch.AutoCompleteCustomSource = mapping.GetNewNamesCollection();
        }