예제 #1
0
        private string TryGetJson(string nextPageUrl = "")
        {
            RestDataSource restDataSource = (RestDataSource)DataSource;
            RestConnection connection     = restDataSource.Connection;

            if (string.IsNullOrEmpty(Url))
            {
                throw new InvalidOperationException($"URL was null / empty in TryGetJsonDoc for data source {DataSource.Name}");
            }

            string?rawJson;

            try
            {
                if (!string.IsNullOrEmpty(nextPageUrl))
                {
                    rawJson = Client.DownloadString(nextPageUrl);
                }
                else
                {
                    if (restDataSource.Connection.Authorization == HttpAuthorization.OAuth2)
                    {
                        Dictionary <string, string> tokenPostDict = new();

                        foreach (KeyValue keyVal in connection.TokenBody !)
                        {
                            tokenPostDict[keyVal.Key !] = keyVal.Value !;
        private async Task <Operation> WaitForLongRunningOperation(Guid operationId, int interavalInSec = 5, int maxTimeInSeconds = 60, CancellationToken cancellationToken = default(CancellationToken))
        {
            OperationsHttpClient operationsClient = RestConnection.GetClient <OperationsHttpClient>();
            DateTime             expiration       = DateTime.Now.AddSeconds(maxTimeInSeconds);
            int checkCount = 0;

            while (true)
            {
                Logger.Log(LogLevel.Info, $" Checking status ({checkCount++})... ");

                Operation operation = await operationsClient.GetOperation(operationId, cancellationToken);

                if (!operation.Completed)
                {
                    Logger.Log(LogLevel.Info, $"   Pausing {interavalInSec} seconds...");

                    await Task.Delay(interavalInSec * 1000);

                    if (DateTime.Now > expiration)
                    {
                        Logger.Log(LogLevel.Error, $"Operation did not complete in {maxTimeInSeconds} seconds.");
                    }
                }
                else
                {
                    return(operation);
                }
            }
        }
        private string GetReportProjectUrl(string projectUrl)
        {
            string baseUrl   = RestConnection.GetBaseUrl();
            string projectId = new UrlHelper().GetFirstId(projectUrl);
            string url       = $"{baseUrl}/#projects/id:{projectId}";

            return(url);
        }
예제 #4
0
 public ClassroomBuildingViewModel(RestConnection restConnection)
 {
     this.restConnection = restConnection;
     this.editorFactory  = new DataFormEditorFactory <ClassroomBuildingEditor>();
     Items         = new ObservableCollection <ClassroomBuilding>();
     QueryCommand  = new DelegateCommand(QueryOp);
     AddCommand    = new DelegateCommand(AddOp);
     EditCommand   = new DelegateCommand(EditOp);
     DeleteCommand = new DelegateCommand(DeleteOp);
 }
예제 #5
0
        public void Initialize()
        {
            connectedServers = new List <Server>();
            eventQueue       = new LinkedList <string>();
            dc                  = new DiscordClient();
            dc.Log.Message     += onRequestLog;
            dc.MessageReceived += onMessageReceived;
            dc.ServerAvailable += (s, e) => { dc.Log.Info("Manager", "Connected to server " + e.Server.Id, null); connectedServers.Add(e.Server); };

            try
            {
                dc.Log.Info("Manager", "Attempting to load configuration file", null);
                cfg = Configuration.loadConfig("IW4MAdmin.Discord.cfg");
            }

            catch (ConfigException e)
            {
                dc.Log.Info("Manager", "No usable configuration found", e);
                cfg = Configuration.createConfig();
                try
                {
                    Configuration.saveConfig(cfg);
                    dc.Log.Info("Manager", "Saved new bot configuration", null);
                }

                catch (ConfigException ce)
                {
                    dc.Log.Error("Manager", "Could not save new configuration file", ce);
                    dc.Log.Error(ce.Message, ce);
                }
            }

            dc.UsingCommands(c => { c.PrefixChar = cfg.CommandPrefix; c.HelpMode = HelpMode.Public; })
            .UsingPermissionLevels((u, c) => { return((int)PermissionHelper.getPermissions(u, c)); })
            .UsingModules();

            dc.Log.Info("Manager", "Adding command modules", null);
            dc.AddModule <IW4MAdminModule>("IW4MAdmin", ModuleFilter.None);

            dc.Log.Info("Manager", "Initializing connection to IW4MAdmin API", null);
            rc = RestConnection.Initialize(new Uri(cfg.IW4MAdminURI + ':' + cfg.IW4MAdminPort + "/api/events"));

            try
            {
                Task.Run(queryAPI);
                dc.ExecuteAndWait(Connect);
            }

            catch (Exception e)
            {
                dc.Log.Error("Manager", "Could not connect!", e);
            }
        }
        private string GetReportVersionUrl(string versionUrl, bool isComponent)
        {
            string baseUrl   = RestConnection.GetBaseUrl();
            string versionId = new UrlHelper().GetLastId(versionUrl);
            string url       = $"{baseUrl}/#versions/id:{versionId}";

            if (!isComponent)
            {
                url += "/view:bom";
            }
            return(url);
        }
        public void Setup(RestConnection restConnection)
        {
            RestConnection = restConnection;

            // Create required dataservices
            CodeLocationDataService  = new CodeLocationResponseService(RestConnection);
            ScanSummariesDataService = new ScanSummariesResponseService(RestConnection);
            DeployBdioDataService    = new DeployBdioResponseService(RestConnection);
            ProjectDataService       = new ProjectResponseService(RestConnection);
            PolicyDataService        = new PolicyResponseService(RestConnection);
            RiskReportDataService    = new RiskReportResponseService(RestConnection);
            ScanStatusDataService    = new ScanStatusDataService(RestConnection, Convert.ToInt64(TimeSpan.FromSeconds(Convert.ToDouble(HubScanTimeout)).TotalMilliseconds));
        }
예제 #8
0
        /// <summary>
        /// Register a new user in the system. At minimum the email address, the full name and the password is required at registration.
        /// If the system is configured not to require user activation after registration the function also logs in the user just registered.
        /// However if activation is required the <see cref="ActivationRequiredException" /> exeption will be thrown with the following message
        /// "Activation needed, please confirm your account by clicking the link you received by email" but the user will be registered.
        /// It meens that the user registration happened but the system cannot be used unless clicking the activation link.
        ///
        /// Send POST request to APIROOT/users/register
        /// </summary>
        /// <param name="register">Registration parameters</param>
        /// <exception cref="ActivationRequiredException">This exception indicates that the registration succeeded but activation is required before using the system</exception>
        /// <exception cref="WebException">This exception will be thrown in case of service side registration error. Please refer to the HTTP error code for more information</exception>
        public void Register(Register register)
        {
            var response = RestConnection.Post("users/register", JsonSerializer.Serialize(register));

            var registrationResult = JsonSerializer.Deserialize <RegistrationResult>(response);

            if (registrationResult.NeedsActivation)
            {
                throw new ActivationRequiredException(
                          "Activation needed, please confirm your account by clicking the link you received by email");
            }

            _isLoggedIn = true;
        }
예제 #9
0
        public String VerificarExistencia(Entity entidade)
        {
            string json = null;
            var    User = (User)entidade;
            var    body = User;

            json = new RestConnection().PostRequest("verifyEmail", body);

            var definition = new { response = "" };

            var resObj = JsonConvert.DeserializeAnonymousType(json, definition);

            return(resObj.response);
        }
예제 #10
0
        static void Main()
        {
            var restConnection = new RestConnection();

            var tvdbConnection = new TvdbConnection(restConnection);
            var tmdbConnection = new TmdbConnection(restConnection, TestConstants.TMDbApiKey);
            var imageHelper    = new ImageHelper(restConnection);

            var connectionManager = new ConnectionManager(new Timer(), new LocalServerDiscovery(),
                                                          restConnection, new MyPlexConnection(restConnection),
                                                          new TvdbCache(tvdbConnection), new TmdbCache(tmdbConnection), new NowPlaying(imageHelper));

            Task.Factory.StartNew(async() =>
            {
                ((INotifyCollectionChanged)connectionManager.NowPlaying.VideosNowPlaying).CollectionChanged += async(s, e) =>
                {
                    foreach (var video in connectionManager.NowPlaying.VideosNowPlaying.ToList())
                    {
                        Console.WriteLine("Loading external data for: " + video.Title);
                        await connectionManager.PopulateFromExternalSourcesAsync(video, false);

                        WriteVideo(video);

                        var role = video.Roles.FirstOrDefault();
                        if (role != null)
                        {
                            await connectionManager.PopulateFromExternalSourcesAsync(role, false);
                            Console.WriteLine(role.Tag + " starred in " + role.CastCredits.Count);
                            if (role.CastCredits.Any())
                            {
                                Console.WriteLine("  " + role.CastCredits[0].Title + " (" + role.CastCredits[0].Role + ") " + role.CastCredits[0].ReleaseDate.Year);
                            }
                        }
                    }
                };

                Console.WriteLine("Connecting to MyPlex...");
                await connectionManager.ConnectToMyPlexAsync(TestConstants.MyPlexUserName, TestConstants.MyPlexPassword);

                Console.WriteLine("Connecting...");
                await connectionManager.ConnectAsync();

                Console.WriteLine("Waiting for videos...");
            });

            Console.WriteLine("Press any key to exit");

            Console.ReadKey();
        }
예제 #11
0
        /// <summary>
        /// Creates a new MainController and displays the initial form.
        /// </summary>
        public MainController()
        {
            // Configure connection with the account server
            _connection = new RestConnection();

            _connection.OnRegisterAccountResponse += OnAccountRegistrationResponse;
            _connection.OnLoginAccountResponse    += OnAccountLoginResponse;

            // Configure connection with the asset server
            assetController = new AssetDownloadController(Config.GetConfig().AssetsUrl);
            assetController.OnUpdatingFinished += OnUpdatingFinished;

            // Start for updates, go from there
            assetController.RunAsync();
        }
예제 #12
0
        public ScanStatusDataService(RestConnection restConnection, long timeoutInMilliseconds) : base(restConnection)
        {
            projectDataService        = new ProjectResponseService(restConnection);
            projectVersionDataService = new ProjectVersionResponseService(restConnection);
            codeLocationDataService   = new CodeLocationResponseService(restConnection);
            scanSummaryDataService    = new ScanSummariesResponseService(restConnection);

            long timeout = timeoutInMilliseconds;

            if (timeoutInMilliseconds <= 0)
            {
                timeout = DEFAULT_TIMEOUT;
            }
            this.timeoutInMilliseconds = timeout;
        }
예제 #13
0
        public List <Entity> Salvar(Entity entidade)
        {
            string  json     = null;
            Profile Profile  = (Profile)entidade;
            string  endpoint = "profile";

            json = new RestConnection().PostRequest(endpoint, Profile);

            Profile objList = JsonConvert.DeserializeObject <Profile>(json);

            var objReturn = new List <Entity>();

            objReturn.Add(objList);
            return(objReturn);
        }
예제 #14
0
        public List <Entity> Excluir(Entity entidade)
        {
            string  json     = null;
            Address Address  = (Address)entidade;
            string  endpoint = "address/" + Address.Id;

            json = new RestConnection().DeleteRequest(endpoint, Address);

            Address objList = JsonConvert.DeserializeObject <Address>(json);

            var objReturn = new List <Entity>();

            objReturn.Add(objList);

            return(objReturn);
        }
예제 #15
0
        public List <Entity> Excluir(Entity entidade)
        {
            string json     = null;
            var    User     = (User)entidade;
            string endpoint = "user/" + User.Id;

            json = new RestConnection().DeleteRequest(endpoint, entidade);

            User objList = JsonConvert.DeserializeObject <User>(json);

            var objReturn = new List <Entity>();

            objReturn.Add(objList);

            return(objReturn);
        }
예제 #16
0
        static void Main()
        {
            var restConnection = new RestConnection();

            var tvdbConnection = new TvdbConnection(restConnection);
            var tmdbConnection = new TmdbConnection(restConnection, TestConstants.TMDbApiKey);
            var imageHelper = new ImageHelper(restConnection);

            var connectionManager = new ConnectionManager(new Timer(), new LocalServerDiscovery(),
                restConnection, new MyPlexConnection(restConnection),
                new TvdbCache(tvdbConnection), new TmdbCache(tmdbConnection), new NowPlaying(imageHelper));
            
            Task.Factory.StartNew(async () =>
                {
                    ((INotifyCollectionChanged)connectionManager.NowPlaying.VideosNowPlaying).CollectionChanged += async (s, e) =>
                        {
                            foreach (var video in connectionManager.NowPlaying.VideosNowPlaying.ToList())
                            {
                                Console.WriteLine("Loading external data for: " + video.Title);
                                await connectionManager.PopulateFromExternalSourcesAsync(video, false);

                                WriteVideo(video);

                                var role = video.Roles.FirstOrDefault();
                                if (role != null)
                                {
                                    await connectionManager.PopulateFromExternalSourcesAsync(role, false);
                                    Console.WriteLine(role.Tag + " starred in " + role.CastCredits.Count);
                                    if (role.CastCredits.Any())
                                        Console.WriteLine("  " + role.CastCredits[0].Title + " (" + role.CastCredits[0].Role + ") " + role.CastCredits[0].ReleaseDate.Year);
                                }
                            }
                        };

                    Console.WriteLine("Connecting to MyPlex...");
                    await connectionManager.ConnectToMyPlexAsync(TestConstants.MyPlexUserName, TestConstants.MyPlexPassword);

                    Console.WriteLine("Connecting...");
                    await connectionManager.ConnectAsync();

                    Console.WriteLine("Waiting for videos...");
                });

            Console.WriteLine("Press any key to exit");

            Console.ReadKey();
        }
예제 #17
0
        public List <Entity> Consultar(Entity entidade)
        {
            Profile Profile  = (Profile)entidade;
            string  endpoint = "profile/";
            string  json     = null;

            endpoint = endpoint + entidade.Id;
            json     = new RestConnection().GetRequest(endpoint);

            Profile objList = JsonConvert.DeserializeObject <Profile>(json);

            var objReturn = new List <Entity>();

            objReturn.Add(objList);

            return(objReturn);
        }
예제 #18
0
        public void Setup(RestConnection restConnection)
        {
            RestConnection = restConnection;

            // Create required dataservices
            CodeLocationDataService  = new CodeLocationResponseService(RestConnection);
            ScanSummariesDataService = new ScanSummariesResponseService(RestConnection);
            DeployBdioDataService    = new DeployBdioResponseService(RestConnection);
            ProjectDataService       = new ProjectResponseService(RestConnection);
            PolicyDataService        = new PolicyResponseService(RestConnection);
            RiskReportDataService    = new RiskReportResponseService(RestConnection);
            ScanStatusDataService    = new ScanStatusDataService(RestConnection, Convert.ToInt64(TimeSpan.FromSeconds(Convert.ToDouble(HubScanTimeout)).TotalMilliseconds));

            // Set helper properties
            BdioPropertyHelper bdioPropertyHelper = new BdioPropertyHelper();

            BdioId = bdioPropertyHelper.CreateBdioId(HubProjectName, HubVersionName);
        }
예제 #19
0
        public List <Entity> Alterar(Entity entidade)
        {
            string  json     = null;
            Address Address  = (Address)entidade;
            string  endpoint = "address";
            var     Body     = new Address {
                Id = Address.Id, Name = Address.Name
            };

            json = new RestConnection().PutRequest(endpoint, Body);

            Address objList = JsonConvert.DeserializeObject <Address>(json);

            var objReturn = new List <Entity>();

            objReturn.Add(objList);
            return(objReturn);
        }
예제 #20
0
        public List <Entity> Salvar(Entity entidade)
        {
            string json = null;
            var    User = (User)entidade;
            var    body = User;

            var resObj = VerificarExistencia(User);

            User objList;

            var objReturn = new List <Entity>();

            if (resObj == "inativo")
            {
                json    = new RestConnection().PutRequest("reactivateUser", body);
                objList = JsonConvert.DeserializeObject <User>(json);

                objReturn.Add(objList);

                return(objReturn);
            }


            if (User.FlgAdmin)
            {
                json = new RestConnection().PostRequest("admin", body);

                objList = JsonConvert.DeserializeObject <User>(json);

                objReturn.Add(objList);

                return(objReturn);
            }

            string endpoint = "user";

            json = new RestConnection().PostRequest(endpoint, body);

            objList = JsonConvert.DeserializeObject <User>(json);

            objReturn.Add(objList);

            return(objReturn);
        }
예제 #21
0
        public List <Entity> VerificarNick(Entity entidade)
        {
            Profile Profile   = (Profile)entidade;
            string  endpoint  = "profile/get-by-nick/" + Profile.NickName;
            string  json      = null;
            var     objReturn = new List <Entity>();

            try
            {
                json = new RestConnection().GetRequest(endpoint);
                Profile objList = JsonConvert.DeserializeObject <Profile>(json);
                objReturn.Add(objList);
            }
            catch (Exception)
            {
                return(objReturn);
            }
            return(objReturn);
        }
예제 #22
0
        public List <Entity> Alterar(Entity entidade)
        {
            string json     = null;
            var    User     = (User)entidade;
            string endpoint = "user";
            var    Body     = new User {
                Id = User.Id, Password = User.NewPassword
            };

            json = new RestConnection().PutRequest(endpoint, Body);

            User objList = JsonConvert.DeserializeObject <User>(json);

            var objReturn = new List <Entity>();

            objReturn.Add(objList);

            return(objReturn);
        }
예제 #23
0
        public List <Entity> Consultar(Entity entidade)
        {
            string json     = null;
            var    User     = (User)entidade;
            string endpoint = "login";
            var    Body     = new User {
                Email = User.Email, Password = User.Password
            };

            json = new RestConnection().PostRequest(endpoint, Body);

            User objList = JsonConvert.DeserializeObject <User>(json);

            var objReturn = new List <Entity>();

            objReturn.Add(objList);

            return(objReturn);
        }
예제 #24
0
        public List <Entity> Salvar(Entity entidade)
        {
            string  json      = null;
            Address Address   = (Address)entidade;
            string  endpoint  = "address";
            var     objReturn = new List <Entity>();

            try
            {
                json = new RestConnection().PostRequest(endpoint, Address);
                Address objList = JsonConvert.DeserializeObject <Address>(json);
                objReturn.Add(objList);
                return(objReturn);
            }
            catch (Exception)
            {
                return(objReturn);
            }
        }
예제 #25
0
        public List <Entity> Consultar(Entity entidade)
        {
            Address Address  = (Address)entidade;
            string  endpoint = "address/";
            string  json     = null;

            endpoint = endpoint + Address.ProfileId;
            json     = new RestConnection().GetRequest(endpoint);

            List <Address> objList = JsonConvert.DeserializeObject <List <Address> >(json);

            List <Entity> objReturn = new List <Entity>();

            foreach (var item in objList)
            {
                objReturn.Add(item);
            }
            return(objReturn);
        }
        public static IServiceCollection AddDependencyInjectionServiceModule(this IServiceCollection services,
                                                                             ConnectionStrings connectionStrings,
                                                                             HashIdConfiguration setting,
                                                                             RestConnection restConnection)
        {
            services.AddDbContext(connectionStrings.ContosoRetailDWConnection);
            services.AddIdentityContext(connectionStrings.DonVoIdentityJwtBearerConnection);
            services.AddSystemAuditContext(connectionStrings.DonVoSystemAuditConnection);

            HashHelper.Initialize(setting);

            // Injection All Services enter here.
            //---------------------------------------------------------------------------------------------
            services.AddTransient <IAccountService, AccountService>();
            services.AddTransient <ICustomerService, CustomerService>();
            services.AddTransient <IAccountingService, AccountingService>();
            services.AddTransient <IEmployeeService, EmployeeService>();
            services.AddTransient <IPromotionService, PromotionService>();
            services.AddTransient <ICurrencyService, CurrencyService>();
            services.AddTransient <IStoreService, StoreService>();
            services.AddTransient <IMachineService, MachineService>();
            services.AddTransient <IOutageService, OutageService>();
            services.AddTransient <IChannelService, ChannelService>();
            services.AddTransient <IEntityService, EntityService>();
            services.AddTransient <IScenarioService, ScenarioService>();
            services.AddTransient <IProductService, ProductService>();
            services.AddTransient <IProductCategoryService, ProductCategoryService>();
            services.AddTransient <IProductSubcategoryService, ProductSubcategoryService>();

            services.AddTransient <ISearchService, SearchService>();

            services.AddTransient <ISystemAuditRepository, SystemAuditRepository>();
            services.AddTransient <ISystemAuditService, SystemAuditService>();

            services.AddDataAnalysisService(restConnection.DataAnalysisUrl);

            services.AddMachineLearningService();

            //---------------------------------------------------------------------------------------------

            return(services);
        }
예제 #27
0
        protected override void OnActivated(EventArgs e)
        {
            bool b = RestConnection.GetRestConnection().TestConnectionAsync();

            if (!b)
            {
                if (MessageBox.Show("Application Server not found", "Internal Server Error", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK)
                {
                    Current.Shutdown();
                }
            }

            base.OnActivated(e);
            IMenuRegistryProvider registryProvider = ServiceLocator.Current.GetInstance <IMenuRegistryProvider>();

            registryProvider.InitializeMenu();
            IApplicationController controller = ServiceLocator.Current.GetInstance <IApplicationController>();

            controller.InitializeApplication();
        }
예제 #28
0
        public ClassroomMonitorViewModel(RestConnection restConnection, ISystemConfig config)
        {
            this.restConnection = restConnection;

            /*
             * Dictionary<string, string> parameters = new Dictionary<string, string>();
             * JObject jo = this.restConnection.Get("api/ClassRoomInfoMaint/GetAllClassRooms", parameters);
             *
             * if (jo.Value<bool>("success"))
             * {
             *  JArray ja = jo.Value<JArray>("data");
             *  if (null != ja)
             *  {
             *      Collection<ClassRoom> classrooms = ja.ToObject<Collection<ClassRoom>>();
             *      jo = this.restConnection.Post("api/TerminalInfo/QueryLastTerminalInfos", classrooms);
             *      if (jo.Value<bool>("success"))
             *      {
             *          ja = jo.Value<JArray>("data");
             *          if (null != ja)
             *          {
             *              Collection<TerminalInfo> terminalInfos = ja.ToObject<Collection<TerminalInfo>>();
             *              foreach (var terminalInfo in terminalInfos)
             *              {
             *                  ClassRoom classroom = classrooms.Where(p => p.TerminalId.Equals(terminalInfo.TerminalId)).FirstOrDefault();
             *                  if (null != classroom)
             *                  {
             *                      terminalInfo.Name = classroom.ClassroomBuilding.BuildingName + "_" + classroom.RoomNum;
             *                  }
             *              }
             *              TerminalInfos = new ObservableCollection<TerminalInfo>(terminalInfos);
             *          }
             *      }
             *  }
             *
             * }
             */
            TerminalInfos = new ObservableCollection <TerminalInfo>();

            refreshTerminalInfos();
        }
예제 #29
0
        internal async Task <TeamProject> GetOrCreateProjectAsync()
        {
            ProjectHttpClient projectClient = RestConnection.GetClient <ProjectHttpClient>();

            Logger.Log(LogLevel.Info, "Retreiving project info from Azure DevOps/TFS...");
            TeamProject project = null;

            try
            {
                project = await projectClient.GetProject(Settings.Project);
            }
            catch (Exception ex)
            {
                Logger.Log(ex, $"Failed to get Azure DevOps/TFS project '{Settings.Project}'.");
            }

            if (project == null)
            {
                project = await CreateProject(Settings.Project, $"{Settings.ProcessTemplate} project for Jira migration", Settings.ProcessTemplate);
            }

            return(project);
        }
예제 #30
0
        public ClassroomTreeViewModel(RestConnection restConnection, ISystemConfig config)
        {
            this.restConnection = restConnection;
            systemConfig        = config;
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("_dc", "1502368547501");
            parameters.Add("sWhere", "{}");
            parameters.Add("page", "1");
            parameters.Add("start", "0");
            parameters.Add("limit", "10");
            JObject jo = this.restConnection.Get("api/ClassroomBuilding/QueryClassroomBuildingsIncludeClassRooms", parameters);

            if (jo.Value <bool>("success"))
            {
                JArray ja = jo.Value <JArray>("data");
                if (null != ja)
                {
                    ClassroomBuildings = new ObservableCollection <ClassroomBuilding>(ja.ToObject <Collection <ClassroomBuilding> >());
                    foreach (var classroomBuilding in ClassroomBuildings)
                    {
                        //初始化全部教学楼选中
                        classroomBuilding.IsChecked        = true;
                        classroomBuilding.PropertyChanged += new PropertyChangedEventHandler(ClassroomBuildingCheckedChange);
                        foreach (var classroom in classroomBuilding.ClassRooms)
                        {
                            //初始化全部教室选中
                            classroom.IsChecked         = true;
                            classroom.Name              = classroomBuilding.BuildingName + "_" + classroom.RoomNum;
                            classroom.ClassroomBuilding = classroomBuilding;
                            classroom.PropertyChanged  += new PropertyChangedEventHandler(ClassroomCheckedChange);
                        }
                    }
                }
            }
        }
예제 #31
0
        public List <Entity> VerificarNome(Entity entidade)
        {
            Address Address   = (Address)entidade;
            string  endpoint  = "address/";
            var     objReturn = new List <Entity>();
            /// something ? color1 = red & color2 = blue
            string json = null;

            if (!String.IsNullOrEmpty(Address.Name))
            {
                endpoint = endpoint + Address.ProfileId + "?name=" + Address.Name;
            }
            try
            {
                json = new RestConnection().GetRequest(endpoint);
                Address objList = JsonConvert.DeserializeObject <Address>(json);
                objReturn.Add(objList);
            }
            catch (Exception)
            {
                return(objReturn);
            }
            return(objReturn);
        }
예제 #32
0
 /// <summary>
 /// Retrieves the account details
 /// </summary>
 public static Account Details()
 {
     RestConnection<Account> conn = new RestConnection<Account>();
     Account account = conn.InvokeGet("account");
     return account;
 }
예제 #33
0
 /// <summary>
 /// Generates a new API Token
 /// </summary>
 public static string NewToken()
 {
     RestConnection<string> conn = new RestConnection<string>();
     string token = conn.InvokeGet("new_token");
     return token;
 }