Ejemplo n.º 1
0
        public void SendApplicationEmailToDeveloper(Application application)
        {
            var sysEMail  = PreferenceService.GetTyped <EmailInfo>(Preference.SYSTEM_EMAIL);
            var mail      = PrepareDefaultMail(sysEMail);
            var developer = application.Developer;

            switch (application.State)
            {
            case ApplicationStateEnum.Approved:
                mail.Subject = PreferenceService.Get(Preference.APPLICATION_APPROVED_EMAIL_SUBJECT).Value;
                var confirmationKey = developer.User.ConfirmationKey;
                var url             = string.Format(developerConfirmUrlFormat, PreferenceService.Get(Preference.APPLICATION_URL).Value
                                                    , confirmationKey, application.Id);
                mail.Body = string.Format(PreferenceService.Get(Preference.APPLICATION_APPROVED_EMAIL_BODY).Value,
                                          application.Name, developer.Name, url);
                break;

            case ApplicationStateEnum.Rejected:
                mail.Subject = PreferenceService.Get(Preference.APPLICATION_REJECTED_EMAIL_SUBJECT).Value;
                mail.Body    = string.Format(PreferenceService.Get(Preference.APPLICATION_REJECTED_EMAIL_BODY).Value,
                                             application.Name, developer.DisplayName);
                break;

            default: throw new ChalkableException(ChlkResources.EMAIL_INCORRECT_APP_STATE);
            }
            if (EmailTools.IsValidEmailAddress(developer.Email))
            {
                mail.To.Add(developer.Email);
            }
            SendMail(mail, sysEMail);
        }
Ejemplo n.º 2
0
        public Guid?GetAssessmentId()
        {
            var  id = PreferenceService.Get(Context.AssessmentEnabled || Context.SCEnabled ? Preference.ASSESSMENT_APLICATION_ID : null).Value;
            Guid res;

            return(Guid.TryParse(id, out res) ? res : (Guid?)null);
        }
        private PreferenceService CreatePreferenceService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new PreferenceService(userId);

            return(service);
        }
Ejemplo n.º 4
0
        private void InstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null)
            {
                return;
            }

            service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters;

            pref_page = new Banshee.Preferences.SourcePage("audio-cd", Catalog.GetString("Audio CDs"), "media-cdrom", 400);

            pref_section           = pref_page.Add(new Section("audio-cd", Catalog.GetString("Audio CD Importing"), 20));
            pref_section.ShowLabel = false;

            pref_section.Add(new VoidPreference("import-profile", Catalog.GetString("_Import format")));
            pref_section.Add(new VoidPreference("import-profile-desc"));

            pref_section.Add(new SchemaPreference <bool> (AutoRip,
                                                          Catalog.GetString("_Automatically import audio CDs when inserted"),
                                                          Catalog.GetString("When an audio CD is inserted, automatically begin importing it " +
                                                                            "if metadata can be found and it is not already in the library.")));

            pref_section.Add(new SchemaPreference <bool> (EjectAfterRipped,
                                                          Catalog.GetString("_Eject when done importing"),
                                                          Catalog.GetString("When an audio CD has been imported, automatically eject it.")));

            pref_section.Add(new SchemaPreference <bool> (ErrorCorrection,
                                                          Catalog.GetString("Use error correction when importing"),
                                                          Catalog.GetString("Error correction tries to work around problem areas on a disc, such " +
                                                                            "as surface scratches, but will slow down importing substantially.")));
        }
Ejemplo n.º 5
0
 public FileCommand()
 {
     cts  = new CancellationTokenSource();
     file = new FileService(cts.Token);
     pref = new PreferenceService(cts.Token);
     idx  = new IndexService(cts.Token);
 }
        public static void Load(PreferenceService service)
        {
            Page music = ServiceManager.SourceManager.MusicLibrary.PreferencesPage;

            foreach (LibrarySource source in ServiceManager.SourceManager.FindSources <LibrarySource> ())
            {
                new LibraryLocationButton(source);
            }

            PreferenceBase folder_pattern = music["file-system"]["folder_pattern"];

            folder_pattern.DisplayWidget = new PatternComboBox(folder_pattern, FileNamePattern.SuggestedFolders);

            PreferenceBase file_pattern = music["file-system"]["file_pattern"];

            file_pattern.DisplayWidget = new PatternComboBox(file_pattern, FileNamePattern.SuggestedFiles);

            PreferenceBase pattern_display = music["file-system"].FindOrAdd(new VoidPreference("file_folder_pattern"));

            pattern_display.DisplayWidget = new PatternDisplay(folder_pattern.DisplayWidget, file_pattern.DisplayWidget);

            // Set up the extensions tab UI
            Banshee.Addins.Gui.AddinView view = new Banshee.Addins.Gui.AddinView();
            view.Show();

            Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow();
            scroll.HscrollbarPolicy = PolicyType.Never;
            scroll.AddWithViewport(view);
            scroll.Show();

            service["extensions"].DisplayWidget = scroll;
        }
Ejemplo n.º 7
0
 public async Task ExecuteNupkgCmd()
 {
     try {
         var proj = SelectedFile as Project;
         if (proj == null)
         {
             MessageBox.Show($"File is not a .csproj or .vbproj", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         var outputPath = (await PreferenceService.GetSetting(Settings.NugetDefaultOutputPath))?.ValueString;
         var workingDir = Path.GetDirectoryName(proj.Path);
         var cmd        = "";
         if (OptionPack)
         {
             cmd = Nuget.Init().Pack(proj.Path).OutputDirectory(outputPath).Properties().Configuration().Out;
         }
         if (OptionRestore)
         {
         }
         await _runNuget.RunAsync(cmd, workingDir);
         await UpdateFilesData();
     } catch (Exception ex) {
         MessageBox.Show($"Execute Nupkg Cmd:\r\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 8
0
 public override async Task <bool> Refresh()
 {
     if (CanRefresh())
     {
         Preferences         = PreferenceService.GetOrCreate <SoundsGeneratorPreferences>();
         soundEventValidator = null; // will lazy load itself when needed
         if (Explorer.Folders != null)
         {
             Explorer.Folders.FilesChanged -= SubscribeFolderEvents;
             Explorer.Folders.Clear();
         }
         ((SoundEventsFinder)Explorer.FileSynchronizer.Finder).Initialize(SessionContext.SelectedMod.ModInfo.Name, SessionContext.SelectedMod.ModInfo.Modid);
         ((SoundEventsFactory)Explorer.FileSynchronizer.Finder.Factory).SoundEvents = Explorer.Folders;
         Explorer.Folders.AddRange(await Explorer.FileSynchronizer.Finder.FindFoldersAsync(FoldersJsonFilePath, true));
         Explorer.FileSynchronizer.RootPath            = FoldersRootPath;
         Explorer.FileSynchronizer.SynchronizingObject = SyncInvokeObject.Default;
         Explorer.FileSynchronizer.SetEnableSynchronization(true);
         RaisePropertyChanged(nameof(HasEmptyFolders));
         SubscribeFolderEvents(Explorer.Folders, new FileChangedEventArgs <SoundEvent>(Explorer.Folders.Files, FileChange.Add));
         Explorer.Folders.FilesChanged += SubscribeFolderEvents;
         Explorer.Folders.FilesChanged += OnFoldersCollectionChanged;
         JsonUpdater = new SoundJsonUpdater(Explorer.Folders.Files, FoldersJsonFilePath, Preferences.SoundJsonPrettyPrint ? Formatting.Indented : Formatting.None, GetActualConverter());
         CheckJsonFileMismatch();
         CheckForUpdate();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 9
0
        private void RemoveClutterFlow()
        {
            Clutter.Threads.Enter();
            music_library.Properties.Remove("Nereid.SourceContents");
            Clutter.Threads.Leave();
            clutter_flow_contents.Dispose();
            clutter_flow_contents = null;

            source_manager.ActiveSourceChanged -= HandleActiveSourceChanged;
            BrowserAction.Activated            -= OnToggleBrowser;
            BrowserAction.Active     = ClutterFlowSchemas.OldShowBrowser.Get();
            CfBrowsAction.Activated -= OnToggleClutterFlow;
            CfBrowsAction.Visible    = false;

            action_service.RemoveActionGroup("ClutterFlowView");
            action_service.UIManager.RemoveUi(ui_manager_id);
            clutterflow_actions = null;
            cfbrows_action      = null;

            preference_service = null;
            source_manager     = null;
            music_library      = null;
            action_service     = null;
            browser_action     = null;
            cfbrows_action     = null;
        }
Ejemplo n.º 10
0
        private string GetBaseUrlByRole(Person person, string baseUrl)
        {
            if (string.IsNullOrEmpty(baseUrl))
            {
                baseUrl = PreferenceService.Get(Preference.APPLICATION_URL).Value;
            }
            var url = UrlTools.UrlCombine(baseUrl, "/Home/") + "{0}";

            if (person.RoleRef == CoreRoles.SUPER_ADMIN_ROLE.Id)
            {
                return(string.Format(url, ROLE_SYSADMIN));
            }
            if (person.RoleRef == CoreRoles.DISTRICT_ADMIN_ROLE.Id)
            {
                return(string.Format(url, ROLE_ADMIN));
            }
            if (person.RoleRef == CoreRoles.TEACHER_ROLE.Id)
            {
                return(string.Format(url, ROLE_TEACHER));
            }
            if (person.RoleRef == CoreRoles.STUDENT_ROLE.Id)
            {
                return(string.Format(url, ROLE_STUDENT));
            }
            if (person.RoleRef == CoreRoles.PARENT_ROLE.Id)
            {
                return(string.Format(url, ROLE_PARENT));
            }
            if (person.RoleRef == CoreRoles.CHECKIN_ROLE.Id)
            {
                return(string.Format(url, ROLE_CHECKIN));
            }

            throw new UnknownRoleException();
        }
Ejemplo n.º 11
0
 public int AddPreference(PreferenceForm form)
 {
     using (var uow = UnitOfWorkFactory.Create <NovelContext>())
     {
         var service = new PreferenceService(uow);
         return(service.SaveChanges(form));
     }
 }
Ejemplo n.º 12
0
        public IActionResult Save([FromBody] string[] items)
        {
            PreferenceService service = new PreferenceService(serviceProvider);

            service.Save(User.Identity as ClaimsIdentity, items);

            return(Ok());
        }
Ejemplo n.º 13
0
        public Guid?GetMiniQuizAppicationId()
        {
            var key = ApplicationSecurity.HasAssessmentEnabled(Context)
                    ? Preference.ASSESSMENT_APLICATION_ID
                    : null;

            Guid res;

            return(key != null ? (Guid.TryParse(PreferenceService.Get(key).Value, out res) ? res : (Guid?)null) : null);
        }
Ejemplo n.º 14
0
        private District PrepareCommonViewData()
        {
            District district = null;

            if (Context.DistrictId.HasValue && Context.SchoolLocalId.HasValue)
            {
                district = MasterLocator.DistrictService.GetByIdOrNull(Context.DistrictId.Value);
                if (Context.DeveloperId != null)
                {
                    ViewData[ViewConstants.IS_DEV] = true;
                }
                if (district.IsDemoDistrict)
                {
                    ViewData[ViewConstants.STUDENT_ROLE]        = CoreRoles.STUDENT_ROLE.Name;
                    ViewData[ViewConstants.TEACHER_ROLE]        = CoreRoles.TEACHER_ROLE.Name;
                    ViewData[ViewConstants.DISTRICT_ADMIN_ROLE] = CoreRoles.DISTRICT_ADMIN_ROLE.Name;

                    ViewData[ViewConstants.DEMO_PICTURE_DISTRICT_REF] = DEMO_PICTURE_DISTRICT_REF;
                    ViewData[ViewConstants.IS_DEMO_DISTRICT]          = true;
                }
                ViewData[ViewConstants.LAST_SYNC_DATE] = district.LastSync.HasValue
                    ? district.LastSync.Value.ToString("yyyy/MM/dd hh:mm:ss")
                    : "";
                ViewData[ViewConstants.DISTRICT_ID] = district.Id.ToString();

                var messagingSettings = MessagingSettingsViewData.Create(MasterLocator.SchoolService.GetDistrictMessaginSettings(Context.DistrictId.Value));
                PrepareJsonData(messagingSettings, ViewConstants.MESSAGING_SETTINGS);

                //TODO : maybe added this to startup data ... only needs for school persons
                var school = SchoolLocator.SchoolService.GetSchool(Context.SchoolLocalId.Value);
                ViewData[ViewConstants.SCHOOL_NAME] = school.Name;
            }
            ViewData[ViewConstants.CURRENT_USER_ROLE_ID]   = Context.RoleId;
            ViewData[ViewConstants.ROLE_NAME]              = Context.Role.LoweredName;
            ViewData[ViewConstants.AZURE_PICTURE_URL]      = PictureService.GetPicturesRelativeAddress();
            ViewData[ViewConstants.DEMO_AZURE_PICTURE_URL] = PictureService.GeDemoPicturesRelativeAddress();
            ViewData[ViewConstants.CURR_SCHOOL_YEAR_ID]    = GetCurrentSchoolYearId();
            ViewData[ViewConstants.VERSION]                  = CompilerHelper.Version;
            ViewData[ViewConstants.CROCODOC_API_URL]         = PreferenceService.Get(Preference.CROCODOC_URL).Value;
            ViewData[ViewConstants.SERVER_TIME]              = Context.NowSchoolTime.ToString(DATE_TIME_FORMAT);
            ViewData[ViewConstants.SCHOOL_YEAR_SERVER_TIME]  = Context.NowSchoolYearTime.ToString(DATE_TIME_FORMAT);
            ViewData[ViewConstants.STUDY_CENTER_ENABLED]     = Context.SCEnabled;
            ViewData[ViewConstants.ASSESSMENT_ENABLED]       = Context.AssessmentEnabled;
            ViewData[ViewConstants.MESSAGING_DISABLED]       = Context.MessagingDisabled;
            ViewData[ViewConstants.ASSESSMENT_APLICATION_ID] = MasterLocator.ApplicationService.GetAssessmentId();
            ViewData[ViewConstants.SIS_API_VERSION]          = Context.SisApiVersion;
            ViewData[ViewConstants.USER_LOGIN]               = Context.Login;
            ViewData[ViewConstants.LOGIN_TIME_OUT]           = Context.LoginTimeOut;

            var leParams = SchoolLocator.LeService.GetLEParams();

            PrepareJsonData(leParams, ViewConstants.LE_PARAMS);
            PrepareJsonData(PersonClaimViewData.Create(Context.Claims), ViewConstants.USER_CLAIMS);
            return(district);
        }
Ejemplo n.º 15
0
        private void UninstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null)
            {
                return;
            }

            service["general"]["misc"].Remove(enabled_pref);
        }
Ejemplo n.º 16
0
        private void UninstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null)
            {
                return;
            }

            service["general"]["misc"].Remove(replaygain_preference);
            replaygain_preference = null;
        }
Ejemplo n.º 17
0
        private void UninstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null)
            {
                return;
            }

            service["general"]["misc"].Remove(disable_internet_access_preference);
            disable_internet_access_preference = null;
        }
        // GET:
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new PreferenceService(userId);
            var model   = service.GetPreferences();

            //var model = new PreferencesListItem[0];
            //return View(model);


            return(View(model));
        }
Ejemplo n.º 19
0
        public void Dispose()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null || source_page == null)
            {
                return;
            }

            service.InstallWidgetAdapters -= OnPreferencesServiceInstallWidgetAdapters;
            source_page.Dispose();
            source_page = null;
        }
Ejemplo n.º 20
0
        private void UninstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null || pref_page == null)
            {
                return;
            }

            pref_page.Dispose();
            pref_page    = null;
            pref_section = null;
        }
Ejemplo n.º 21
0
        private void UninstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null || pref_page == null)
            {
                return;
            }

            service.InstallWidgetAdapters -= OnPreferencesServiceInstallWidgetAdapters;
            pref_page.Dispose();
            pref_page = null;
        }
Ejemplo n.º 22
0
        public void SendMailToFriend(string fromMail, string toMail, string message, string subject = null)
        {
            var sysEMail  = PreferenceService.GetTyped <EmailInfo>(Preference.SYSTEM_EMAIL);
            var emailfrom = new EmailInfo {
                Email = fromMail
            };
            var mailMessage = PrepareDefaultMail(emailfrom);

            mailMessage.To.Add(new MailAddress(toMail));
            mailMessage.Body    = message;
            mailMessage.Subject = subject;
            SendMail(mailMessage, sysEMail);
        }
Ejemplo n.º 23
0
        private static bool IsDemoLogin(string userLogin)
        {
            var logins = new[]
            {
                PreferenceService.Get(Preference.DEMO_SCHOOL_ADMIN_EDIT).Value,
                PreferenceService.Get(Preference.DEMO_SCHOOL_ADMIN_GRADE).Value,
                PreferenceService.Get(Preference.DEMO_SCHOOL_ADMIN_VIEW).Value,
                PreferenceService.Get(Preference.DEMO_SCHOOL_TEACHER).Value,
                PreferenceService.Get(Preference.DEMO_SCHOOL_STUDENT).Value
            };

            return(logins.Any(login => String.Equals(userLogin, login, StringComparison.CurrentCultureIgnoreCase)));
        }
Ejemplo n.º 24
0
        private void InstallPreferences ()
        {
            PreferenceService service = ServiceManager.Get<PreferenceService> ();
            if (service == null) {
                return;
            }

            enabled_pref = ServiceManager.SourceManager.MusicLibrary.PreferencesPage["misc"].Add (
                new SchemaPreference<bool> (EnabledSchema,
                    Catalog.GetString ("_Automatically detect BPM for all songs"),
                    Catalog.GetString ("Detect BPM for all songs that don't already have a value set"),
                    delegate { Enabled = EnabledSchema.Get (); })
            );
        }
Ejemplo n.º 25
0
        private void InstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null)
            {
                return;
            }

            replaygain_preference = service["general"]["misc"].Add(new SchemaPreference <bool> (ReplayGainEnabledSchema,
                                                                                                Catalog.GetString("_Enable ReplayGain correction"),
                                                                                                Catalog.GetString("For tracks that have ReplayGain data, automatically scale (normalize) playback volume"),
                                                                                                delegate { audio_sink.ReplayGainEnabled = ReplayGainEnabledSchema.Get(); }
                                                                                                ));
        }
Ejemplo n.º 26
0
        public override async Task <bool> Refresh()
        {
            if (CanRefresh())
            {
                IsLoading   = true;
                Preferences = PreferenceService.GetOrCreate <SoundsGeneratorPreferences>();

                Explorer.Folders.FilesChanged -= SubscribeFolderEvents;
                Explorer.Folders.FilesChanged -= OnFoldersCollectionChanged;
                Explorer.Folders.Clear();

                if (Explorer.FileSynchronizer.Finder is SoundEventsFinder finder)
                {
                    finder.Initialize(SessionContext.SelectedMod.ModInfo.Name, SessionContext.SelectedMod.ModInfo.Modid);
                }
                else
                {
                    throw new System.InvalidOperationException($"{Explorer.FileSynchronizer.Finder} must be {typeof(SoundEventsFinder)}");
                }
                if (Explorer.FileSynchronizer.Finder.Factory is ISoundEventsFactory factory)
                {
                    factory.SoundEventsRepository = Explorer.Folders;
                }
                else
                {
                    throw new System.InvalidOperationException($"{Explorer.FileSynchronizer.Finder} must be {typeof(SoundEventsFinder)}");
                }
                await InitializeFoldersAsync(await Explorer.FileSynchronizer.Finder.FindFoldersAsync(FoldersJsonFilePath, true).ConfigureAwait(true)).ConfigureAwait(false);

                Explorer.FileSynchronizer.RootPath = FoldersRootPath;
                Explorer.FileSynchronizer.SetEnableSynchronization(true);
                RaisePropertyChanged(nameof(HasEmptyFolders));
                SubscribeFolderEvents(Explorer.Folders, new FileChangedEventArgs <SoundEvent>(Explorer.Folders.Files, FileChange.Add));
                Explorer.Folders.FilesChanged += SubscribeFolderEvents;
                Explorer.Folders.FilesChanged += OnFoldersCollectionChanged;

                JsonUpdater = JsonUpdaterFactory.Create(SessionContext.SelectedMod.ModInfo.Name, SessionContext.SelectedMod.ModInfo.Modid);
                JsonUpdater.SetTarget(Explorer.Folders.Files);
                JsonUpdater.Path        = FoldersJsonFilePath;
                JsonUpdater.PrettyPrint = Preferences.SoundJsonPrettyPrint;

                IsLoading = false;
                CheckJsonFileMismatch();
                CheckForUpdate();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 27
0
        private void InstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null)
            {
                return;
            }

            enabled_pref = service["general"]["misc"].Add(
                new SchemaPreference <bool> (EnabledSchema,
                                             Catalog.GetString("_Show Banshee in the sound menu"),
                                             Catalog.GetString("Control Banshee through the sound menu"),
                                             delegate { Enabled = EnabledSchema.Get(); })
                );
        }
Ejemplo n.º 28
0
        void IExtensionService.Initialize()
        {
            _prefs = ServiceManager.Get <PreferenceService>();

            if (_prefs == null)
            {
                return;
            }

            Page remoteControlPage = new Page("RemoteControl", "Remote Control", 3);

            _prefs.FindOrAdd(remoteControlPage);

            Section BansheeRemotePrefs = remoteControlPage.FindOrAdd(
                new Section("BansheeRemote", "Banshee Remote", 0));

            _portPref = BansheeRemotePrefs.Add(new SchemaPreference <int>(
                                                   RemotePortSchema,
                                                   Catalog.GetString("Port"),
                                                   Catalog.GetString("Banshee will listen for remote control requests on this port")
                                                   ));

            _passIdPref = BansheeRemotePrefs.Add(new SchemaPreference <int>(
                                                     RemotePassIdSchema,
                                                     Catalog.GetString("Password ID"),
                                                     Catalog.GetString("\"Secret\" ID which is required to be specified in incoming requests")
                                                     ));

            _prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].ValueChanged += delegate {
                _passId = (int)_prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].BoxedValue;
            };

            _prefs["RemoteControl"]["BansheeRemote"]["remote_control_port"].ValueChanged += delegate {
                StartRemoteListener();
            };

            _disposed = false;

            ServiceManager.SourceManager.SourceRemoved += OnSourceRemoved;

            _passId = (int)_prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].BoxedValue;

            Helper.SetDbCompressTimeFromFile();
            Helper.CompressDatabase();
            StartRemoteListener();
        }
Ejemplo n.º 29
0
        private void UninstallPreferences()
        {
            PreferenceService service = ServiceManager.Get <PreferenceService> ();

            if (service == null)
            {
                return;
            }

            service["general"]["misc"].Remove(replaygain_preference);
            if (bp_supports_gapless(handle))
            {
                service["general"]["misc"].Remove(gapless_preference);
            }
            replaygain_preference = null;
            gapless_preference    = null;
        }
        private void OnOkCommand()
        {
            var preference = PreferenceService.Preference;

            preference.Rounding            = (RoundingRule)Enum.ToObject(typeof(RoundingRule), RoundingRuleIndex.Value);
            preference.RoundUnit           = RoundUnit.Value;
            preference.StartMargin         = StartMargin.Value;
            preference.EndMargin           = EndMargin.Value;
            preference.FirstDayOfWeek      = (DayOfWeek)Enum.ToObject(typeof(DayOfWeek), FirstDayIndex.Value);
            preference.DayOffsetMinutes    = DayOffset.Value;
            preference.MaxDays             = MaxDays.Value;
            preference.EnableBlackoutDates = EnableBlackoutDates.Value;
            PreferenceService.Save();

            ButtonResult result = RescanRequired ? ButtonResult.Retry : ButtonResult.OK;

            RequestClose?.Invoke(new DialogResult(result));
        }
Ejemplo n.º 31
0
        public PreferenceDialog()
            : base(Catalog.GetString ("Preferences"))
        {
            service = ServiceManager.Get<PreferenceService> ();

            if (service == null) {
                Log.Error (Catalog.GetString ("Could not show preferences"),
                    Catalog.GetString ("The preferences service could not be found."), true);

                throw new ApplicationException ();
            }

            DefaultPreferenceWidgets.Load (service);
            service.RequestWidgetAdapters ();

            BuildDialog ();
            LoadPages ();
        }
        private void RemoveClutterFlow()
        {
            Clutter.Threads.Enter ();
            music_library.Properties.Remove ("Nereid.SourceContents");
            Clutter.Threads.Leave ();
            clutter_flow_contents.Dispose ();
            clutter_flow_contents = null;

            source_manager.ActiveSourceChanged -= HandleActiveSourceChanged;
            BrowserAction.Activated -= OnToggleBrowser;
            BrowserAction.Active = ClutterFlowSchemas.OldShowBrowser.Get ();
            CfBrowsAction.Activated -= OnToggleClutterFlow;
            CfBrowsAction.Visible = false;

            action_service.RemoveActionGroup ("ClutterFlowView");
            action_service.UIManager.RemoveUi (ui_manager_id);
            clutterflow_actions = null;
            cfbrows_action = null;

            preference_service = null;
            source_manager = null;
            music_library = null;
            action_service = null;
            browser_action = null;
            cfbrows_action = null;
        }
        private void OnServiceStarted(ServiceStartedArgs args)
        {
            if (args.Service is Banshee.Preferences.PreferenceService) {
                preference_service = (PreferenceService)args.Service;
                SetupPreferences ();
            } else if (args.Service is Banshee.Gui.InterfaceActionService) {
                action_service = (InterfaceActionService)args.Service;
                SetupInterfaceActions ();
            }

            if (!(preference_service==null || action_service==null)) {
                ServiceManager.ServiceStarted -= OnServiceStarted;
                if (!SetupSourceContents ()) {
                    source_manager.SourceAdded += OnSourceAdded;
                }
            }
        }
        void IExtensionService.Initialize()
        {
            ClutterHelper.Init ();

            preference_service = ServiceManager.Get<PreferenceService> ();
            action_service = ServiceManager.Get<InterfaceActionService> ();

            source_manager = ServiceManager.SourceManager;
            music_library = source_manager.MusicLibrary;

            if (!SetupPreferences () || !SetupInterfaceActions ()) {
                ServiceManager.ServiceStarted += OnServiceStarted;
            } else if (!SetupSourceContents ()) {
                source_manager.SourceAdded += OnSourceAdded;
            }

            //--> TODO Banshee.ServiceStack.Application. register Exit event to close threads etc.
        }
        void IExtensionService.Initialize()
        {
            _prefs = ServiceManager.Get<PreferenceService>();

            if (_prefs == null) {
                return;
            }

            Page remoteControlPage = new Page("RemoteControl", "Remote Control", 3);
            _prefs.FindOrAdd(remoteControlPage);

            Section BansheeRemotePrefs = remoteControlPage.FindOrAdd(
                new Section("BansheeRemote", "Banshee Remote", 0));

            _portPref = BansheeRemotePrefs.Add(new SchemaPreference<int>(
                RemotePortSchema,
                Catalog.GetString("Port"),
                Catalog.GetString("Banshee will listen for remote control requests on this port")
            ));

            _passIdPref = BansheeRemotePrefs.Add(new SchemaPreference<int>(
                RemotePassIdSchema,
                Catalog.GetString("Password ID"),
                Catalog.GetString("\"Secret\" ID which is required to be specified in incoming requests")
            ));

            _prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].ValueChanged += delegate {
                _passId = (int) _prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].BoxedValue;
            };

            _prefs["RemoteControl"]["BansheeRemote"]["remote_control_port"].ValueChanged += delegate {
                StartRemoteListener();
            };

            _disposed = false;

            ServiceManager.SourceManager.SourceRemoved += OnSourceRemoved;

            _passId = (int) _prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].BoxedValue;

            Helper.SetDbCompressTimeFromFile();
            Helper.CompressDatabase();
            StartRemoteListener();
        }
        private void InstallPreferences()
        {
            bansheePrefs = ServiceManager.Get<PreferenceService>();

            if (bansheePrefs == null){
                return;
            }
            Page remoteControlPage = new Page("RemoteControl","Remote Control",3);
            bansheePrefs.FindOrAdd(remoteControlPage);

            Section BansheeRemotePrefs = remoteControlPage.FindOrAdd(new Section("BansheeRemote","Banshee Remote",0));

            port_pref = BansheeRemotePrefs.Add (new SchemaPreference<int>(
                      RemotePortSchema,
                      Catalog.GetString("Banshee Remote port"),
                      Catalog.GetString("Banshee will listen for the Android Banshee Remote app on this port")));

            logging_pref = BansheeRemotePrefs.Add (new SchemaPreference<bool>(
                      LoggingSchema,
                      Catalog.GetString("Banshee Remote Logging"),
                      Catalog.GetString("Enables or disables logging")));
        }