/// <summary>
 /// Initializes a new instance of the <see cref="T:VodManageSystem.Controllers.SongController"/> class.
 /// </summary>
 /// <param name="context">Context.</param>
 /// <param name="songsManager">Song manager.</param>
 /// <param name="languagesManager">Language manager.</param>
 /// <param name="singersManager">Singer manager.</param>
 public SongsController(KtvSystemDBContext context, SongsManager songsManager, LanguagesManager languagesManager, SingersManager singersManager)
 {
     _context          = context;
     _songsManager     = songsManager;
     _languagesManager = languagesManager;
     _singersManager   = singersManager;
 }
        public IActionResult Create()
        {
            var languagesManager = new LanguagesManager();

            ViewData["Language"] = new SelectList(languagesManager.AllowedLanguagesOfChoice, "Key", "Value");
            return(View());
        }
        public async Task <IActionResult> Create([Bind("UserName,PhoneNumber,Alias,Email,Password,ConfirmPassword,Language")] NewUser userForm)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser
                {
                    UserName    = userForm.Email,
                    Email       = userForm.Email,
                    Alias       = userForm.Alias,
                    PhoneNumber = userForm.PhoneNumber,
                    Language    = userForm.Language
                };
                var password = GenerateRandomPassword(_userManager.Options.Password);
                var result   = await _userManager.CreateAsync(user, password.ToString());

                if (result.Succeeded)
                {
                    var role = userForm.IsAdmin ? "Admin" : "User";
                    await _userManager.AddToRoleAsync(user, role);
                    await SendEmailConfirmation(user);

                    //TODO add view for new user details -> username, email, role, isConfirmed
                    return(View("Index", await _context.Set <ApplicationUser>().ToListAsync()));
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }
            var languagesManager = new LanguagesManager();

            ViewData["Language"] = new SelectList(languagesManager.AllowedLanguagesOfChoice, "Key", "Value");
            return(View());
        }
Beispiel #4
0
        /// <summary>
        /// Предоставляет размер в единицах, зависящих от размера
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns></returns>
        public static string GetSizeInStr(long bytes)
        {
            const int scale = 1024;

            //string[] orders = new string[] { Properties.Resources.GB,
            //    Properties.Resources.MB, Properties.Resources.KB,
            //    Properties.Resources.Bytes };

            OneLanguage lang = LanguagesManager.GetCurrLanguage();

            string[] orders = new string[] { lang.SFISGB,
                                             lang.SFISMB, lang.SFISKB, lang.SFISBytes };

            //OneLanguage lang = new OneLanguage();
            //lang.ResourceDictionary = new System.Windows.ResourceDictionary();
            //lang.ResourceDictionary.Source = new Uri("\\Languages\\en.xaml", UriKind.Relative);

            //string[] orders = new string[] { lang.SFISGB,
            //    lang.SFISMB, lang.SFISKB, lang.SFISBytes };

            long max = (long)Math.Pow(scale, orders.Length - 1);

            foreach (string order in orders)
            {
                if (bytes > max)
                {
                    return(string.Format("{0:##.##} {1}", decimal.Divide(bytes, max), order));
                }

                max /= scale;
            }
            return("0 " + lang.SFISBytes);
            //return "0 " + Properties.Resources.Bytes;
        }
Beispiel #5
0
        public ActionResult Enabled(int lid)
        {
            string       ResourcesFile = "~/DesktopModules/Vanjaro/UXManager/Extensions/Menu/" + ExtensionInfo.Name + "/Views/Setting/App_LocalResources/Languages.resx";
            ActionResult actionResult  = new ActionResult();
            Locale       language      = LocaleController.Instance.GetLocale(lid);

            if (language == null)
            {
                actionResult.AddError("InvalidLocale.ErrorMessage", string.Format(Localization.GetString("InvalidLocale.ErrorMessage", ResourcesFile), language.Code));
                return(actionResult);
            }
            if (PortalSettings.DefaultLanguage != language.Code)
            {
                if (LanguagesManager.IsLanguageEnabled(PortalSettings.PortalId, language.Code))
                {
                    //remove language from portal
                    Localization.RemoveLanguageFromPortal(PortalSettings.PortalId, language.LanguageId);
                    LanguagesManager.SetTabUrlsActiveToRedirect(language.LanguageId);
                }
                else
                {
                    //Add language to portal
                    Localization.AddLanguageToPortal(PortalSettings.PortalId, language.LanguageId, true);
                    LanguagesManager.UpdateTabUrlsDefaultLocale();
                }
            }
            actionResult.Data      = LanguagesManager.GetLanguages(PortalSettings, UserInfo);
            actionResult.IsSuccess = true;
            return(actionResult);
        }
Beispiel #6
0
        public static void Main(string[] args)
        {
            Environment.ExitCode = 0;
            ManagerBehaviorSettings settings = new ManagerBehaviorSettings();

            settings.RequestLanguageIfNotSpecified = true;
            settings.UseToolGeneratedConfigFile    = true;
            LanguagesManager localManager = new LanguagesManager(new System.Collections.ObjectModel.ReadOnlyCollection <string>(new string[] { "md5 Program" }), Directories.LocalsFolder, "BUtil", settings);

            localManager.Init();
            localManager.Apply();

            // applying locals
            _Usage                        = Translation.Current[488];
            _EnterCommand                 = Translation.Current[489];
            _AskEnterArguments            = Translation.Current[490];
            _Md5OfPackerFormatString      = Translation.Current[491];
            _OperationFailledFormatString = Translation.Current[492];
            _EnterParam1                  = Translation.Current[493];
            _EnterParam2                  = Translation.Current[494];
            _Ok                    = Translation.Current[495];
            _Bad                   = Translation.Current[496];
            _Md5Commands           = Translation.Current[497];
            _Md5Question           = Translation.Current[498];
            _NoParameters          = Translation.Current[499];
            _InvalidOperation      = Translation.Current[500];
            _InputFileNotSpecified = Translation.Current[501];
            _PressKeyToQuit        = Translation.Current[502];

            main(args);
            Console.WriteLine(_PressKeyToQuit);
            Console.ReadKey();
            Console.WriteLine(Environment.NewLine);
            Console.WriteLine(_COPYRIGHT);
        }
Beispiel #7
0
        public LanguageSelector()
        {
            InitializeComponent();

            if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            {
                languagesManager = new LanguagesManager();
                languagesManager.ChangeLanguage += new LanguagesManager.ChangeLanguagesEventHandler(languagesManager_ChangeLanguage);

                //this.Content = languagesManager.CurrLanguage.Name;
                // this.tbData.Text = languagesManager.CurrLanguage.Name;

                ExplorerNet.Tools.SkinManager.ChangedSkin += delegate(Object sender, string skin)
                {
                    Style stl = (Style)App.Current.Resources[typeof(Button)];

                    this.Style = stl;

                    //Style stl = new Style(this.GetType());
                    //stl.BasedOn = new Style(typeof(Button));
                    //stl.TargetType = this.GetType();

                    //this.Style = stl;

                    //this.UpdateLayout();
                };
            }
        }
 protected void SetCurrentLanguage(string language)
 {
     if (!string.IsNullOrWhiteSpace(language))
     {
         LanguagesManager.SetLanguage(language);
         ViewBag.Culture = language;
     }
 }
        /// <summary>
        /// Обновить список языков
        /// </summary>
        private void RefreshLanguages()
        {
            LanguagesManager lm = new LanguagesManager();

            languages = lm.GetAllOneLanguages();

            SelectedLanguage = lm.CurrLanguage;
        }
 public ActionResult SetLanguage(string lang, string returnUrl)
 {
     LanguagesManager.SetLanguage(lang);
     if (Url.IsLocalUrl(returnUrl))
     {
         return(Redirect(returnUrl));
     }
     return(RedirectToAction("Index", "Home"));
 }
Beispiel #11
0
        public ActionResult GetAll(bool IsNativeName)
        {
            ActionResult result = new ActionResult
            {
                Data      = LanguagesManager.GetAllLanguages(IsNativeName),
                IsSuccess = true
            };

            return(result);
        }
Beispiel #12
0
        /// <summary>
        /// Loads the locals
        /// </summary>
        static void loadLocalization()
        {
            ManagerBehaviorSettings settings = new ManagerBehaviorSettings();

            settings.RequestLanguageIfNotSpecified = true;
            settings.UseToolGeneratedConfigFile    = true;
            LanguagesManager localManager = new LanguagesManager(new System.Collections.ObjectModel.ReadOnlyCollection <string>(new string[] { "Ghost Program", "Core Library" }), Directories.LocalsFolder, "BUtil", settings);

            localManager.Init();
            localManager.Apply();
        }
Beispiel #13
0
        /// <summary>
        /// Loading the localization
        /// </summary>
        static void LoadLanguage()
        {
            var settings = new ManagerBehaviorSettings
            {
                RequestLanguageIfNotSpecified = true,
                UseToolGeneratedConfigFile    = true
            };

            _localsManager = new LanguagesManager(new ReadOnlyCollection <string>(new [] { "Configurator Program", "Core Library", }), Directories.LocalsFolder, "BUtil", settings);
            _localsManager.Init();
            _localsManager.Apply();
        }
Beispiel #14
0
        public ActionResult GetLanguages()
        {
            ActionResult actionResult = new ActionResult();

            if (!UserInfo.IsSuperUser)
            {
                actionResult.AddError("AuthFailureMessage", Constants.AuthFailureMessage);
                return(actionResult);
            }
            actionResult.Data      = LanguagesManager.GetLanguages(PortalSettings, UserInfo);
            actionResult.IsSuccess = true;
            return(actionResult);
        }
Beispiel #15
0
        internal static List <IUIData> GetData(PortalSettings PortalSettings, UserInfo UserInfo)
        {
            Dictionary <string, IUIData> Settings = new Dictionary <string, IUIData>
            {
                { "Languages", new UIData {
                      Name = "Languages", Options = LanguagesManager.GetLanguages(PortalSettings, UserInfo)
                  } },
                { "IsSuperUser", new UIData {
                      Name = "IsSuperUser", Value = UserInfo.IsSuperUser.ToString()
                  } }
            };

            return(Settings.Values.ToList());
        }
Beispiel #16
0
        private void SwitchCulture(string cultureName)
        {
            var languagesManager = new LanguagesManager();

            cultureName         = languagesManager.CheckAndReturnAppropriateCulture(cultureName);
            CulturedBot.Culture = new CultureInfo(cultureName);
            OpportunityConfidenceValue.Culture = new CultureInfo(cultureName);
            OpportunityStatusValue.Culture     = new CultureInfo(cultureName);

            if (!_services.LuisServices.ContainsKey(CulturedBot.LuisAppName))
            {
                throw new System.ArgumentException($"The bot configuration does not contain a service type of `luis` with the id `{CulturedBot.LuisAppName}`.");
            }
        }
Beispiel #17
0
        internal static List <IUIData> GetData(int portalId)
        {
            Dictionary <string, IUIData> Settings = new Dictionary <string, IUIData>();
            string language = string.Empty;
            List <LanguageRequest> Languages = LanguagesManager.GetAllLanguages(false);

            if (Languages.Count > 0)
            {
                language = Languages.FirstOrDefault().Code;
            }

            Settings.Add("Languages", new UIData {
                Name = "Languages", Options = Languages, OptionsValue = "Code", OptionsText = "DisplayName", Value = language
            });
            return(Settings.Values.ToList());
        }
Beispiel #18
0
        public static StackPanel GetSizeInStrWPF(long bytes)
        {
            StackPanel sp = new StackPanel();

            sp.Orientation = Orientation.Horizontal;
            TextBlock tbSize = new TextBlock();
            TextBlock tbAttr = new TextBlock();

            tbAttr.Margin = new System.Windows.Thickness(5, 0, 0, 0);
            sp.Children.Add(tbSize);
            sp.Children.Add(tbAttr);

            const int scale = 1024;

            OneLanguage lang = LanguagesManager.GetCurrLanguage();

            string[] orders = new string[] { "SFISGB",
                                             "SFISMB", "SFISKB", "SFISBytes" };


            long max = (long)Math.Pow(scale, orders.Length - 1);

            foreach (string order in orders)
            {
                if (bytes > max)
                {
                    tbSize.Text = string.Format("{0:##.##}", decimal.Divide(bytes, max));
                    //tbAttr.Text = order;

                    tbAttr.SetResourceReference(TextBlock.TextProperty, order);

                    return(sp);
                }


                max /= scale;
            }
            tbSize.Text = "0";
            tbAttr.SetResourceReference(TextBlock.TextProperty, "SFISBytes");
            //tbAttr.Text = lang.SFISBytes;


            return(sp);

            //return "0 " + lang.SFISBytes;
        }
        private static void LoadLocals()
        {
            try
            {
                var namespaces = new [] { "Core Library", "Console backup Program" };
                var collection = new ReadOnlyCollection <string>(namespaces);
                var settings   = new ManagerBehaviorSettings();
                settings.RequestLanguageIfNotSpecified = false;
                settings.UseToolGeneratedConfigFile    = true;

                var manager = new LanguagesManager(collection, Directories.LocalsFolder, "BUtil", settings);
                manager.Init();
            }
            catch (Exception exc)
            {
                ShowErrorAndQuit(string.Format(CultureInfo.InstalledUICulture, "Could not load locals due to {0}", exc.Message));
            }
        }
        //get cultureInfo and then get short language name (ex. ua, ru) from it.
        //after that set the value to ViewBag.Language in SetCurrentLanguage method
        protected override IAsyncResult BeginExecuteCore(AsyncCallback callback, object state)
        {
            string userLanguage;

            HttpCookie langCookie = Request.Cookies["culture"];

            if (langCookie != null)
            {
                userLanguage = langCookie.Value;
            }
            else
            {
                var userLang = Request.UserLanguages != null ? Request.UserLanguages[0] : string.Empty;
                userLanguage = string.IsNullOrEmpty(userLang) ? LanguagesManager.GetDefaultLanguage() : userLang;
            }
            SetCurrentLanguage(userLanguage);

            return(base.BeginExecuteCore(callback, state));
        }
Beispiel #21
0
        public async Task <IActionResult> OnGetAsync()
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."));
            }

            var userName = await _userManager.GetUserNameAsync(user);

            var email = await _userManager.GetEmailAsync(user);

            var phoneNumber = await _userManager.GetPhoneNumberAsync(user);

            var language = user.Language;
            var alias    = user.Alias;

            Username = userName;

            Input = new InputModel
            {
                Email       = email,
                PhoneNumber = phoneNumber,
                Language    = language,
                Alias       = alias
            };

            IsEmailConfirmed = await _userManager.IsEmailConfirmedAsync(user);

            var languagesManager = new LanguagesManager();

            SelectedValue = Input.Language;
            Options       = new SelectList(languagesManager.AllowedLanguagesOfChoice, "Key", "Value", Input.Language);
            var test = Options;

            return(Page());
        }
Beispiel #22
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                var user = await UserManager.FindByNameAsync(model.UserName);

                if (user != null)
                {
                    LanguagesManager.SetLanguage(user.Language);
                    user.LastLoginTime = DateTime.Now;
                    await UserManager.UpdateAsync(user);
                }
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", Lexicon.InvalidLoginAttempt);
                return(View(model));
            }
        }
 public LanguagesController(KtvSystemDBContext context, LanguagesManager languagesManager)
 {
     _context          = context;
     _languagesManager = languagesManager;
 }
Beispiel #24
0
        /// <summary>
        /// Создаёт отражение участка файловой системы
        /// </summary>
        /// <param name="directory"></param>
        private void _BuildFileSystemView(DirectoryInfo directory)
        {
            //Очищаем список
            //lvFileList.Items.Clear();
            lvFileList.ItemsSource = null;


            _currentDirectory = directory;

            List <CustomFileSystemCover> list = new List <CustomFileSystemCover>();

            //CustomFileSystemCover cover = null;

            //lvFileList.ItemContainerGenerator.StatusChanged +=
            //        delegate(Object sender, EventArgs e)
            //        {
            //            ListViewItem lvi = (ListViewItem)lvFileList.ItemContainerGenerator.ContainerFromItem(cover);
            //            if (lvi != null)
            //            {
            //                lvi.PreviewMouseLeftButtonDown += delegate(Object sender, MouseButtonEventArgs e)
            //                {
            //                    DragDrop.do
            //                }
            //            }

            //        };

            // Если у текущего каталога есть родительский каталог, создаём елемент, дающий возможность
            // перейти в родительский каталог
            if (directory.Parent != null)
            {
                ParentDirectoryCover cover = new ParentDirectoryCover(directory.Parent);
                list.Add(cover);
                //lvFileList.Items.Add(cover);
            }

            // Создаём елементы отражающие директории
            try
            {
                foreach (var dir in directory.GetDirectories())
                {
                    DirectoryCover cover = new DirectoryCover(dir);

                    list.Add(cover);

                    #region comments Этот вариант был исправлен на более правельный

                    //Получаем ListViewItem, когда он будет создан и подписываемся на его события
                    //lvFileList.ItemContainerGenerator.StatusChanged +=
                    //    delegate(Object sender, EventArgs e)
                    //    {
                    //        ListViewItem lvi = (ListViewItem)lvFileList.ItemContainerGenerator.ContainerFromItem(cover);
                    //        if (lvi != null)
                    //        {
                    //            lvi.AllowDrop = true;

                    //            //Список событий. Сделан чтобы не подписываться много раз на одно событие
                    //            List<string> eventList = null;
                    //            if (lvi.Tag == null)
                    //            {
                    //                eventList = new List<string>();
                    //                lvi.Tag = eventList;
                    //            }
                    //            else
                    //            {
                    //                eventList = (List<string>)lvi.Tag;
                    //            }

                    //Если события нет в списке, то подписываемся на него
                    //if (!eventList.Contains("DragEnter"))
                    //{
                    //    eventList.Add("DragEnter");
                    //    lvi.DragEnter += delegate(Object sender1, DragEventArgs e1)
                    //    {
                    //        if (e1.Effects == DragDropEffects.Move)
                    //        {
                    //            lvi.Opacity = 0.5;
                    //        }
                    //    };
                    //}

                    //Если события нет в списке, то подписываемся на него
                    //if (!eventList.Contains("DragLeave"))
                    //{
                    //    eventList.Add("DragLeave");
                    //    lvi.DragLeave += delegate(Object sender1, DragEventArgs e1)
                    //    {
                    //        lvi.Opacity = 1;
                    //    };
                    //}

                    //Если события нет в списке, то подписываемся на него
                    //if (!eventList.Contains("Drop"))
                    //{
                    //    eventList.Add("Drop");
                    //    lvi.Drop += delegate(Object sender1, DragEventArgs e1)
                    //    {
                    //        lvi.Opacity = 1;
                    //        DataObject dObj = (DataObject)e1.Data;

                    //        //Делаем не возможным обрабатывать Drop lvFileList
                    //        this.isListViewDroped = false;

                    //        if (dObj.GetDataPresent(typeof(List<CustomFileSystemCover>)))
                    //        {
                    //            // If the desired data format is present, use one of the GetData methods to retrieve the
                    //            // data from the data object.
                    //            List<CustomFileSystemCover> selectedList = dObj.GetData(typeof(List<CustomFileSystemCover>))
                    //                as List<CustomFileSystemCover>;

                    //            //MessageBox.Show(selectedList[0].Name);
                    //            List<FileSystemInfo> fsiList = new List<FileSystemInfo>();

                    //            foreach (var sl in selectedList)
                    //            {
                    //                if (sl.FileSystemElement.GetType() == typeof(DirectoryInfo))
                    //                {
                    //                    fsiList.Add(new DirectoryInfo(sl.FileSystemElement.FullName));
                    //                }
                    //                else if (sl.FileSystemElement.GetType() == typeof(FileInfo))
                    //                {
                    //                    fsiList.Add(new FileInfo(sl.FileSystemElement.FullName));
                    //                }
                    //                else
                    //                {
                    //                    new Exception("Type not support!");
                    //                }
                    //            }

                    //            DirectoryCover dc = (DirectoryCover)lvi.Content;


                    //            CopyWindow cw = new CopyWindow(fsiList, dc.FileSystemElement.FullName);
                    //            cw.ShowDialog();

                    //        }

                    //        //DragDrop.RemovePreviewDropHandler(lvFileList, lvFileList_Drop);
                    //    };
                    //}

                    //}
                    //};
                    #endregion //comments
                }
            }
            catch (Exception)
            {
                MessageBox.Show(LanguagesManager.GetCurrLanguage().FPIsNotAccess, "",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
                this.Path = System.IO.Path.GetDirectoryName(this.Path);
                return;
            }

            // Создаём елементы отражающие файлы
            foreach (var file in directory.GetFiles())
            {
                FileCover cover = new FileCover(file);

                list.Add(cover);
                //lvFileList.Items.Add(cover);
            }

            //list.Sort(new NameUpSorter());
            SortingManager.Sort(list, SortingKind.NameUp);

            lvFileList.ItemsSource = list;

            // Задаём в текстовом поле текущий путь
            txtPath.Text = directory.FullName;

            this.watcher.Path = directory.FullName;
            //this.watcher.Changed += new FileSystemEventHandler(watcher_Changed);
            this.watcher.EnableRaisingEvents = true;
        }
 public ConfiguratorController(LanguagesManager manager)
 {
     _localsManager = manager;
 }
 /// <summary>
 /// Открыть директория файлов с языками приложения
 /// </summary>
 private void OpenLangDir()
 {
     Languages.LanguagesManager lm = new LanguagesManager();
     System.Diagnostics.Process.Start(lm.LanguagesDirPath);
 }
        /// <summary>
        /// Получаем или задаём язык приложения
        /// </summary>
        /// <param name="lang"></param>
        private void ChangeLanguage(OneLanguage lang)
        {
            LanguagesManager lm = new LanguagesManager();

            lm.ChangeOneLanguage(lang);
        }
Beispiel #28
0
 public ActionResult Update(string Code)
 {
     return(LanguagesManager.Update(PortalSettings, UserInfo, Code));
 }
Beispiel #29
0
        private async System.Threading.Tasks.Task HandleIncomingBotMessagesAsync(IList <Activity> botReplies, string callSid)
        {
            var voiceResponse    = new VoiceResponse();
            var says             = new StringBuilder();
            var forwardingNumber = string.Empty;
            var forward          = false;
            var error            = false;
            var errorMessage     = string.Empty;

            foreach (var activity in botReplies)
            {
                var languagesManager = new LanguagesManager();
                var localeCulture    = languagesManager.CheckAndReturnAppropriateCulture(activity.Locale);
                CultureInfo.CurrentCulture = new CultureInfo(localeCulture);

                //Using TTS to repond to the caller
                var ttsResponse = await System.Threading.Tasks.Task.Run(() =>
                                                                        _textToSpeech.TransformTextToSpeechAsync(activity.Text, CultureInfo.CurrentCulture.Name));

                var wavGuid = Guid.NewGuid();
                var pathToAudioDirectory = _hostingEnvironment.WebRootPath + "/audio";
                var pathCombined         = Path.Combine(pathToAudioDirectory, $"{ wavGuid }.wav");
                var formatConverter      = new FormatConvertor();
                await formatConverter.TurnAudioStreamToFile(ttsResponse, pathCombined);

                voiceResponse.Play(new Uri($"{_directlineConfig.Host}audio/{wavGuid}.wav"));

                if (activity.Entities != null)
                {
                    foreach (var entity in activity.Entities)
                    {
                        forward          = entity.Properties.TryGetValue("forward", out var numberJToken);
                        forwardingNumber = forward ? numberJToken.ToString() : string.Empty;

                        error = entity.Properties.TryGetValue("error", out var errorMessageJToken);
                        if (error)
                        {
                            break;
                        }
                    }
                }
            }

            if (error)
            {
                voiceResponse.Hangup();
            }
            else if (forward)
            {
                voiceResponse.Dial(number: forwardingNumber);
            }
            else
            {
                voiceResponse.Gather(
                    input: new List <Gather.InputEnum> {
                    Gather.InputEnum.Speech
                },
                    language: CultureInfo.CurrentCulture.Name,
                    action: new Uri($"{_directlineConfig.Host}api/voice/send"),
                    method: HttpMethod.Get,
                    speechTimeout: "auto",
                    hints: _hints
                    );
            }

            var xmlFileName        = Guid.NewGuid();
            var pathToXMLDirectory = _hostingEnvironment.WebRootPath + "/xml";

            System.IO.File.WriteAllText($"{pathToXMLDirectory}/{xmlFileName}.xml", voiceResponse.ToString());

            CallResource.Update(
                method: HttpMethod.Get,
                url: new Uri($"{_directlineConfig.Host}xml/{xmlFileName}.xml"),
                pathSid: callSid
                );
        }
Beispiel #30
0
        /// <summary>
        /// Заполняем элементы управления данными
        /// </summary>
        private void ShowDriveData()
        {
            DriveData driveData = new DriveData(drive);

            txtSize.Text = driveData.LongSize;

            try
            {
                pbSize.Maximum = driveData.MaximumSize;
                pbSize.Value   = driveData.MaximumSize -
                                 driveData.AvailableFreeSpace;
            }
            catch (Exception)
            {
                //pbSize.MaxWidth = 300;
            }

            imgDriveType.Source = driveData.DriveIcon;

            //txtInfo.Text = string.Format("name:{0} type:{1}",
            //    drive.Name[0].ToString(), drive.DriveType);
            txtDriveLabel.Text = driveData.VolumeLabel;
            txtDriveName.Text  = driveData.Drive.Name[0].ToString();
            txtDriveType.Text  = driveData.Drive.DriveType.ToString();

            if (!driveData.Drive.IsReady)
            {
                //txtSize.Text = Properties.Resources.TheDriveIsNotReady;
                txtSize.Text = LanguagesManager.GetCurrLanguage().DDDriveIsNotReady;
            }

            //if (drive.IsReady)
            //{
            //    string totalShort = SizeFileInString.GetSizeInStr(drive.TotalSize);
            //    string totalLong = drive.TotalSize.ToString();

            //    string availableShort = SizeFileInString.GetSizeInStr(drive.AvailableFreeSpace);
            //    string availableLong = drive.AvailableFreeSpace.ToString();

            //    txtSize.Text = string.Format("Free: {0} from {1} ({2} from {3})", availableShort, totalShort, availableLong, totalLong);

            //    pbSize.Maximum = drive.TotalSize;

            //    try
            //    {
            //        pbSize.Value = drive.TotalSize - drive.AvailableFreeSpace;
            //    }
            //    catch (Exception)
            //    {

            //    }

            //    txtInfo.Text = string.Format("name:{0} label:{1} type:{2}",
            //        drive.Name[0].ToString(), drive.VolumeLabel, drive.DriveType);

            //}
            //else
            //{
            //    txtInfo.Text = string.Format("name:{0} type:{1}",
            //        drive.Name[0].ToString(), drive.DriveType);
            //    txtSize.Text = "The drive is not read";
            //}

            //switch (drive.DriveType)
            //{
            //    case DriveType.CDRom:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_cdrom.ico", UriKind.Relative));
            //        break;
            //    case DriveType.Fixed:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_fixed.ico", UriKind.Relative));
            //        break;
            //    case DriveType.Network:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_network.ico", UriKind.Relative));
            //        break;
            //    case DriveType.NoRootDirectory:
            //        break;
            //    case DriveType.Ram:
            //        break;
            //    case DriveType.Removable:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_removable.ico", UriKind.Relative));
            //        break;
            //    case DriveType.Unknown:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_unknown.ico", UriKind.Relative));
            //        break;
            //    default:
            //        break;
            //}
        }