Inheritance: PluginManagerBase
Esempio n. 1
0
        public static HeadsetPluginManager GetPluginManager(SettingsPluginDataCollection settings)
        {
            HeadsetPluginManager manager = new HeadsetPluginManager();

            manager.LoadSettings(settings);
            return(manager);
        }
Esempio n. 2
0
		private Broker() {
			start_time = DateTime.Now;
			_instance = this;
			upgrade_settings();
			Utils.PluginLog("", "");//clear file
			headset_plugin_manager = new HeadsetPluginManager();
			conference = Conference.instance;
			NewEvent += Call.NewFSEvent;
			NewEvent += Account.NewEvent;
			NewEvent += conference.NewFSEvent;

			Call.CallStateChanged += CallStateChangedHandler;

			init_us();
			loaded();
		}
Esempio n. 3
0
        private Broker()
        {
            start_time = DateTime.Now;
            _instance  = this;
            upgrade_settings();
            Utils.PluginLog("", "");            //clear file
            headset_plugin_manager = new HeadsetPluginManager();
            conference             = Conference.instance;
            NewEvent += Call.NewFSEvent;
            NewEvent += Account.NewEvent;
            NewEvent += conference.NewFSEvent;

            Call.CallStateChanged += CallStateChangedHandler;

            init_us();
            loaded();
        }
Esempio n. 4
0
        private void init_us()
        {
            if (is_inited)
            {
                return;
            }
            is_inited = true;
            try {
                if (!System.IO.File.Exists("conf/freeswitch.xml"))
                {
                    MessageBox.Show("conf/freeswitch.xml is not found, without it we must quit.", "Missing Base Configuration File", MessageBoxButton.OK, MessageBoxImage.Error);
                    Environment.Exit(-1);
                }
                try{
                    XmlTextReader r = new XmlTextReader(new StreamReader("conf/freeswitch.xml"));
                    try {
                        while (r.Read())
                        {
                        }
                    }
                    finally {
                        r.Close();
                    }
                }catch (Exception e) {
                    MessageBox.Show("Bailing out as conf/freeswitch.xml is not a valid xml document error: " + e.Message);
                    Environment.Exit(-1);
                }
                if (System.IO.File.Exists("log/freeswitch.log"))
                {
                    try {
                        System.IO.File.WriteAllText("log/freeswitch.log", "");
                    }
                    catch (System.IO.IOException e) {
                        MessageBox.Show(
                            "Unable to truncate freeswitch.log (most likely due to FSCLient already running) due to: " + e.Message,
                            "Truncation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        Environment.Exit(-1);
                    }
                }
                Account.LoadSettings();

                recordings_folder     = Properties.Settings.Default.RecordingPath;
                theme                 = Properties.Settings.Default.Theme;
                IncomingBalloons      = Properties.Settings.Default.IncomingBalloons;
                IncomingTopMost       = Properties.Settings.Default.FrontOnIncoming;
                IncomingKeyboardFocus = Properties.Settings.Default.KeyboardFocusIncomingCall;
                ClearDTMFS            = Properties.Settings.Default.ClearDTMFS;
                UPNPNAT               = Properties.Settings.Default.UPNPNAT;
                DirectSipDial         = Properties.Settings.Default.DirectSipDial;
                UseNumberOnlyInput    = Properties.Settings.Default.UseNumberOnlyInput;
                CheckForUpdates       = Properties.Settings.Default.CheckForUpdates;
                GUIStartup            = Properties.Settings.Default.GuiStartup;

                if (Properties.Settings.Default.Sofia != null)
                {
                    sofia = Properties.Settings.Default.Sofia.GetSofia();
                }
                else
                {
                    sofia = new Sofia();
                }

                if (Properties.Settings.Default.HeadsetPlugins != null)
                {
                    headset_plugin_manager = HeadsetPluginManager.GetPluginManager(Properties.Settings.Default.HeadsetPlugins);
                }
                else
                {
                    headset_plugin_manager = new HeadsetPluginManager();
                }

                if (Properties.Settings.Default.EventSocket != null)
                {
                    event_socket = Properties.Settings.Default.EventSocket.GetEventSocket();
                }
                else
                {
                    event_socket = new EventSocket();
                }

                if (Properties.Settings.Default.Conference != null)
                {
                    conference = Properties.Settings.Default.Conference.GetConference();
                }
            }
            catch (Exception e) {
                MessageBoxResult res = MessageBox.Show(
                    "Unable to properly load our settings if you continue existing settings may be lost, do you want to continue?(No to exit)\n" +
                    e.Message, "Error Loading Settings", MessageBoxButton.YesNo);
                if (res != MessageBoxResult.Yes)
                {
                    Environment.Exit(-1);
                }
            }
            Thread t = new Thread(headset_plugin_manager.LoadPlugins);

            t.IsBackground = true;
            t.Start();
            t = new Thread(init_freeswitch);
            t.IsBackground = true;
            t.Start();
            t = new Thread(VersionCheck);
            t.IsBackground = true;
            t.Start();
        }
Esempio n. 5
0
		private void init_us() {
			if (is_inited)
				return;
			is_inited = true;
			try {
				if (!System.IO.File.Exists("conf/freeswitch.xml")) {
					MessageBox.Show("conf/freeswitch.xml is not found, without it we must quit.", "Missing Base Configuration File", MessageBoxButton.OK, MessageBoxImage.Error);
					Environment.Exit(-1);
				}
				try{
					XmlTextReader r = new XmlTextReader(new StreamReader("conf/freeswitch.xml"));
					try {
						while (r.Read()) {
						}
					}
					finally {
						r.Close();
					} 

				}catch(Exception e){
					MessageBox.Show("Bailing out as conf/freeswitch.xml is not a valid xml document error: " + e.Message);
					Environment.Exit(-1);
				}
				if (System.IO.File.Exists("log/freeswitch.log")) {
					try {
						System.IO.File.WriteAllText("log/freeswitch.log", "");
					}
					catch (System.IO.IOException e) {
						MessageBox.Show(
							"Unable to truncate freeswitch.log (most likely due to FSCLient already running) due to: " + e.Message,
							"Truncation Error", MessageBoxButton.OK, MessageBoxImage.Error);
						Environment.Exit(-1);
					}
				}
				Account.LoadSettings();

				recordings_folder = Properties.Settings.Default.RecordingPath;
				theme = Properties.Settings.Default.Theme;
				IncomingBalloons = Properties.Settings.Default.IncomingBalloons;
				IncomingTopMost = Properties.Settings.Default.FrontOnIncoming;
				IncomingKeyboardFocus = Properties.Settings.Default.KeyboardFocusIncomingCall;
				ClearDTMFS = Properties.Settings.Default.ClearDTMFS;
				UPNPNAT = Properties.Settings.Default.UPNPNAT;
				DirectSipDial = Properties.Settings.Default.DirectSipDial;
				UseNumberOnlyInput = Properties.Settings.Default.UseNumberOnlyInput;
				CheckForUpdates = Properties.Settings.Default.CheckForUpdates;
				GUIStartup = Properties.Settings.Default.GuiStartup;

				if (Properties.Settings.Default.Sofia != null)
					sofia = Properties.Settings.Default.Sofia.GetSofia();
				else
					sofia = new Sofia();

				if (Properties.Settings.Default.HeadsetPlugins != null)
					headset_plugin_manager = HeadsetPluginManager.GetPluginManager(Properties.Settings.Default.HeadsetPlugins);
				else
					headset_plugin_manager = new HeadsetPluginManager();

				if (Properties.Settings.Default.EventSocket != null)
					event_socket = Properties.Settings.Default.EventSocket.GetEventSocket();
				else
					event_socket = new EventSocket();

				if (Properties.Settings.Default.Conference != null)
					conference = Properties.Settings.Default.Conference.GetConference();
			}
			catch (Exception e) {
				MessageBoxResult res = MessageBox.Show(
					"Unable to properly load our settings if you continue existing settings may be lost, do you want to continue?(No to exit)\n" +
					e.Message, "Error Loading Settings", MessageBoxButton.YesNo);
				if (res != MessageBoxResult.Yes)
					Environment.Exit(-1);
			}
			Thread t = new Thread(headset_plugin_manager.LoadPlugins);
			t.IsBackground = true;
			t.Start();
			t = new Thread(init_freeswitch);
			t.IsBackground = true;
			t.Start();
			t = new Thread(VersionCheck);
			t.IsBackground = true;
			t.Start();
		}
Esempio n. 6
0
 public static HeadsetPluginManager GetPluginManager(SettingsPluginDataCollection settings)
 {
     HeadsetPluginManager manager = new HeadsetPluginManager();
     manager.LoadSettings(settings);
     return manager;
 }