コード例 #1
0
        public Context()
        {
            _settings = ApplicationData.Current.RoamingSettings;

            try
            {
                if (_settings.Values.ContainsKey(nameof(Connections)))
                {
                    string serialization = _settings.Values[nameof(Connections)] as string;
                    var    array         = JsonConvert.DeserializeObject <KodiConnection[]>(serialization);
                    Connections = new ObservableCollection <KodiConnection>(array);
                }
            }
            catch (Exception) { }

            if (Connections == null)
            {
                Connections = new ObservableCollection <KodiConnection>();
            }

#if DEBUG
            if (!Connections.Any())
            {
                var cnx = new KodiConnection
                {
                    IsDefault = true,
                    Kodi      = new KodiRemote.Core.Connection("123", "80", "kodi", "")
                };
                Connections.Add(cnx);
            }
#endif
        }
コード例 #2
0
 public void SetDefaultConnection(KodiConnection connection)
 {
     Connection = connection;
 }