Esempio n. 1
0
        public static void Main(string[] args)
        {
            try
            {
                //Wpf.Message.ResourceDictionaryPath = "assembly=" + System.Reflection.Assembly.GetEntryAssembly().EscapedCodeBase + ";resources/style.xaml";

                //Uri u = new System.Uri("/" + PathRoutines.GetFileNameFromPath(System.Reflection.Assembly.GetEntryAssembly().EscapedCodeBase) + ";component/resources/style.xaml", System.UriKind.Relative);
                //System.Windows.ResourceDictionary rd = new System.Windows.ResourceDictionary();
                //System.Windows.Application.LoadComponent(rd, u);
                //Wpf.Message.ResourceDictionary = rd;
                //System.Windows.Resources.StreamResourceInfo info = System.Windows.Application.GetContentStream(u);
                //System.Windows.Markup.XamlReader reader = new System.Windows.Markup.XamlReader();
                //Wpf.Message.ResourceDictionary = (System.Windows.ResourceDictionary)reader.LoadAsync(info.Stream);

                Log.Main.Inform("Version: " + AssemblyRoutines.GetAppVersion());
                string user = ProcessRoutines.GetProcessUserName();
                string m    = "User: "******" (as administrator)";
                }
                Log.Main.Inform(m);

                ProcessRoutines.RunSingleProcessOnly();

                if (ProgramRoutines.IsParameterSet <CommandLineParameters>(CommandLineParameters.INITIAL_CONFIGURATION))
                {
                    Message.Inform("Please configure service in the next window.");
                    SettingsWindow.OpenDialog();
                    return;
                }

#if !test
                Application.Run(SysTray.This);
#else
                UiApiClient.testCreateInstanceContext();
                SettingsWindow.Open();
                Application.Run(SysTray.This);
                //UiApiClient.testSubscribe();
                //UiApiClient.testSubscribe();
                //Thread.Sleep(1000);
                //UiApiClient.testCloseInstanceContext();
                //UiApiClient.testCreateInstanceContext();
                //UiApiClient.testSubscribe();
                //UiApiClient.testSubscribe();
                //for (; ; )
                //{
                //    System.Threading.Thread.Sleep(10000);
                //}
#endif
            }
            catch (Exception e)
            {
                LogMessage.Error(e);
            }
            finally
            {
                Exit();
            }
        }
Esempio n. 2
0
        static void Main()
        {
            try
            {
                Log.Main.Inform("Version: " + AssemblyRoutines.GetAppVersion());
                string user = ProcessRoutines.GetProcessUserName();
                string m    = "User: "******" (as administrator)";
                }
                Log.Main.Inform(m);

#if !test
                ServiceBase.Run(new Service());
#else
                MpegStream.Start(1, "-f gdigrab -framerate 10 -f rtp_mpegts -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params aMg7BqN047lFN72szkezmPyN1qSMilYCXbqP/sCt srtp://127.0.0.1:5920");

                //Service.sessionChanged(1, true);
                //System.Threading.Thread.Sleep(1000000);
                //s.Stop
                //MpegStream.Start(1, "");
                UserSessionApi.OpenApi();
                UiApi.OpenApi();
                ServiceControllerStatus scs = ServiceControllerStatus.Running;
                for (; ;)
                {
                    System.Threading.Thread.Sleep(10000);
                    UiApi.Message(MessageType.INFORM, "test");
                    scs = scs == ServiceControllerStatus.Running ? ServiceControllerStatus.Stopped : ServiceControllerStatus.Running;
                }
#endif
            }
            catch (Exception e)
            {
                Log.Main.Error(e);
            }
        }