Пример #1
0
        public static void EditLocalizedGreeting(WOSI.CallButler.Data.CallButlerDataset greetingsData, Guid greetingID, string languageID, string suggestedText)
        {
            global::Controls.LoadingDialog.ShowDialog(null, CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.GreetingUtils_SavingSounds), Properties.Resources.loading, false, 1000);

            WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable localizedGreetings = ManagementInterfaceClient.ManagementInterface.GetLocalizedGreeting(ManagementInterfaceClient.AuthInfo, greetingID, languageID);
            WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow localizedGreeting;

            // If the localized greeting doesn't exist, create one
            if (localizedGreetings.Count > 0)
            {
                localizedGreeting = localizedGreetings[0];
            }
            else
            {
                localizedGreeting = localizedGreetings.NewLocalizedGreetingsRow();
                localizedGreeting.GreetingID = greetingID;
                localizedGreeting.LocalizedGreetingID = Guid.NewGuid();
                localizedGreeting.LanguageID = languageID;
                localizedGreeting.Type = (short)WOSI.CallButler.Data.GreetingType.TextGreeting;

                localizedGreetings.AddLocalizedGreetingsRow(localizedGreeting);
            }

            // Download our localized greeting sound
            GetLocalizedGreetingSound(localizedGreeting);

            Forms.GreetingForm greetingForm = new CallButler.Manager.Forms.GreetingForm();
            greetingForm.SuggestedText = suggestedText;
            greetingForm.GreetingControl.LoadGreeting(localizedGreeting, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache));

            if (greetingForm.ShowDialog() == DialogResult.OK)
            {
                greetingForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache));

                // Save our greeting remotely
                ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, localizedGreetings);

                // Upload our greeting file
                PersistLocalizedGreetingSound(localizedGreeting);
            }

            global::Controls.LoadingDialog.HideDialog();
        }
Пример #2
0
        public static void EditLocalizedGreeting(WOSI.CallButler.Data.CallButlerDataset greetingsData, Guid greetingID, string languageID, string suggestedText)
        {
            global::Controls.LoadingDialog.ShowDialog(null, CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.GreetingUtils_SavingSounds), Properties.Resources.loading, false, 1000);

            WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable localizedGreetings = ManagementInterfaceClient.ManagementInterface.GetLocalizedGreeting(ManagementInterfaceClient.AuthInfo, greetingID, languageID);
            WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow       localizedGreeting;

            // If the localized greeting doesn't exist, create one
            if (localizedGreetings.Count > 0)
            {
                localizedGreeting = localizedGreetings[0];
            }
            else
            {
                localizedGreeting                     = localizedGreetings.NewLocalizedGreetingsRow();
                localizedGreeting.GreetingID          = greetingID;
                localizedGreeting.LocalizedGreetingID = Guid.NewGuid();
                localizedGreeting.LanguageID          = languageID;
                localizedGreeting.Type                = (short)WOSI.CallButler.Data.GreetingType.TextGreeting;

                localizedGreetings.AddLocalizedGreetingsRow(localizedGreeting);
            }

            // Download our localized greeting sound
            GetLocalizedGreetingSound(localizedGreeting);

            Forms.GreetingForm greetingForm = new CallButler.Manager.Forms.GreetingForm();
            greetingForm.SuggestedText = suggestedText;
            greetingForm.GreetingControl.LoadGreeting(localizedGreeting, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache));

            if (greetingForm.ShowDialog() == DialogResult.OK)
            {
                greetingForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache));

                // Save our greeting remotely
                ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, localizedGreetings);

                // Upload our greeting file
                PersistLocalizedGreetingSound(localizedGreeting);
            }

            global::Controls.LoadingDialog.HideDialog();
        }