Exemple #1
0
 public void App_Startup(object sender, StartupEventArgs args)
 {
     try {
         bool bSuccess = MayaTheme.Initialize(this);
     } catch (System.Exception ex) {
         MessageBox.Show(ex.Message, "Error during initialization. This program will exit");
         Application.Current.Shutdown();
     }
 }
        void App_Startup(object sender, StartupEventArgs e)
        {
            try {
                MLibrary.initialize("MayaWpfStandAlone");
                bool bSuccess = MayaTheme.Initialize(this);

                string    fileName;
                string [] args = Environment.GetCommandLineArgs();
                if (args.Length <= 1)
                {
                    Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                    dlg.FileName   = "Maya Files";              // Default file name
                    dlg.DefaultExt = ".ma";                     // Default file extension
                    dlg.Filter     = "Maya Files (.ma/.mb)|*.ma;*.mb|Maya ASCII (.ma)|*.ma|Maya Binary (.mb)|*.mb|All files (*.*)|*.*";
                    Nullable <bool> result = dlg.ShowDialog();
                    if (result == true)
                    {
                        fileName = dlg.FileName;
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    fileName = args [1];
                }

                MFileIO.newFile(true);
                fileName = fileName.Replace('\\', '/');
                MFileIO.open(fileName);
            } catch (System.Exception ex) {
                MessageBox.Show(ex.Message, "Error during Maya API initialization. This program will exit");
                Application.Current.Shutdown();
            }
        }
        public bool InitializePlugin()
        {
            // Add one time initialization here
            // One common scenario is to setup a callback function here that
            // unmanaged code can call.
            // To do this:
            // 1. Export a function from unmanaged code that takes a function
            //    pointer and stores the passed in value in a global variable.
            // 2. Call this exported function in this function passing delegate.
            // 3. When unmanaged code needs the services of this managed module
            //    you simply call loadPlugin() and by the time loadPlugin
            //    returns global function pointer is initialized to point to
            //    the C# delegate.
            // For more info see:
            // http://msdn2.microsoft.com/en-US/library/5zwkzwf4(VS.80).aspx
            // http://msdn2.microsoft.com/en-us/library/44ey4b32(VS.80).aspx
            // http://msdn2.microsoft.com/en-US/library/7esfatk4.aspx
            // as well as some of the existing Maya managed apps.

            // Initialize your plug-in application here
            bool b = MayaTheme.Initialize(null);

            return(true);
        }