iRacingDirector.Plugin.Tester.DomainForm.Create C# (CSharp) Method

Create() private method

private Create ( bool recreate = false ) : void
recreate bool
return void
        private void Create(bool recreate = false)
        {
            if (domain == null || recreate)
            {
                if (domain != null)
                {
                    frm.Hide();
                    AppDomain.Unload(domain);
                    domain = null;
                }

                var myLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                var info = new AppDomainSetup
                {
                    ShadowCopyFiles = "true"
                };

                domain = AppDomain.CreateDomain("TranscodingDomain", null, info);
                frm = (RemoteImageViewer)domain.CreateInstanceFromAndUnwrap(typeof(RemoteImageViewer).Assembly.Location, typeof(RemoteImageViewer).FullName);

                frm.InitPlugin(pluginPath);
            }

            frm.SetFramesPerSecond(framesPerSecond);
            frm.SetOnError(onError);
            
            if(sessionDataPath != null)
                frm.SetSessionDataPath(sessionDataPath);

            if( backgroundImage != null)
                frm.SetBackgroundImage(backgroundImage);
            frm.ClientSize = clientSize;
            frm.SetPosition(left, top);
            frm.SetPlaybackSpeed(playbackSpeed);
            frm.SetOnAnimationTick(onAnimationTick);
            frm.SetDrawAction(drawAction);
            frm.SetPaused(isPaused);

            frm.Refresh();
        }