Files
UnrealEngineUWP/Engine/Source/Programs/UnrealVS/BatchBuilder.cs
Chris Wood 366df6c726 UnrealVS v1.30: various minor stability fixes
#ttp 331470 - UnrealVS: toolbar combos disabled

#branch UE4
#proj UnrealVS
#summary

#change Minor refactor of BatchBuilder class to avoid issues when starting UnrealVS and loading options before the batch builder window opens.
#change Improved tick thread startup and shutdown. It only runs when a solution is open. This allows it to shutdown cleaner when VS closes.
#change Allowed the batch builder busy state to block solution closing. This should be prevented by VS anyway as a build would be running.
#change Minor refactor of the way CommandLineEditor and the StartupProjectSelector enable/disable and update their combo controls.
#change Version to 1.30

[CL 2055350 by Chris Wood in Main branch]
2014-04-24 08:29:14 -04:00

92 lines
2.5 KiB
C#

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.Design;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
namespace UnrealVS
{
internal class BatchBuilder
{
/** constants */
private const int BatchBuilderToolWindowId = 0x1300;
/** properties */
public bool IsBusy
{
get
{
return ToolControl.IsBusy;
}
}
private static BatchBuilderToolControl _ToolControl;
public static BatchBuilderToolControl ToolControl
{
get
{
if (_ToolControl == null) _ToolControl = new BatchBuilderToolControl();
return _ToolControl;
}
}
/** methods */
public BatchBuilder()
{
// Create the command for the tool window
var ToolWindowCommandId = new CommandID(GuidList.UnrealVSCmdSet, BatchBuilderToolWindowId);
var ToolWindowMenuCommand = new MenuCommand(ShowToolWindow, ToolWindowCommandId);
UnrealVSPackage.Instance.MenuCommandService.AddCommand(ToolWindowMenuCommand);
}
/// <summary>
/// Called from the package class when there are options to be read out of the solution file.
/// </summary>
/// <param name="Stream">The stream to load the option data from.</param>
public void LoadOptions(Stream Stream)
{
ToolControl.LoadOptions(Stream);
}
/// <summary>
/// Called from the package class when there are options to be written to the solution file.
/// </summary>
/// <param name="Stream">The stream to save the option data to.</param>
public void SaveOptions(Stream Stream)
{
ToolControl.SaveOptions(Stream);
}
/// <summary>
/// Tick function called from the package
/// </summary>
public void Tick()
{
ToolControl.Tick();
}
private void ShowToolWindow(object sender, EventArgs e)
{
// Get the instance number 0 of this tool window. This window is single instance so this instance
// is actually the only one.
// The last flag is set to true so that if the tool window does not exists it will be created.
ToolWindowPane ToolWindow = UnrealVSPackage.Instance.FindToolWindow(typeof(BatchBuilderToolWindow), 0, true);
if ((null == ToolWindow) || (null == ToolWindow.Frame))
{
throw new NotSupportedException(Resources.ToolWindowCreateError);
}
IVsWindowFrame ToolWindowFrame = (IVsWindowFrame)ToolWindow.Frame;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(ToolWindowFrame.Show());
}
}
}