private void Update_Click(object sender, RoutedEventArgs e) { CheckingForUpdatesWindow window = new CheckingForUpdatesWindow(); window.ShowDialog(); VersionResult versionResult = VersionHandler.Instance.VersionResult; if (versionResult.IsUpToDate.HasValue) { if (!versionResult.IsUpToDate.Value) { UpdateRecommendedWindow updateRecommendedWindow = new UpdateRecommendedWindow(); updateRecommendedWindow.ShowDialog(); } else { App.Instance.ShowMessage("Up to date", $"{App.ApplicationDisplayName} {App.LocalVersion} is up to date."); } } else { App.Instance.ShowError($"Error retrieving version number for '{App.ApplicationName}'", versionResult.Exception.Message, versionResult.Exception.InnerException); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { AudioAudioAssetTabControl = new AssetTabControl(BinaryFileType.Audio, AssetType.Audio, "Audio files (*.wav)|*.wav", "Audio"); CoreShadersAssetTabControl = new AssetTabControl(BinaryFileType.Core, AssetType.Shader, "Shader files (*.glsl)|*.glsl", "Shaders"); DdModelBindingsAssetTabControl = new AssetTabControl(BinaryFileType.Dd, AssetType.ModelBinding, "Model binding files (*.txt)|*.txt", "Model Bindings"); DdModelsAssetTabControl = new AssetTabControl(BinaryFileType.Dd, AssetType.Model, "Model files (*.obj)|*.obj", "Models"); DdShadersAssetTabControl = new AssetTabControl(BinaryFileType.Dd, AssetType.Shader, "Shader files (*.glsl)|*.glsl", "Shaders"); DdTexturesAssetTabControl = new AssetTabControl(BinaryFileType.Dd, AssetType.Texture, "Texture files (*.png)|*.png", "Textures"); ParticleParticlesAssetTabControl = new AssetTabControl(BinaryFileType.Particle, AssetType.Particle, "Particle files (*.bin)|*.bin", "Particles"); AssetTabControls = new List <AssetTabControl> { AudioAudioAssetTabControl, CoreShadersAssetTabControl, DdModelBindingsAssetTabControl, DdModelsAssetTabControl, DdShadersAssetTabControl, DdTexturesAssetTabControl, ParticleParticlesAssetTabControl }; UpdateTextBoxSizes(); TabControl.Items.Add(new TabItem { Header = "audio/Audio", Content = AudioAudioAssetTabControl }); TabControl.Items.Add(new TabItem { Header = "core/Shaders", Content = CoreShadersAssetTabControl }); TabControl.Items.Add(new TabItem { Header = "dd/Model Bindings", Content = DdModelBindingsAssetTabControl }); TabControl.Items.Add(new TabItem { Header = "dd/Models", Content = DdModelsAssetTabControl }); TabControl.Items.Add(new TabItem { Header = "dd/Shaders", Content = DdShadersAssetTabControl }); TabControl.Items.Add(new TabItem { Header = "dd/Textures", Content = DdTexturesAssetTabControl }); TabControl.Items.Add(new TabItem { Header = "particle/Particles", Content = ParticleParticlesAssetTabControl }); TabControl.SelectedIndex = Math.Clamp(UserHandler.Instance.Cache.ActiveTabIndex, 0, AssetTabControls.Count - 1); if (NetworkHandler.Instance.Tool != null && App.LocalVersion < Version.Parse(NetworkHandler.Instance.Tool.VersionNumber)) { UpdateRecommendedWindow updateRecommendedWindow = new UpdateRecommendedWindow(NetworkHandler.Instance.Tool.VersionNumber, App.LocalVersion.ToString(), App.ApplicationName, App.ApplicationDisplayName); updateRecommendedWindow.ShowDialog(); } // After the window has loaded, some user controls still need to finish loading, so set a timer to make sure everything has loaded. // TODO: Find a better way to do this. DispatcherTimer timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 10) }; timer.Tick += (sender, e) => { if (File.Exists(UserHandler.Instance.Cache.OpenedModFilePath)) { List <UserAsset> assets = ModFileUtils.GetAssetsFromModFilePath(UserHandler.Instance.Cache.OpenedModFilePath); if (assets.Count > 0) { foreach (AssetTabControl tabHandler in AssetTabControls) { tabHandler.UpdateAssetTabControls(assets); } } } timer.Stop(); }; timer.Start(); }