/// <summary>
        /// Обработчик события изменения выбранной культуры приложения. Выполняет запись куки-файла культуры в системе пользователя для использования при следующем запуске приложения.
        /// </summary>
        private Task CultureChanged()
        {
            string cookieName  = CookieRequestCultureProvider.DefaultCookieName;
            string cookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(CultureChanger.CurrentUICulture));

            Logger.LogInformation(Localizer["Запись куки-файла '{cookieName}' со значением '{cookieValue}'."], cookieName, cookieValue);

            return(InvokeAsync(async() =>
            {
                await JSWrapper
                .CreateCookie(cookieName, cookieValue, _userCultureCookieExpirationDays)
                .ConfigureAwait(true);
            }));
        }
예제 #2
0
 async Task <string> DoRequest <T>(string Method, T Data, long ID = 0, string API = "pastes")
 {
     try
     {
         var URL  = $"https://cadence.moe/api/{API}{(ID != 0 ? $"/{ID}" : "")}";
         var JSON = JsonConvert.SerializeObject(Data);
         return(await JSWrapper.Request(Method, URL, JSON));
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
         return(null);
     }
 }
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                await JSWrapper.ShowMainContainer().ConfigureAwait(true);
            }

            string?titleTemplate = Localizer["SiteTitle"];

            if (titleTemplate is not null)
            {
                string title = string.Format(
                    CultureInfo.CurrentCulture,
                    titleTemplate,
                    ResumeData.Name,
                    ResumeData.Surname);
                await HeadElementHelper.SetTitleAsync(title);
            }

            await base.OnAfterRenderAsync(firstRender).ConfigureAwait(true);
        }
예제 #4
0
        //Arun Geo Thomas
        private void JSTimer_Tick(object sender, EventArgs e)
        {
            Packet pkt = JSWrapper.GetJSPacket();

            if (pkt != null)
            {
                if (serialPortManager.IsConnected)
                {
                    Send_Packet(pkt);
                    lastSendTime = DateTime.Now;
                }
            }

            if ((DateTime.Now - lastSendTime).TotalMilliseconds > 100 && (DateTime.Now - lastHBSendTime).TotalMilliseconds > 100)
            {
                Send_Packet(Packet.Create_HeartBeatPacket());
                lastHBSendTime = DateTime.Now;
            }


            this.controlInputs1.UpdateValues = true;
        }