본문 바로가기

.NET/SmartClient

클릭온스 어플리케이션 파리미터 넘기기 ( appref-ms의 argument)

반응형
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                var inputArgs = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;
                if (inputArgs != null && inputArgs.Length > 0)
                {
                    args = inputArgs[0].Split(new char[] { ',' });
                }
            }

* 클릭온스로 배포시 현장의 전광판등을 사용할때 파라미터 값이 들어 가질 않는 문제 (엔컴퓨팅 사용시)

* 엔컴퓨팅 사용시 시작 프로그램 설정 이슈

* 클릭온스는 자동 업데이트 설정

* 아래 실행문은 위의 코드에 대한 샘플(배치파일로 등록하거나 바로 실행)

ex) c:\pdp.appref-ms 002,001,3
ex2) "%userprofile%\Desktop\pdp.appref-ms" 002,001,3
등으로 프로그램 등록


* 엔컴퓨팅 시작 프로그램을 클릭온스로 등록시 에러메세지를 나타냄

* 꼼수로 

        static AutoResetEvent autoEvent;

        static void Main(string[] args)
        {
            autoEvent = new AutoResetEvent(false);

            Console.WriteLine("main thread starting worker thread...");
            Thread t = new Thread(DoWork);
            t.Start();

            Console.WriteLine("main thread sleeping for 30 second...");
            Thread.Sleep(30000);

            Console.WriteLine("main thread signaling worker thread...");
            autoEvent.Set();

            System.Diagnostics.Process.Start(@"c:\pdp.appref-ms  ", "002,001,3");
 
        }

        static void DoWork()
        {
            Console.WriteLine("   worker thread started, now waiting on event...");
            autoEvent.WaitOne();
            Console.WriteLine("   worker thread reactivated, now exiting...");
        }




* 콘솔 프로그램 하나 뛰우고 조금뒤에 시작합니다~ 문제가 해결됩니다