Beispiel #1
0
 /// <summary>实例化应用接口客户端</summary>
 public ApiClient(String uri) : this()
 {
     if (!uri.IsNullOrEmpty())
     {
         Servers.AddRange(uri.Split(","));
     }
 }
        public void LoadServers()
        {
            var servers = new ObservableCollection <IServer>();

            if (_existingServers != null)
            {
                servers = _existingServers;
            }
            else
            {
                var serverConnections = ServerRepository.Instance.All();
                if (serverConnections != null)
                {
                    servers.AddRange(serverConnections);
                }
            }

            if (Servers == null)
            {
                Servers = new ObservableCollection <IServer>();
            }
            RemoveServerDisconnect();
            Servers.Clear();
            Servers.AddRange(servers);
            SetupServerDisconnect();
            if (_selectedId != null && _selectedId != Guid.Empty)
            {
                var selectConnection = Servers.FirstOrDefault(server => server.EnvironmentID == _selectedId);
                SelectedConnection = null;
                SelectedConnection = selectConnection;
            }
        }
Beispiel #3
0
 public ClientConfig(Domain domain = null, params Server[] serverList)
 {
     Domain = domain ?? new Domain();
     if (serverList != null && serverList.Length != 0)
     {
         Servers.AddRange(serverList);
     }
 }
Beispiel #4
0
 public ClientConfig(CatDomain domain = null, params CatServer[] serverList)
 {
     _mDomain = domain ?? new CatDomain();
     if (serverList != null && serverList.Length != 0)
     {
         Servers.AddRange(serverList);
     }
     RandomServer();
 }
Beispiel #5
0
        private void LoadConfig()
        {
            try
            {
                Servers.Clear();
                Servers.AddRange(GetAvailabilityGroupList(xml_config, "Servers", "Server", "ServerId"));

                Proxies.Clear();
                Proxies.AddRange(GetAvailabilityGroupList(xml_config, "Proxies", "Proxy", "ProxyId"));
            }
            catch (Exception e)
            {
                Log.WriteLine(LogLevel.Error, "There are errors in your configuration file.");
                Log.WriteLine(e.Message);
                Global.Exit();
            }
        }
Beispiel #6
0
        public void Fill(DBEntities context)
        {
            Levels.Add(new SelectListItem {
                Value = "-1", Text = "All"
            });
            foreach (OmniusLogLevel level in Enum.GetValues(typeof(OmniusLogLevel)))
            {
                Levels.Add(new SelectListItem {
                    Value = ((int)level).ToString(), Text = level.ToString(), Selected = ((int)level == LevelId)
                });
            }

            Sources.Add(new SelectListItem {
                Value = "-1", Text = "All"
            });
            foreach (OmniusLogSource source in Enum.GetValues(typeof(OmniusLogSource)))
            {
                Sources.Add(new SelectListItem {
                    Value = ((int)source).ToString(), Text = source.ToString(), Selected = ((int)source == SourceId)
                });
            }

            Users.Add(new User {
                UserName = "******", DisplayName = "All"
            });
            Users.AddRange(context.Users.OrderBy(u => u.UserName).ToList());

            Servers.Add("All");
            Servers.AddRange(context.LogItems.Select(i => i.Server).OrderBy(s => s).Distinct().ToList());

            Applications.Add(new Application {
                Name = "All", DisplayName = "All"
            });
            Applications.AddRange(context.Applications.OrderBy(a => a.Name).ToList());

            Blocks.Add(new Block {
                Name = "All", DisplayName = "All"
            });
            if (ApplicationName != null)
            {
                Blocks.AddRange(context.Blocks.Where(b => b.WorkFlow.Application.Name == ApplicationName).OrderBy(b => b.DisplayName).ToList());
            }

            Actions.Add("All");
            Actions.AddRange(Modules.Tapestry.Action.All.Select(a => a.Value.Name).OrderBy(a => a));
        }
Beispiel #7
0
        protected override async void OnInitialize()
        {
            base.OnInitialize();

            var localFolders = new[]
            {
                new { Folder = KnownFolders.MusicLibrary, Type = MediaType.Music },
                new { Folder = KnownFolders.PicturesLibrary, Type = MediaType.Picture },
                new { Folder = KnownFolders.VideosLibrary, Type = MediaType.Video }
            };

            var localViewModels = localFolders.Select(f => new MediaServerViewModel(f.Folder, isLocal: true, type: f.Type));

            var serverFolders = await KnownFolders.MediaServerDevices.GetFoldersAsync();

            var serverViewModels = serverFolders.Select(f => new MediaServerViewModel(f, isLocal: false, type: MediaType.Unknown));

            Servers.AddRange(localViewModels);
            Servers.AddRange(serverViewModels);
        }