Exemplo n.º 1
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            if (this.onLoadArgs != null)
            {
                InitProject(this.onLoadArgs.Project, this.onLoadArgs.ProjectFile);
                this.onLoadArgs = null;
            }

            this.Text = this.projController.GetTitleBarText();
        }
Exemplo n.º 2
0
        private void OnLoadThreadProc(object context)
        {
            OnLoadArgs ola = (OnLoadArgs)context;

            try
            {
                ola.output = OnLoadImpl(ola.input);
            }

            catch (Exception ex)
            {
                ola.exception = ex;
            }
        }
Exemplo n.º 3
0
        protected override Document OnLoad(Stream input)
        {
            Document document;

            // WIC does not support MTA, so we must marshal this stuff to another thread
            // that is then guaranteed to be STA.
            switch (Thread.CurrentThread.GetApartmentState())
            {
            case ApartmentState.Unknown:
            case ApartmentState.MTA:
                OnLoadArgs ola = new OnLoadArgs();
                ola.input  = input;
                ola.output = null;

                ParameterizedThreadStart pts = new ParameterizedThreadStart(OnLoadThreadProc);
                Thread staThread             = new Thread(pts);
                staThread.SetApartmentState(ApartmentState.STA);
                staThread.Start(ola);
                staThread.Join();

                if (ola.exception != null)
                {
                    throw new ApplicationException("OnLoadImpl() threw an exception", ola.exception);
                }

                document = ola.output;
                break;

            case ApartmentState.STA:
                document = OnLoadImpl(input);
                break;

            default:
                throw new InvalidEnumArgumentException();
            }

            return(document);
        }
Exemplo n.º 4
0
        protected override Document OnLoad(Stream input)
        {
            Document document;

            // WIC does not support MTA, so we must marshal this stuff to another thread
            // that is then guaranteed to be STA.
            switch (Thread.CurrentThread.GetApartmentState())
            {
                case ApartmentState.Unknown:
                case ApartmentState.MTA:
                    OnLoadArgs ola = new OnLoadArgs();
                    ola.input = input;
                    ola.output = null;

                    ParameterizedThreadStart pts = new ParameterizedThreadStart(OnLoadThreadProc);
                    Thread staThread = new Thread(pts);
                    staThread.SetApartmentState(ApartmentState.STA);
                    staThread.Start(ola);
                    staThread.Join();

                    if (ola.exception != null)
                    {
                        throw new ApplicationException("OnLoadImpl() threw an exception", ola.exception);
                    }

                    document = ola.output;
                    break;

                case ApartmentState.STA:
                    document = OnLoadImpl(input);
                    break;

                default:
                    throw new InvalidEnumArgumentException();
            }

            return document;
        }
Exemplo n.º 5
0
 public MainFrm(OnLoadArgs onLoadArgs)
     : this()
 {
     this.onLoadArgs = onLoadArgs;
 }