/// <summary>Constructor that initializes the various resources that we use in rendering.</summary> /// <param name="parentWindow">Parent window that this renderer belongs to.</param> public ChromeTabRenderer(TitleBarTabMainForm parentWindow) : base(parentWindow) { // Initialize the various images to use during rendering _activeLeftSideImage = ResourceUtil.GetImage(Resources.ChromeLeftImage); _activeRightSideImage = ResourceUtil.GetImage(Resources.ChromeRightImage); _activeCenterImage = ResourceUtil.GetImage(Resources.ChromeCenterImage); _inactiveLeftSideImage = ResourceUtil.GetImage(Resources.ChromeInactiveLeftImage); _inactiveRightSideImage = ResourceUtil.GetImage(Resources.ChromeInactiveRightImage); _inactiveCenterImage = ResourceUtil.GetImage(Resources.ChromeInactiveCenterImage); _closeButtonImage = ResourceUtil.GetImage(Resources.ChromeCloseImage); _closeButtonHoverImage = ResourceUtil.GetImage(Resources.ChromeCloseHoverImage); _background = ResourceUtil.GetImage(Resources.ChromeBackgroundImage); _addButtonImage = new Bitmap(ResourceUtil.GetImage(Resources.ChromeAddImage)); _addButtonHoverImage = new Bitmap(ResourceUtil.GetImage(Resources.ChromeAddHoverImage)); // Set the various positioning properties CloseButtonMarginTop = 6; CloseButtonMarginLeft = 2; AddButtonMarginTop = 5; AddButtonMarginLeft = -3; CaptionMarginTop = 5; IconMarginTop = 6; IconMarginRight = 5; AddButtonMarginRight = 5; ShowAddButton = false; }
public Form1() { InitializeComponent(); Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)); LoadHierarchicalXmlData(); Width = 680; Height = 300; }
static void Main() { // important to call these before creating application host Application.EnableVisualStyles(); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); // Create a catalog with all the components that make up the application, except for // our MainForm. var catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(CommandService), // handles commands in menus and toolbars typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(StandardFileExitCommand), // standard File exit menu command typeof(HelpAboutCommand), // Help -> About command typeof(FolderViewer), // manages TreeControl to display folder hierarchy typeof(FileViewer), // managed ListView to display last selected folder contents typeof(NameDataExtension), // extension to display file name typeof(SizeDataExtension), // extension to display file size typeof(CreationTimeDataExtension), // extension to display file creation time typeof(UserFeedbackService), // component to send feedback form to SHIP typeof(VersionUpdateService), // component to update to latest version on SHIP typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService) // provides facilities to run an automated script using the .NET remoting service ); var container = new CompositionContainer(catalog); // manually add the MainForm var batch = new CompositionBatch(); var mainForm = new MainForm { Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; // our custom main Form with SplitContainer batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-File-Explorer-Sample".Localize())); container.Compose(batch); // initialize all components which require it container.InitializeAll(); Application.Run(mainForm); container.Dispose(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var mainForm = new Form1 { Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; Application.Run(mainForm); }
private static Image GetLockImage() { try { var image = ResourceUtil.GetImage(Atf.Resources.LockImage); return(image); } catch (Exception) { return(null); } }
/// <summary> /// Registers a command for a command client. /// NOTE: CommandInfo.MenuItem and CommandInfo.Button will not be valid. /// Shortcut related properties and methods on CommandInfo will have no effect.</summary> /// <param name="info">Command description; standard commands are defined as static /// members on the CommandInfo class</param> /// <param name="client">Client that handles the command</param> public void RegisterCommand(Sce.Atf.Applications.CommandInfo info, Sce.Atf.Applications.ICommandClient client) { // Embedded image resources will not be available as WPF app resources // If image resource does not exist we need to create it and add it to app resources object imageResourceKey = null; if (!string.IsNullOrEmpty(info.ImageName)) { var embeddedImage = ResourceUtil.GetImage(info.ImageName); if (embeddedImage == null) { throw new InvalidOperationException("Could not find embedded image: " + info.ImageName); } Util.GetOrCreateResourceForEmbeddedImage(embeddedImage); imageResourceKey = embeddedImage; } // Convert text and path string displayText = GetDisplayMenuText(info.MenuText); info.DisplayedMenuText = displayText; string[] menuPath = GetMenuPath(info.MenuText); // Convert shortcuts var inputGestures = new List <InputGesture>(); foreach (var formsKey in info.Shortcuts) { inputGestures.Add(Util.ConvertKey(formsKey)); } // Create and register command passing this as command client var def = new CommandDef( info.CommandTag, info.MenuTag, info.GroupTag, displayText, menuPath, info.Description, imageResourceKey, inputGestures.ToArray <InputGesture>(), info.Visibility); var clientAdapter = GetOrCreateClientAdapter(client); var command = m_commandService.RegisterCommand(def, clientAdapter); clientAdapter.AddCommand(command); }
private bool m_showen = false; // shown is called. public ToolMainForm() { InitializeComponent(); AeroPeekEnabled = true; TabRenderer = new ChromeTabRenderer(this); Text = "ToolMain".Localize(); Name = "ToolMain"; Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)); StartPosition = FormStartPosition.Manual; // so we can persist bounds m_mainFormBounds = Bounds; Sce.Atf.Direct2D.D2dFactory.EnableResourceSharing(this.Handle); }
void IInitializable.Initialize() { // Set the application icon. We need to convert the reource from // System.Drawing.Image to System.Windows.Media.ImageSource. System.Drawing.Image atfIcon = ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage); MemoryStream stream = new MemoryStream(); atfIcon.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = new MemoryStream(stream.ToArray()); bitmapImage.EndInit(); System.Windows.Application.Current.MainWindow.Icon = bitmapImage; if (m_scriptingService != null) { // load this assembly into script domain. m_scriptingService.LoadAssembly(typeof(WinGuiCommon.EditorBase).Assembly); m_scriptingService.ImportAllTypes("WinGuiCommon"); m_scriptingService.SetVariable("editor", this); m_contextRegistry.ActiveContextChanged += delegate { EditingContext editingContext = m_contextRegistry.GetActiveContext <EditingContext>(); IHistoryContext hist = m_contextRegistry.GetActiveContext <IHistoryContext>(); m_scriptingService.SetVariable("editingContext", editingContext); m_scriptingService.SetVariable("hist", hist); }; } if (m_controlHostService != null) { m_eventView.DataContext = m_eventViewModel; m_controlHostService.RegisterControl(new ControlDef { Name = "Event Viewer".Localize(), Description = "Viewer for event details".Localize(), Id = "wpfApp1", Group = StandardControlGroup.Bottom }, m_eventView, this); m_documentRegistry.ActiveDocumentChanged += ContextSelectionChanged; } }
static void CreateSharedMain() { // Create a type catalog with the types of components we want in the application TypeCatalog catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(FileDialogService), // standard Windows file dialogs typeof(ErrorDialogService) // displays errors to the user in a message box ); StandardEditCommands.UseSystemClipboard = true; CompositionContainer sharedContainer = new CompositionContainer(catalog); // Configure the main Form var batch = new CompositionBatch(); m_toolMainForm = new ToolMainForm() { Text = "Diagram Editor Main".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; // Add the main Form instance to the container batch.AddPart(m_toolMainForm); sharedContainer.Compose(batch); sharedContainer.InitializeAll(); m_SharedComponents.Add(sharedContainer.GetExportedValue <SettingsService>()); m_SharedComponents.Add(sharedContainer.GetExportedValue <UnhandledExceptionService>()); m_SharedComponents.Add(sharedContainer.GetExportedValue <IFileDialogService>()); m_SharedComponents.Add(sharedContainer.GetExportedValue <ErrorDialogService>()); m_SharedContainer = sharedContainer; }
void IInitializable.Initialize() { m_control.Initialize(); var controlHostService = SledServiceInstance.Get <IControlHostService>(); // Grab image var image = ResourceUtil.GetImage(Atf.Resources.UnsortedImage); // Rotate image image.RotateFlip(RotateFlipType.Rotate90FlipX); var controlInfo = new ControlInfo( m_control.Name, m_control.Name, StandardControlGroup.Bottom, image); // Show GUI controlHostService.RegisterControl( m_control, controlInfo, this); // Subscribe to events m_debugService = SledServiceInstance.Get <ISledDebugService>(); m_debugService.DataReady += DebugServiceDataReady; m_debugService.BreakpointContinue += DebugServiceBreakpointContinue; m_debugService.UpdateEnd += DebugServiceUpdateEnd; m_debugService.Disconnected += DebugServiceDisconnected; m_projectService.Get.Closed += ProjectServiceClosed; }
static void Main() { // important to call these before creating application host Application.EnableVisualStyles(); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); var catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(SettingsServiceCommands), // Setting service commands typeof(FileDialogService), // proivdes standard Windows file dialogs, to let the user open and close files. Used by SkinService. typeof(SkinService), // allows for customization of an application’s appearance by using inheritable properties that can be applied at run-time typeof(StatusService), // status bar at bottom of main Form typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(StandardFileExitCommand), // standard File exit menu command typeof(HelpAboutCommand), // Help -> About command typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(ContextRegistry), // component that tracks application contexts; needed for context menu // add target info plugins and TargetEnumerationService typeof(Deci4pTargetProvider), // provides information about development devices available via Deci4p typeof(TcpIpTargetProvider), // provides information about development devices available via TCP/IP typeof(TargetCommands), // commands to operate on currently selected targets. typeof(TargetEnumerationService) // queries and enumerates target objects, consuming target providers created by the application ); // Set up the MEF container with these components var container = new CompositionContainer(catalog); // Configure the main Form var batch = new CompositionBatch(); var mainForm = new MainForm(new ToolStripContainer()) { Text = "ATF TargetManager Sample".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; // Add the main Form instance to the container batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-Target-Manager-Sample".Localize())); container.Compose(batch); var controlHostService = container.GetExportedValue <ControlHostService>(); controlHostService.RegisteredCommands = ControlHostService.CommandRegister.None; // turn off standard window commands for simpele & single window UI // Initialize components that require it. Initialization often can't be done in the constructor, // or even after imports have been satisfied by MEF, since we allow circular dependencies between // components, via the System.Lazy class. IInitializable allows components to defer some operations // until all MEF composition has been completed. container.InitializeAll(); // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); }
static void Main(string[] args) { // important to call these before creating application host Application.EnableVisualStyles(); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); var catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(SettingsServiceCommands), // Setting service commands typeof(StatusService), // status bar at bottom of main Form typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(FileDialogService), // standard Windows file dialogs typeof(DocumentRegistry), // central document registry with change notification typeof(AutoDocumentService), // opens documents from last session, or creates a new document, on startup typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(MainWindowTitleService), // tracks document changes and updates main form title typeof(TabbedControlSelector), // enable ctrl-tab selection of documents and controls within the app typeof(ContextRegistry), // central context registry with change notification typeof(StandardFileExitCommand), // standard File exit menu command typeof(StandardEditCommands), // standard Edit menu commands for copy/paste typeof(StandardEditHistoryCommands), // standard Edit menu commands for undo/redo typeof(StandardSelectionCommands), // standard Edit menu selection commands //typeof(StandardLockCommands), // standard Edit menu lock/unlock commands typeof(HelpAboutCommand), // Help -> About command typeof(PaletteService), // global palette, for drag/drop instancing typeof(HistoryLister), // visual list of undo/redo stack typeof(PropertyEditor), // property grid for editing selected objects typeof(GridPropertyEditor), // grid control for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor, like Reset, // Reset All, Copy Value, Paste Value, Copy All, Paste All typeof(Outputs), // passes messages to all log writers typeof(ErrorDialogService), // displays errors to the user in a message box typeof(HelpAboutCommand), // custom command component to display Help/About dialog typeof(DefaultTabCommands), // provides the default commands related to document tab Controls typeof(Editor), // editor which manages event sequence documents typeof(DomTypes), // defines the DOM's metadata for this sample app typeof(PaletteClient), // component which adds items to palette typeof(EventListEditor), // adds drag/drop and context menu to event sequence ListViews typeof(ResourceListEditor), // adds "slave" resources ListView control, drag/drop and context menu typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService) // provides facilities to run an automated script using the .NET remoting service ); // Set up the MEF container with these components var container = new CompositionContainer(catalog); // Configure the main Form and add it to the composition container var batch = new CompositionBatch(); var toolStripContainer = new ToolStripContainer(); var mainForm = new MainForm(toolStripContainer) { Text = "Simple DOM, No XML, Editor Sample".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-Simple-DOM-No-XML-Editor-Sample".Localize())); // Compose the MEF container container.Compose(batch); // Initialize components that require it. Initialization often can't be done in the constructor, // or even after imports have been satisfied by MEF, since we allow circular dependencies between // components, via the System.Lazy class. IInitializable allows components to defer some operations // until all MEF composition has been completed. container.InitializeAll(); // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); }
static void Main() { // Important to call these before starting the app. Otherwise theming and bitmaps may not render correctly. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); // Using MEF, declare the composable parts that will make up this application TypeCatalog catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(ContextRegistry), // central context registry with change notification typeof(StandardFileExitCommand), // standard File exit menu command typeof(FileDialogService), // standard Windows file dialogs typeof(DocumentRegistry), // central document registry with change notification typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(AutoDocumentService), // opens documents from last session, or creates a new document, on startup typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(MainWindowTitleService), // tracks document changes and updates main form title typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(WindowLayoutService), // service to allow multiple window layouts typeof(WindowLayoutServiceCommands), // command layer to allow easy switching between and managing of window layouts // Client-specific plug-ins typeof(Editor), // editor class component that creates and saves application documents typeof(SchemaLoader), // loads schema and extends types typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService) // provides facilities to run an automated script using the .NET remoting service ); // Create the MEF container for the composable parts CompositionContainer container = new CompositionContainer(catalog); // Create the main form, give it a toolstrip ToolStripContainer toolStripContainer = new ToolStripContainer(); toolStripContainer.Dock = DockStyle.Fill; MainForm mainForm = new MainForm(toolStripContainer) { Text = "Sample Application".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; // Create an MEF composable part from the main form, and add into container CompositionBatch batch = new CompositionBatch(); AttributedModelServices.AddPart(batch, mainForm); container.Compose(batch); // Initialize components that require it. Initialization often can't be done in the constructor, // or even after imports have been satisfied by MEF, since we allow circular dependencies between // components, via the System.Lazy class. IInitializable allows components to defer some operations // until all MEF composition has been completed. container.InitializeAll(); // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); // Enable metadata driven property editing for the DOM DomNodeType.BaseOfAllTypes.AddAdapterCreator(new AdapterCreator <CustomTypeDescriptorNodeAdapter>()); // Create a type catalog with the types of components we want in the application var catalog = new TypeCatalog( typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(FileDialogService), typeof(SkinService), typeof(StandardFileExitCommand), // standard File exit menu command typeof(StandardEditHistoryCommands), // tracks document changes and updates main form title typeof(HelpAboutCommand), // Help -> About command typeof(ContextRegistry), // central context registry with change notification typeof(PropertyEditor), // property grid for editing selected objects typeof(GridPropertyEditor), // grid control for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor typeof(SettingsService), typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService), // provides facilities to run an automated script using the .NET remoting service typeof(SchemaLoader), // component that loads XML schema and sets up types typeof(Editor) // component that manages UI documents ); // Set up the MEF container with these components var container = new CompositionContainer(catalog); // Configure the main Form // Configure the main Form with a ToolStripContainer so the CommandService can // generate toolbars. var toolStripContainer = new ToolStripContainer(); toolStripContainer.Dock = DockStyle.Fill; var mainForm = new MainForm(toolStripContainer) { Text = "DOM Property Editor".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; // Add the main Form instance to the container var batch = new CompositionBatch(); batch.AddPart(mainForm); // batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-DOM-Tree-Editor-Sample".Localize())); container.Compose(batch); // Initialize components that require it. Initialization often can't be done in the constructor, // or even after imports have been satisfied by MEF, since we allow circular dependencies between // components, via the System.Lazy class. IInitializable allows components to defer some operations // until all MEF composition has been completed. container.InitializeAll(); var propEditor = container.GetExportedValue <PropertyEditor>(); propEditor.PropertyGrid.PropertySorting = Sce.Atf.Controls.PropertyEditing.PropertySorting.Categorized; // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); }
static void Main() { //// important to call these before creating application host //Application.EnableVisualStyles(); //Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 //// Set up localization support early on, so that user-readable strings will be localized //// during the initialization phase below. Use XML files that are embedded resources. //Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; //Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); //// Enable metadata driven property editing for the DOM //DomNodeType.BaseOfAllTypes.AddAdapterCreator(new AdapterCreator<CustomTypeDescriptorNodeAdapter>()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); // Enable metadata driven property editing for the DOM DomNodeType.BaseOfAllTypes.AddAdapterCreator(new AdapterCreator <CustomTypeDescriptorNodeAdapter>()); using ( var catalog = new TypeCatalog( /* Standard ATF stuff */ typeof(SettingsService), // persistent settings and user preferences dialog typeof(StatusService), // status bar at bottom of main Form typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(WindowLayoutService), // multiple window layout support typeof(WindowLayoutServiceCommands), // window layout commands typeof(OutputService), // rich text box for displaying error and warning messages. Implements IOutputWriter. typeof(Outputs), // passes messages to all log writers typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(DocumentRegistry), // central document registry with change notification typeof(FileDialogService), // standard Windows file dialogs typeof(AutoDocumentService), // opens documents from last session, or creates a new document, on startup typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(StandardFileExitCommand), // standard File exit menu command typeof(TabbedControlSelector), // enable ctrl-tab selection of documents and controls within the app typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(ContextRegistry), // central context registry with change notification typeof(StandardEditCommands), // standard Edit menu commands for copy/paste typeof(StandardEditHistoryCommands), // standard Edit menu commands for undo/redo typeof(StandardSelectionCommands), // standard Edit menu selection commands typeof(PaletteService), // global palette, for drag/drop instancing typeof(PropertyEditor), // property grid for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor, like Reset, typeof(SchemaLoader), typeof(PaletteClient), // component which adds items to palette typeof(Editor) // tree list view editor component )) { using (var container = new CompositionContainer(catalog)) { var toolStripContainer = new ToolStripContainer(); toolStripContainer.Dock = DockStyle.Fill; using (var mainForm = new MainForm(toolStripContainer)) { mainForm.Text = "SceneEditor".Localize(); mainForm.Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)); var batch = new CompositionBatch(); batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-Tree-List-Editor-Sample".Localize())); container.Compose(batch); container.InitializeAll(); //// Set the switch level for the Atf TraceSource instance so everything is traced. //Outputs.TraceSource.Switch.Level = SourceLevels.All; //// a very verbose data display that includes callstacks //Outputs.TraceSource.Listeners["Default"].TraceOutputOptions = // TraceOptions.Callstack | TraceOptions.DateTime | // TraceOptions.ProcessId | TraceOptions.ThreadId | // TraceOptions.Timestamp; Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); } } } }
static void Main() { // It's important to call these before starting the app; otherwise theming and bitmaps // may not render correctly. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); // Register the embedded image resources so that they will be available for all users of ResourceUtil, // such as the PaletteService. ResourceUtil.Register(typeof(Resources)); // Enable metadata driven property editing for the DOM DomNodeType.BaseOfAllTypes.AddAdapterCreator(new AdapterCreator <CustomTypeDescriptorNodeAdapter>()); // Create a type catalog with the types of components we want in the application var catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(StatusService), // status bar at bottom of main Form typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(WindowLayoutService), // multiple window layout support typeof(WindowLayoutServiceCommands), // window layout commands typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(SkinService), typeof(DocumentRegistry), // central document registry with change notification typeof(FileDialogService), // standard Windows file dialogs typeof(AutoDocumentService), // opens documents from last session, or creates a new document, on startup typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(StandardFileExitCommand), // standard File exit menu command typeof(TabbedControlSelector), // enable ctrl-tab selection of documents and controls within the app typeof(MainWindowTitleService), // tracks document changes and updates main form title typeof(HelpAboutCommand), // Help -> About command typeof(ContextRegistry), // central context registry with change notification typeof(StandardEditCommands), // standard Edit menu commands for copy/paste typeof(StandardEditHistoryCommands), // standard Edit menu commands for undo/redo typeof(StandardSelectionCommands), // standard Edit menu selection commands typeof(PaletteService), // global palette, for drag/drop instancing typeof(HistoryLister), // visual list of undo/redo stack typeof(PropertyEditor), // property grid for editing selected objects typeof(GridPropertyEditor), // grid control for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor, like Reset, // Reset All, Copy Value, Paste Value, Copy All, Paste All typeof(CurveEditor), // edits curves using the CurveEditingControl typeof(SchemaLoader), // component that loads XML schema and sets up types typeof(Editor), // component that manages UI documents typeof(PaletteClient), // component that adds UI types to palette typeof(TreeLister), // component that displays the UI in a tree control typeof(DefaultTabCommands), // provides the default commands related to document tab Controls typeof(DomExplorer), // component that gives diagnostic view of DOM typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService) // provides facilities to run an automated script using the .NET remoting service ); // Set up the MEF container with these components var container = new CompositionContainer(catalog); // Configure the main Form with a ToolStripContainer so the CommandService can // generate toolbars. var toolStripContainer = new ToolStripContainer(); toolStripContainer.Dock = DockStyle.Fill; var mainForm = new MainForm(toolStripContainer) { Text = "Dom Tree Editor".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; // Add the main Form instance to the container var batch = new CompositionBatch(); batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-DOM-Tree-Editor-Sample".Localize())); container.Compose(batch); // Initialize components that require it. Initialization often can't be done in the constructor, // or even after imports have been satisfied by MEF, since we allow circular dependencies between // components, via the System.Lazy class. IInitializable allows components to defer some operations // until all MEF composition has been completed. container.InitializeAll(); // Example of programmatic layout creation: { var windowLayoutService = container.GetExportedValue <IWindowLayoutService>(); var dockStateProvider = container.GetExportedValue <IDockStateProvider>(); // Load custom XML and add it to the Window Layout Service int layoutNum = 0; Assembly assembly = Assembly.GetExecutingAssembly(); foreach (string resourceName in assembly.GetManifestResourceNames()) { if (resourceName.Contains("Layout") && resourceName.EndsWith(".xml")) { var xmlDoc = new XmlDocument(); xmlDoc.Load(assembly.GetManifestResourceStream(resourceName)); layoutNum++; windowLayoutService.SetOrAddLayout(dockStateProvider, "Programmatic Layout " + layoutNum, xmlDoc.InnerXml); } } } // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); // Enable metadata driven property editing for the DOM DomNodeType.BaseOfAllTypes.AddAdapterCreator(new AdapterCreator <CustomTypeDescriptorNodeAdapter>()); // Create a type catalog with the types of components we want in the application var catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(StatusService), // status bar at bottom of main Form typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(FileDialogService), // standard Windows file dialogs typeof(DocumentRegistry), // central document registry with change notification typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(MainWindowTitleService), // tracks document changes and updates main form title typeof(StandardFileExitCommand), // standard File exit menu command typeof(HelpAboutCommand), // Help -> About command typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService), // provides facilities to run an automated script using the .NET remoting service typeof(Outputs), // passes messages to all IOutputWriter components typeof(ShoutOutputService), // rich text box for displaying error and warning messages. Implements IOutputWriter typeof(Sce.Atf.Atgi.AtgiResolver), // loads ATGI resources from a file typeof(Sce.Atf.Collada.ColladaResolver), // loads Collada resources from a file // this sample typeof(ModelViewer), // recognizes model file extensions and uses the above model resolvers to load models typeof(RenderCommands), // provides commands for switching the RenderView's rendering mode, etc. typeof(RenderView) // displays a 3D scene in a Windows Control ); // Set up the MEF container with these components var container = new CompositionContainer(catalog); // Configure the main Form var batch = new CompositionBatch(); var mainForm = new MainForm(new ToolStripContainer()) { Text = "Model Viewer".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; // Add the main Form instance to the container batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-Model-Viewer-Sample".Localize())); container.Compose(batch); var stdfile = container.GetExportedValue <StandardFileCommands>(); stdfile.RegisterCommands = StandardFileCommands.CommandRegister.FileOpen; // Initialize components foreach (IInitializable initializable in container.GetExportedValues <IInitializable>()) { initializable.Initialize(); } // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); }
static void Main() { // important to call these before creating application host Application.EnableVisualStyles(); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); using ( var catalog = new TypeCatalog( /* Standard ATF stuff */ typeof(SettingsService), // persistent settings and user preferences dialog typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(WindowLayoutService), // multiple window layout support typeof(WindowLayoutServiceCommands), // window layout commands typeof(OutputService), // rich text box for displaying error and warning messages. Implements IOutputWriter. typeof(Outputs), // passes messages to all log writers typeof(StandardFileExitCommand), // standard File exit menu command typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(UserFeedbackService), // displaying a dialog box that allows the user to submit a bug report to SHIP typeof(VersionUpdateService), // updates to latest version on SHIP typeof(ContextRegistry), // central context registry with change notification typeof(PropertyEditor), // property grid for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor, like Reset, // Reset All, Copy Value, Paste Value, Copy All, Paste All /* Different styles of TreeListView */ typeof(List), // list view editor component typeof(CheckedList), // checked list view editor component typeof(VirtualList), // virtual list view editor component typeof(TreeList), // tree list view editor component typeof(CheckedTreeList), // checked tree list view editor component /* Use the TreeListView as a normal Control */ typeof(RawTreeListView), // tree list view editor for hierarchical file system component typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService) // provides facilities to run an automated script using the .NET remoting service )) { using (var container = new CompositionContainer(catalog)) { using (var mainForm = new MainForm()) { mainForm.Text = "TreeListView Sample".Localize(); mainForm.Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)); var batch = new CompositionBatch(); batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-Tree-List-Editor-Sample".Localize())); container.Compose(batch); container.InitializeAll(); // Set the switch level for the Atf TraceSource instance so everything is traced. Outputs.TraceSource.Switch.Level = SourceLevels.All; // a very verbose data display that includes callstacks Outputs.TraceSource.Listeners["Default"].TraceOutputOptions = TraceOptions.Callstack | TraceOptions.DateTime | TraceOptions.ProcessId | TraceOptions.ThreadId | TraceOptions.Timestamp; Application.Run(mainForm); } } } }
static void AddTool1() { // Create a type catalog with the types of components we want in the application TypeCatalog catalog = new TypeCatalog( typeof(SettingsServiceCommands), // Setting service commands typeof(StatusService), // status bar at bottom of main Form typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(WindowLayoutService), // multiple window layout support typeof(WindowLayoutServiceCommands), // window layout commands typeof(DocumentRegistry), // central document registry with change notification typeof(AutoDocumentService), // opens documents from last session, or creates a new document, on startup typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(MainWindowTitleService), // tracks document changes and updates main form title typeof(TabbedControlSelector), // enable ctrl-tab selection of documents and controls within the app typeof(ContextRegistry), // central context registry with change notification typeof(StandardFileExitCommand), // standard File exit menu command typeof(StandardEditCommands), // standard Edit menu commands for copy/paste typeof(StandardEditHistoryCommands), // standard Edit menu commands for undo/redo typeof(StandardSelectionCommands), // standard Edit menu selection commands typeof(StandardLayoutCommands), // standard Format menu layout commands typeof(StandardViewCommands), // standard View menu commands //StandardPrintCommands does not currently work with Direct2D //typeof(StandardPrintCommands), // standard File menu print commands typeof(PaletteService), // global palette, for drag/drop instancing typeof(PropertyEditor), // property grid for editing selected objects typeof(GridPropertyEditor), // grid control for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor, like Reset, // Reset All, Copy Value, Paste Value, Copy All, Paste All typeof(HistoryLister), // visual list of undo/redo stack typeof(PrototypeLister), // editable palette of instantiable item groups typeof(LayerLister), // editable tree view of layers typeof(Outputs), // passes messages to all log writers typeof(DiagramTheme), // rendering theme for diagrams typeof(DefaultTabCommands), // provides the default commands related to document tab Controls // Editors typeof(StatechartEditorSample.Editor), // sample statechart editor typeof(StatechartEditorSample.SchemaLoader), // loads statechart schema and extends types typeof(StatechartEditorSample.PaletteClient), // component which adds palette items typeof(PythonService), // scripting service for automated tests typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AutomationService) // provides facilities to run an automated script using the .NET remoting service ); // Configure the main Form var mainForm = new MainForm(new ToolStripContainer()) { Text = "State Chart Editor".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; var batchObjects = m_SharedComponents != null ? new List <object>(m_SharedComponents) : new List <object>(); batchObjects.Add(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-Diagram-Editor-Sample".Localize())); mainForm.InitializeComposition(catalog, batchObjects); //InitializeScriptingVariables(mainForm.ComponentContainer); // Add to tab m_toolMainForm.Tabs.Add(new Sce.Atf.Gui.TitleBarTab.TitleBarTabItem(m_toolMainForm) { Content = mainForm, }); }
static void Main() { // important to call these before creating application host Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 #if true // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); var catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(StatusService), // status bar at bottom of main Form typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(WindowLayoutService), // multiple window layout support typeof(WindowLayoutServiceCommands), // window layout commands typeof(FileDialogService), // standard Windows file dialogs typeof(AutoDocumentService), // opens documents from last session, or creates a new document, on startup typeof(Outputs), // service that provides static methods for writing to IOutputWriter objects. typeof(OutputService), // rich text box for displaying error and warning messages. Implements IOutputWriter. typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(StandardFileExitCommand), // standard File exit menu command typeof(StandardEditCommands), // standard Edit menu commands for copy/paste typeof(StandardEditHistoryCommands), // standard Edit menu commands for undo/redo typeof(StandardSelectionCommands), // standard Edit menu selection commands typeof(HelpAboutCommand), // Help -> About command typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(ContextRegistry), // central context registry with change notification typeof(DocumentRegistry), // central document registry with change notification typeof(MainWindowTitleService), // tracks document changes and updates main form title typeof(TabbedControlSelector), // enable ctrl-tab selection of documents and controls within the app typeof(DefaultTabCommands), // provides the default commands related to document tab Controls typeof(PropertyEditor), // property grid for editing selected objects //typeof(GridPropertyEditor), // grid control for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor, like Reset, // Reset All, Copy Value, Paste Value, Copy All, Paste All typeof(Editor), // code editor component typeof(SchemaLoader), // loads schema and extends types typeof(CharacterEditor), typeof(CharacterSettingsCommands) ); // Set up the MEF container with these components var container = new CompositionContainer(catalog); var toolStripContainer = new ToolStripContainer(); toolStripContainer.Dock = DockStyle.Fill; var mainForm = new MainForm(toolStripContainer); mainForm.Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)); mainForm.Text = "Butterfly Engine".Localize(); var batch = new CompositionBatch(); batch.AddPart(mainForm); container.Compose(batch); // To make the tab commands (e.g., "Copy Full Path", "Open Containing Folder") available, we have to change // the default behavior to work with this sample app's unusual Editor. In most cases, an editor like this // would implement IDocumentClient and this customization of DefaultTabCommands wouldn't be necessary. var tabCommands = container.GetExportedValue <DefaultTabCommands>(); tabCommands.IsDocumentControl = controlInfo => controlInfo.Client is Editor; // Initialize components that require it. Initialization often can't be done in the constructor, // or even after imports have been satisfied by MEF, since we allow circular dependencies between // components, via the System.Lazy class. IInitializable allows components to defer some operations // until all MEF composition has been completed. container.InitializeAll(); // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); #else var mainForm = new FormTest { Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; Application.Run(mainForm); #endif }
static void Main() { // It's important to call these before starting the app; otherwise theming and bitmaps // may not render correctly. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); // Register the embedded image resources so that they will be available for all users of ResourceUtil, // such as the PaletteService. ResourceUtil.Register(typeof(Resources)); // enable metadata driven property editing DomNodeType.BaseOfAllTypes.AddAdapterCreator(new AdapterCreator <CustomTypeDescriptorNodeAdapter>()); var catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(StatusService), // status bar at bottom of main Form typeof(LiveConnectService), // allows easy interop between apps on same router subnet typeof(Outputs), // passes messages to all IOutputWriter components typeof(OutputService), // rich text box for displaying error and warning messages. Implements IOutputWriter typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(AtfUsageLogger), // logs computer info to an ATF server typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(FileDialogService), // standard Windows file dialogs typeof(DocumentRegistry), // central document registry with change notification typeof(AutoDocumentService), // opens documents from last session, or creates a new document, on startup typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(StandardFileExitCommand), // standard File exit menu command typeof(MainWindowTitleService), // tracks document changes and updates main form title typeof(TabbedControlSelector), // enable ctrl-tab selection of documents and controls within the app typeof(ContextRegistry), // central context registry with change notification typeof(StandardEditCommands), // standard Edit menu commands for copy/paste typeof(StandardEditHistoryCommands), // standard Edit menu commands for undo/redo typeof(StandardSelectionCommands), // standard Edit menu selection commands typeof(RenameCommand), // allows for renaming of multiple selected objects //StandardPrintCommands does not currently work with Direct2D //typeof(StandardPrintCommands), // standard File menu print commands typeof(PaletteService), // global palette, for drag/drop instancing typeof(HistoryLister), // visual list of undo/redo stack typeof(PropertyEditor), // property grid for editing selected objects typeof(GridPropertyEditor), // grid control for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor, like Reset, // Reset All, Copy Value, Paste Value, Copy All, Paste All typeof(PerformanceMonitor), // displays the frame rate and memory usage typeof(FileWatcherService), // service to watch for changes to files typeof(DefaultTabCommands), // provides the default commands related to document tab Controls typeof(SkinService), // allows for customization of an application’s appearance by using inheritable properties that can be applied at run-time // Client-specific plug-ins typeof(TimelineEditor), // timeline editor component typeof(TimelineCommands), // defines Timeline-specific commands typeof(HelpAboutCommand), // Help -> About command // Testing related typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService) // provides facilities to run an automated script using the .NET remoting service ); var container = new CompositionContainer(catalog); var toolStripContainer = new ToolStripContainer(); toolStripContainer.Dock = DockStyle.Fill; var mainForm = new MainForm(toolStripContainer) { Text = "Timeline Editor Sample".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; var batch = new CompositionBatch(); batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-Timeline-Editor-Sample".Localize())); container.Compose(batch); // Initialize components that require it. Initialization often can't be done in the constructor, // or even after imports have been satisfied by MEF, since we allow circular dependencies between // components, via the System.Lazy class. IInitializable allows components to defer some operations // until all MEF composition has been completed. container.InitializeAll(); // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); container.Dispose(); }
protected override void OnNodeSet() { base.OnNodeSet(); m_missingElementType = new MissingElementType(MissingTypeName); m_missingElementType.Image = ResourceUtil.GetImage(Sce.Atf.Resources.PackageErrorImage); }
private void Init() { if (s_schemaLoader == null) { s_schemaLoader = new SchemaLoader(); } m_PropertyGrid = new PropertyGrid(PropertyGridMode.PropertySorting | PropertyGridMode.DisplayDescriptions | PropertyGridMode.HideResetAllButton); m_treeControl = new TreeControl(); m_menu = new MenuStrip(); var fileMenu = new ToolStripMenuItem(); var newMenu = new ToolStripMenuItem(); var openMenu = new ToolStripMenuItem(); var exitMenu = new ToolStripMenuItem(); var splitter = new SplitContainer(); m_menu.SuspendLayout(); splitter.BeginInit(); splitter.Panel1.SuspendLayout(); splitter.Panel2.SuspendLayout(); splitter.SuspendLayout(); SuspendLayout(); // m_menu m_menu.Location = new System.Drawing.Point(0, 0); m_menu.Name = "m_menu"; m_menu.TabIndex = 0; m_menu.Text = "m_menu"; m_menu.Items.Add(fileMenu); // file fileMenu.Name = "fileToolStripMenuItem"; fileMenu.Size = new System.Drawing.Size(37, 20); fileMenu.Text = "File".Localize(); fileMenu.DropDownOpening += new EventHandler(fileMenu_DropDownOpening); fileMenu.DropDownItems.AddRange(new ToolStripItem[] { newMenu, openMenu, m_openFolderMenu, m_saveMenu, m_saveAsMenu, exitMenu }); // new newMenu.Name = "newToolStripMenuItem"; newMenu.ShortcutKeys = Keys.Control | Keys.N; newMenu.Text = "New".Localize(); newMenu.Click += NewToolStripMenuItem_Click; //open openMenu.Name = "openToolStripMenuItem"; openMenu.ShortcutKeys = Keys.Control | Keys.O; openMenu.Text = "Open...".Localize(); openMenu.Click += OpenToolStripMenuItem_Click; // open containing folder m_openFolderMenu.Name = "OpenFolderMenu"; m_openFolderMenu.Text = "Open Containing Folder".Localize(); m_openFolderMenu.Click += new EventHandler(OpenFolderMenu_Click); //save m_saveMenu.Name = "saveToolStripMenuItem"; m_saveMenu.ShortcutKeys = Keys.Control | Keys.S; m_saveMenu.Text = "Save".Localize(); m_saveMenu.Click += SaveToolStripMenuItem_Click; // save as m_saveAsMenu.Name = "saveAsToolStripMenuItem"; m_saveAsMenu.Text = "Save As...".Localize(); m_saveAsMenu.Click += SaveAsToolStripMenuItem_Click; // exit exitMenu.Name = "exitToolStripMenuItem"; exitMenu.Text = "Exit".Localize(); exitMenu.Click += ExitToolStripMenuItem_Click; // tree control m_treeControl.Dock = DockStyle.Fill; m_treeControl.Name = "m_treeControl"; m_treeControl.TabIndex = 1; m_treeControl.Width = 150; m_treeControl.ShowRoot = false; m_treeControl.AllowDrop = false; m_treeControl.SelectionMode = SelectionMode.One; m_treeControlAdapter = new TreeControlAdapter(m_treeControl); // propertyGrid1 m_PropertyGrid.Dock = DockStyle.Fill; m_PropertyGrid.Name = "propertyGrid1"; m_PropertyGrid.TabIndex = 3; m_PropertyGrid.PropertySorting = PropertySorting.None; // splitter splitter.Dock = DockStyle.Fill; splitter.Name = "splitContainer1"; splitter.Panel1.Controls.Add(m_treeControl); splitter.Panel2.Controls.Add(m_PropertyGrid); splitter.SplitterDistance = 100; splitter.TabIndex = 1; AutoScaleMode = AutoScaleMode.Font; ClientSize = new System.Drawing.Size(600, 400); Controls.Add(splitter); Controls.Add(m_menu); MainMenuStrip = m_menu; Name = "SkinEditor"; Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)); UpdateTitleText(); m_menu.ResumeLayout(false); m_menu.PerformLayout(); splitter.Panel1.ResumeLayout(false); splitter.Panel2.ResumeLayout(false); splitter.EndInit(); splitter.ResumeLayout(false); ResumeLayout(false); PerformLayout(); splitter.SplitterDistance = 170; }
static void Main() { // It's important to call these before starting the app; otherwise theming and bitmaps // may not render correctly. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); // see http://www.codeproject.com/buglist/EnableVisualStylesBug.asp?df=100&forumid=25268&exp=0&select=984714 // Set up localization support early on, so that user-readable strings will be localized // during the initialization phase below. Use XML files that are embedded resources. Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture; Localizer.SetStringLocalizer(new EmbeddedResourceStringLocalizer()); // Enable metadata driven property editing for the DOM DomNodeType.BaseOfAllTypes.AddAdapterCreator(new AdapterCreator <CustomTypeDescriptorNodeAdapter>()); // Create a type catalog with the types of components we want in the application var catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(SettingsServiceCommands), // Setting service commands typeof(StatusService), // status bar at bottom of main Form typeof(CommandService), // handles commands in menus and toolbars typeof(ControlHostService), // docking control host typeof(WindowLayoutService), // multiple window layout support typeof(WindowLayoutServiceCommands), // window layout commands //typeof(AtfUsageLogger), // logs computer info to an ATF server //typeof(CrashLogger), // logs unhandled exceptions to an ATF server typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(FileDialogService), // standard Windows file dialogs typeof(DocumentRegistry), // central document registry with change notification //typeof(AutoDocumentService), // opens documents from last session, or creates a new document, on startup typeof(RecentDocumentCommands), // standard recent document commands in File menu typeof(StandardFileCommands), // standard File menu commands for New, Open, Save, SaveAs, Close typeof(MainWindowTitleService), // tracks document changes and updates main form title typeof(TabbedControlSelector), // enable ctrl-tab selection of documents and controls within the app typeof(HelpAboutCommand), // Help -> About command typeof(ContextRegistry), // central context registry with change notification typeof(StandardFileExitCommand), // standard File exit menu command typeof(StandardEditCommands), // standard Edit menu commands for copy/paste typeof(StandardEditHistoryCommands), // standard Edit menu commands for undo/redo typeof(StandardSelectionCommands), // standard Edit menu selection commands typeof(StandardLayoutCommands), // standard Format menu layout commands typeof(StandardViewCommands), // standard View menu commands //StandardPrintCommands does not currently work with Direct2D //typeof(StandardPrintCommands), // standard File menu print commands typeof(PaletteService), // global palette, for drag/drop instancing typeof(MyPropertyEditor), // property grid for editing selected objects; uses tooltips to show property descriptions //typeof(GridPropertyEditor), // grid control for editing selected objects typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor, like Reset, typeof(DomNodeRefDictionary), // Reference dictionary typeof(HistoryLister), // visual list of undo/redo stack typeof(PrototypeLister), // editable palette of instantiable item groups typeof(LayerLister), // editable tree view of layers typeof(Outputs), // passes messages to all log writers // typeof(ErrorDialogService), // displays errors to the user in a message box typeof(OutputService), // rich text box for displaying error and warning messages. Implements IOutputWriter. typeof(DomRecorder), // records and displays changes to the DOM for diagnostic purposes typeof(VisualScriptEditor), // editor which manages circuit documents and controls typeof(VisualScriptTypeManager), // loads circuit schema and extends types typeof(GroupingCommands), // circuit group/ungroup commands typeof(CircuitControlRegistry), // circuit controls management typeof(LayeringCommands), // "Add Layer" command typeof(GraphViewCommands), // zooming with presets //typeof(PerformanceMonitor), // displays the frame rate and memory usage typeof(DefaultTabCommands), // provides the default commands related to document tab Controls typeof(ScriptNodeDefinitionManager), // component that defines circuit module types typeof(TemplateLister), // template library for subgraph referencing or instancing typeof(TemplatingCommands), // commands for promoting/demoting graph elements to/from template library //typeof(TemplatingSupervisor), // templated instances copy-on-edit support(optionally) typeof(AnnotatingCommands), // annotating commands typeof(DynamicPropertyCommands), // context commands for user-defined properties in the property editors typeof(ExpressionCommands), // typeof(PythonService), // scripting service for automated tests typeof(ScriptConsole), // provides a dockable command console for entering Python commands typeof(AtfScriptVariables), // exposes common ATF services as script variables typeof(AutomationService) // provides facilities to run an automated script using the .NET remoting service ); // enable use of the system clipboard StandardEditCommands.UseSystemClipboard = true; // Set up the MEF container with these components var container = new CompositionContainer(catalog); // Configure the main Form var batch = new CompositionBatch(); var mainForm = new MainForm(new ToolStripContainer()) { Text = Application.ProductName, Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; Sce.Atf.Direct2D.D2dFactory.EnableResourceSharing(mainForm.Handle); // Add the main Form instance, etc., to the container batch.AddPart(mainForm); batch.AddPart(new WebHelpCommands("https://github.com/SonyWWS/ATF/wiki/ATF-Circuit-Editor-Sample".Localize())); container.Compose(batch); // Add a customized category comparer to the object palette. var paletteService = container.GetExportedValue <PaletteService>(); paletteService.CategoryComparer = new CategoryComparer(); // Initialize components that require it. Initialization often can't be done in the constructor, // or even after imports have been satisfied by MEF, since we allow circular dependencies between // components, via the System.Lazy class. IInitializable allows components to defer some operations // until all MEF composition has been completed. container.InitializeAll(); // Show the main form and start message handling. The main Form Load event provides a final chance // for components to perform initialization and configuration. Application.Run(mainForm); // Give components a chance to clean up. container.Dispose(); }
public ToolStripMenuItem tsmiUpdateSteamCache; // update Steam Cache public LoadOrderWindowMenuStrip() { tsmiFile = new ToolStripMenuItem(); tsmiReloadUGC = new ToolStripMenuItem(); tsmiSave = new ToolStripMenuItem(); tsmiAutoSave = new ToolStripMenuItem(); tsmiExport = new ToolStripMenuItem(); tsmiImport = new ToolStripMenuItem(); tsmiOrder = new ToolStripMenuItem();// no need to move if ensuring move the directory for us. tsmiResetOrder = new ToolStripMenuItem(); tsmiHarmonyOrder = new ToolStripMenuItem(); tsmiReverseOrder = new ToolStripMenuItem(); tsmiRandomOrder = new ToolStripMenuItem(); tsmiHelp = new ToolStripMenuItem(); tsmiWiki = new ToolStripMenuItem(); tsmiDiscordSupport = new ToolStripMenuItem(); tsmiOpenLogLocation = new ToolStripMenuItem(); toolStripSeparator1 = new ToolStripSeparator(); tsmiAbout = new ToolStripMenuItem(); tsmiTools = new ToolStripMenuItem(); tsmiMassSubscribe = new ToolStripMenuItem(); tsmiAdvanced = new ToolStripMenuItem(); tsmiReDownload = new ToolStripMenuItem(); tsmiResetAllSettings = new ToolStripMenuItem(); tsmiReloadUGC = new ToolStripMenuItem(); tsmiReloadSettings = new ToolStripMenuItem(); tsmiUpdateSteamCache = new ToolStripMenuItem(); tsmiResetCache = new ToolStripMenuItem(); tsmiResetAllSettings = new ToolStripMenuItem(); Items.AddRange(new ToolStripItem[] { tsmiFile, tsmiOrder, tsmiTools, tsmiHelp }); this.ShowItemToolTips = true; // // tsmiFile // tsmiFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { tsmiReloadSettings, tsmiSave, tsmiAutoSave, new ToolStripSeparator(), tsmiReloadUGC, toolStripSeparator1, tsmiResetCache, tsmiResetAllSettings, new ToolStripSeparator(), tsmiExport, tsmiImport, }); tsmiFile.Name = "tsmiFile"; tsmiFile.Size = new Size(37, 20); tsmiFile.Text = "&File"; // // tsmiSave // tsmiSave.Name = "tsmiSave"; tsmiSave.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); tsmiSave.Size = new Size(147, 22); tsmiSave.Text = "&Save settings"; tsmiSave.ToolTipText = "Save settings to game"; tsmiSave.Image = ResourceUtil.GetImage("arrow-right.png"); // // tsmiAutoSave // tsmiAutoSave.CheckOnClick = true; tsmiAutoSave.Name = "tsmiAutoSave"; tsmiAutoSave.Size = new Size(147, 22); tsmiAutoSave.Text = "&Auto-save"; // // tsmiExport // tsmiExport.Name = "tsmiExport"; tsmiExport.Size = new Size(147, 22); tsmiExport.Text = "&Export ..."; // // tsmiImport // tsmiImport.Name = "tsmiImport"; tsmiImport.Size = new Size(147, 22); tsmiImport.Text = "&Import ..."; // // tsmiOrder // tsmiOrder.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { tsmiResetOrder, tsmiHarmonyOrder, tsmiReverseOrder, tsmiRandomOrder }); tsmiOrder.Name = "tsmiOrder"; tsmiOrder.Size = new Size(49, 20); tsmiOrder.Text = "&Order"; // // tsmiResetOrder // tsmiResetOrder.Name = "tsmiResetOrder"; tsmiResetOrder.Size = new Size(132, 22); tsmiResetOrder.Text = "&ResetOrder (recommended)"; // // tsmiHarmonyOrder // tsmiHarmonyOrder.Name = "tsmiHarmonyOrder"; tsmiHarmonyOrder.Size = new Size(132, 22); tsmiHarmonyOrder.Text = "&Harmony"; tsmiHarmonyOrder.ToolTipText = "sort by harmony"; // // tsmiReverseOrder // tsmiReverseOrder.Name = "tsmiReverseOrder"; tsmiReverseOrder.Size = new Size(132, 22); tsmiReverseOrder.Text = "Re&verse"; tsmiReverseOrder.ToolTipText = "reverse order"; // // tsmiRandomOrder // tsmiRandomOrder.Name = "tsmiRandomOrder"; tsmiRandomOrder.Size = new Size(132, 22); tsmiRandomOrder.Text = "Ra&ndom"; tsmiRandomOrder.ToolTipText = "Random order"; // // tsmiHelp // tsmiHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { tsmiWiki, tsmiDiscordSupport, tsmiOpenLogLocation, new ToolStripSeparator(), tsmiAbout }); tsmiHelp.Name = "tsmiHelp"; tsmiHelp.Size = new Size(44, 20); tsmiHelp.Text = "&Help"; // // tsmiWiki // tsmiWiki.Name = "tsmiWiki"; tsmiWiki.Size = new Size(180, 22); tsmiWiki.Text = "&Wiki"; // // tsmiDiscordSupport // tsmiDiscordSupport.Name = "tsmiDiscordSupport"; tsmiDiscordSupport.Size = new Size(180, 22); tsmiDiscordSupport.Text = "Discord &Support"; // // tsmiOpenLogLocation // tsmiOpenLogLocation.Name = "tsmiOpenLogLocation"; tsmiOpenLogLocation.Size = new Size(180, 22); tsmiOpenLogLocation.Text = "Open &Log Location"; // // tsmiAbout // tsmiAbout.Name = "tsmiAbout"; tsmiAbout.Size = new Size(180, 22); tsmiAbout.Text = "&About"; // // tsmiTools // tsmiTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { tsmiAdvanced, tsmiMassSubscribe, tsmiReDownload, }); tsmiTools.Name = "tsmiTools"; tsmiTools.Size = new Size(46, 20); tsmiTools.Text = "&Tools"; // // tsmiAdvanced // tsmiAdvanced.Name = "tsmiAdvanced"; tsmiAdvanced.Size = new Size(180, 22); tsmiAdvanced.Text = "Show &Advanced options"; tsmiAdvanced.ToolTipText = "Show &Advanced options"; tsmiAdvanced.CheckOnClick = true; // // tsmiMassSubscribe // tsmiMassSubscribe.Name = "tsmiMassSubscribe"; tsmiMassSubscribe.Size = new Size(180, 22); tsmiMassSubscribe.Text = "Mass &Subscribe"; // // tsmiReDownload // tsmiReDownload.Name = "tsmiReDownload"; tsmiReDownload.Text = "&Redownload broken downloads [Experimental]"; // // tsmiReloadUGC // tsmiReloadUGC.Name = "tsmiReloadUGC"; tsmiReloadUGC.Text = "&Reload Mods/Assets"; tsmiReloadUGC.ToolTipText = "Reload syncs mods/assets that might have been subbed/unsubbed"; // // tsmiReloadSettings // tsmiReloadSettings.Name = "tsmiReloadSettings"; tsmiReloadSettings.Text = "Load &Settings"; tsmiReloadSettings.ToolTipText = "syncs back data that might have been modified inside of game (discarding any unsaved changes)."; tsmiReloadSettings.Image = ResourceUtil.GetImage("arrow-left.png"); // // tsmiUpdateSteamCache // tsmiUpdateSteamCache.Name = "tsmiUpdateSteamCache"; tsmiUpdateSteamCache.Text = "Update Steam Data"; tsmiUpdateSteamCache.Visible = false; // // tsmiResetCache // tsmiResetCache.Name = "tsmiResetCache"; tsmiResetCache.Text = "Reset Cache"; tsmiResetCache.ToolTipText = "Reset Cache resets all data (author names) collected from steam or data collected when you launch CS (asset names/tags)"; // // tsmiResetAllSettings // tsmiResetAllSettings.Name = "tsmiResetAllSettings"; tsmiResetAllSettings.Text = "Reset all Settings"; tsmiResetAllSettings.ToolTipText = "reset all settings deletes all cache/setting files (not profiles) and starts from scratch"; //// //// tsmi //// //tsmi.Name = "tsmi"; //tsmi.Text = "&"; //tsmi.ToolTipText = ""; tsmiWiki.Click += TsmiWiki_Click; tsmiDiscordSupport.Click += TsmiDiscordSupport_Click; tsmiOpenLogLocation.Click += TsmiOpenLogLocation_Click; tsmiAbout.Click += TsmiAbout_Click; tsmiMassSubscribe.Click += TsmiMassSubscribe_Click; tsmiReDownload.Click += TsmiReDownload_Click; tsmiAdvanced.CheckedChanged += TsmiAdvanced_CheckedChanged; OnAdvancedChanged(); }