コード例 #1
1
 public CompressorService()
 {
     _effect = new BASS_BFX_COMPRESSOR2();
     Band Gain = new Band(0, +60.0f, -60.0f, 1.0f, "Gain");
     Band Threshold = new Band(-15f, +0.0f, -60.0f, 0.5f, "Threshold");
     Band Ratio = new Band(3f, +10.0f, +1.0f, 0.1f, "Ratio");
     Band Attack = new Band(10f, +1000.0f, 0.01f, 0.01f, "Attack");
     Band Release = new Band(200f, 5000.0f, 0.01f, 0.01f, "Release");
     Bands = new List<Band>() { Gain, Threshold, Ratio, Attack, Release };
     Settings = new SettingsService<Band>("CompressorEffect");
     CurrentSettings = Settings.GetCurrentSettings();
     CurrentSettings.SetPreset(Bands, "CurrentPreset");
     IsActive = CurrentSettings.IsActive;
     BandChanged += ((object sender, ChangedEventArgs e) => { SetEffectToBand(e.Value, e.BandIndex); });
     PresetNames = new List<string>(CurrentSettings.Presets.Keys);
     EffectName = "Compressor";
     PresetName = "CurrentPreset";
 }
コード例 #2
0
ファイル: SettingsServiceTests.cs プロジェクト: alfeg/nunit
 public void CreateServiceContext()
 {
     var services = new ServiceContext();
     _settingsService = new SettingsService(false);
     services.Add(_settingsService);
     services.ServiceManager.StartServices();
 }
コード例 #3
0
 public DistanceTextBlock()
 {
     InitializeComponent();
     DataContextChanged += (sender, args) =>
     {
         UpdateDistance();
     };
     _mainVm = ServiceLocator.Current.GetInstance<MainViewModel>();
     _settings = ServiceLocator.Current.GetInstance<SettingsService>();
     _localization = ServiceLocator.Current.GetInstance<LocalizationService>();
     _mainVm.PropertyChanged += (sender, args) =>
     {
         if (args.PropertyName == nameof(_mainVm.UserLocation))
         {
             UpdateDistance();
         }
     };
     Messenger.Default.Register(this, (SettingChangedMessage msg) =>
     {
         if (msg.IsSetting(nameof(_settings.DistanceUnit)) || msg.IsSetting(nameof(_settings.CurrentLocale)))
         {
             UpdateDistance();
         }
     });
 }
コード例 #4
0
        public void TestTranslator()
        {
            PluginsTranslator translator = new PluginsTranslator(new PluginTranslator());

            SettingsService settingsService = new SettingsService();
            string path = settingsService.CorePluginsPath;

            DirectoryInfo directoryInfo = new DirectoryInfo(path);
            Plugins plugins = translator.Translate(directoryInfo);

            Assert.IsTrue(plugins.Items.Count > 0);
        }
コード例 #5
0
        public void TestCheckForUpdates()
        {
            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.UpdateCheckerPath).Returns(settingsService.UpdateCheckerPath);

            MockFile mockFile = new MockFile { FileExists = true };

            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            this.service.CheckForUpdates();
        }
コード例 #6
0
        /// <summary>
        /// Registers the Caliburn.Micro settings service with the container.
        /// </summary>
        public ISettingsService RegisterSettingsService()
        {
            if (HasHandler(typeof(ISettingsService), null))
                return (ISettingsService)GetInstance(typeof(ISettingsService), null);

            if (!HasHandler(typeof(ISettingsWindowManager), null))
                RegisterInstance(typeof(ISettingsWindowManager), null, new CallistoSettingsWindowManager());

            var settingsService = new SettingsService((ISettingsWindowManager)GetInstance(typeof(ISettingsWindowManager), null));
            RegisterInstance(typeof(ISettingsService), null, settingsService);

            return settingsService;
        }
コード例 #7
0
ファイル: SettingsViewModel.cs プロジェクト: sibbl/ParkenDD
        public SettingsViewModel(SettingsService settings, LocalizationService localization)
        {
            _settings = settings;
            _localization = localization;

            _distanceUnit = settings.DistanceUnit;
            _displayedLocale = settings.CurrentLocale;
            _locale = settings.CurrentLocale;
            _showExperimentalCities = settings.ShowExperimentalCities;
            RaisePropertyChanged(() => Locale);
            RaisePropertyChanged(() => LocaleDefaultIndex);
            RaisePropertyChanged(() => LanguageChanged);
            RaisePropertyChanged(() => ChangeLanguageString);
        }
コード例 #8
0
ファイル: ViewModel.cs プロジェクト: DmitriyBalykin/HomeCalc
        private void InitializeServices()
        {
            StoreService = StorageService.GetInstance();
            Status = StatusService.GetInstance();
            UpdateService = UpdateService.GetInstance();
            Settings = SettingsService.GetInstance();

            logger = new Logger(this.GetType().ToString());
            logger.SendEmail = Settings.GetSetting(SettingsService.SEND_EMAIL_AUTO_KEY).SettingBoolValue;

            MsgDispatcher = MessageDispatcher.GetInstance();

            Settings.SettingsChanged += Settings_SettingsChanged;
        }
コード例 #9
0
        /// <summary>
        /// Registers the Caliburn.Micro settings service with the container.
        /// </summary>
        public ISettingsService RegisterSettingsService() {
            if (HasHandler(typeof (ISettingsService), null))
                return this.GetInstance<ISettingsService>(null);

            if (!HasHandler(typeof (ISettingsWindowManager), null))
#if WinRT81
                RegisterInstance(typeof (ISettingsWindowManager), null, new SettingsWindowManager());
#else
                RegisterInstance(typeof(ISettingsWindowManager), null, new CallistoSettingsWindowManager());
#endif

            var settingsService =
                new SettingsService((ISettingsWindowManager) GetInstance(typeof (ISettingsWindowManager), null));
            RegisterInstance(typeof (ISettingsService), null, settingsService);

            return settingsService;
        }
コード例 #10
0
ファイル: EchoService.cs プロジェクト: Number22/PoorPlayer
 public EchoService()
 {
     _effect = new BASS_BFX_ECHO4();
     Band DryMix = new Band(0, +2.0f, -2.0f, 0.2f, "DryMix");
     Band WetMix = new Band(0, +2.0f, -2.0f, 0.2f, "WetMix");
     Band Feedback = new Band(0, +1.0f, -1.0f, 0.01f, "Feedback");
     Band Delay = new Band(0, +5.0f, 0.01f, 0.01f, "Delay");
     Bands = new List<Band>() { DryMix, WetMix, Feedback, Delay };
     Settings = new SettingsService<Band>("EchoEffect");
     CurrentSettings = Settings.GetCurrentSettings();
     CurrentSettings.SetPreset(Bands, "CurrentPreset");
     IsActive = CurrentSettings.IsActive;
     BandChanged += ((object sender, ChangedEventArgs e) => { SetEffectToBand(e.Value, e.BandIndex); });
     PresetNames = new List<string>(CurrentSettings.Presets.Keys);
     EffectName = "Echo";
     PresetName = "CurrentPreset";
 }
コード例 #11
0
ファイル: SettingsDialog.cs プロジェクト: sbambach/ATF
        /// <summary>
        /// Constructor</summary>
        /// <param name="settingsService">Settings service</param>
        /// <param name="dialogOwner">Dialog owner window HWND</param>
        /// <param name="pathName">Path of settings to display initially, or null</param>
        public SettingsDialog(SettingsService settingsService, IWin32Window dialogOwner, string pathName)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            SplitterRatio = 0.33f;

            m_settingsService = settingsService;
            m_dialogOwner = dialogOwner;

            m_originalState = m_settingsService.UserState; // for cancel

            m_treeControl = new TreeControl(TreeControl.Style.SimpleTree);
            m_treeControl.Dock = DockStyle.Fill;
            m_treeControl.SelectionMode = SelectionMode.One;
            m_treeControl.ShowRoot = false;
            m_treeControl.ImageList = ResourceUtil.GetImageList16();
            m_treeControl.ExpandAll();

            m_treeControl.NodeSelectedChanged += treeControl_NodeSelectedChanged;

            m_treeControlAdapter = new TreeControlAdapter(m_treeControl);
            m_treeControlAdapter.TreeView = settingsService.UserSettings;

            treePanel.Controls.Add(m_treeControl);

            m_propertyGrid = new Sce.Atf.Controls.PropertyEditing.PropertyGrid();
            m_propertyGrid.Dock = DockStyle.Fill;
            propertiesPanel.Controls.Add(m_propertyGrid);

            // select an initial node so something is displayed in the PropertyGrid
            TreeControl.Node firstNode = null;
            if (pathName != null)
                firstNode = m_treeControlAdapter.ExpandPath(m_settingsService.GetSettingsPath(pathName));
            if (firstNode == null) // in case pathName is not null, but ExpandPath returns null  
                firstNode = m_treeControl.ExpandToFirstLeaf();
            


            firstNode.Selected = true;
            ShowProperties(m_settingsService.GetProperties((Tree<object>)firstNode.Tag)); //does auto-setting of column widths

            defaultsButton.Click += DefaultsButton_Click;
        }
コード例 #12
0
 public ReverberationService()
 {
     _effect = new BASS_BFX_FREEVERB();
     Band DryMix = new Band(0.0f, +1.0f, 0.0f, 0.05f, "DryMix");
     Band WetMix = new Band(1.0f, +3.0f, 0.0f, 0.05f, "WetMix");
     Band RoomSize = new Band(0.5f, +1.0f, 0.0f, 0.01f, "RoomSize");
     Band Damp = new Band(0.5f, +1.0f, 0.0f, 0.01f, "Damp");
     Band Width = new Band(1.0f, 1.0f, 0.0f, 0.01f, "Width");
     Bands = new List<Band>() { DryMix, WetMix, RoomSize, Damp, Width };
     Settings = new SettingsService<Band>("ReverberationEffect");
     CurrentSettings = Settings.GetCurrentSettings();
     CurrentSettings.SetPreset(Bands, "CurrentPreset");
     IsActive = CurrentSettings.IsActive;
     BandChanged += ((object sender, ChangedEventArgs e) => { SetEffectToBand(e.Value, e.BandIndex); });
     PresetNames = new List<string>(CurrentSettings.Presets.Keys);
     EffectName = "Reverberation";
     PresetName = "CurrentPreset";
 }
コード例 #13
0
 //FFTSize  and Semitones not work
 public PitchShiftService()
 {
     _effect = new BASS_BFX_PITCHSHIFT();
     Band PitchShift = new Band(1, +2.0f, 0.5f, 0.1f, "PitchShift");
     Band Semitones = new Band(0, +100.0f, 0.0f, 2.0f, "Semitones");
     Band FFTSize = new Band(2048L, 8192L, 1024L,
         new DoubleCollection() {1024L, 2048L, 4096L, 8192L }, "FFTSize");
     Band Osamp = new Band(0L, 32L, 4L, 1L, "Osamp");
     Bands = new List<Band>() { PitchShift, Semitones, FFTSize, Osamp };
     Settings = new SettingsService<Band>("PitchShiftEffect");
     CurrentSettings = Settings.GetCurrentSettings();
     CurrentSettings.SetPreset(Bands, "CurrentPreset");
     IsActive = CurrentSettings.IsActive;
     BandChanged += ((object sender, ChangedEventArgs e) => { SetEffectToBand(e.Value, e.BandIndex); });
     PresetNames = new List<string>(CurrentSettings.Presets.Keys);
     EffectName = "PitchShift";
     PresetName = "CurrentPreset";
 }
コード例 #14
0
 public DynamicAmplificationService()
 {
     _effect = new BASS_BFX_DAMP();
     Band Target = new Band(0, +1.0f, 0.0f, 0.02f, "Target");
     Band Quiet = new Band(0, +1.0f, 0.0f, 0.02f, "Quiet");
     Band Rate = new Band(0, +1.0f, 0.0f, 0.02f, "Rate");
     Band Gain = new Band(0, +2.0f, 0.0f, 0.04f, "Gain");
     Band Delay = new Band(0, +10.0f, 0.0f, 0.2f, "Delay");
     Bands = new List<Band>() { Target, Quiet, Rate, Gain, Delay };
     Settings = new SettingsService<Band>("DynamicAmplificationEffect");
     CurrentSettings = Settings.GetCurrentSettings();
     CurrentSettings.SetPreset(Bands, "CurrentPreset");
     IsActive = CurrentSettings.IsActive;
     BandChanged += ((object sender, ChangedEventArgs e) => { SetEffectToBand(e.Value, e.BandIndex); });
     PresetNames = new List<string>(CurrentSettings.Presets.Keys);
     EffectName = "DynamicAmplification";
     PresetName = "CurrentPreset";
 }
コード例 #15
0
ファイル: Manager.cs プロジェクト: sutoentertainment/BaoViet
        public Manager()
        {
            Current = this;

            StorageService = new StorageService(this);
            WebService = new WebService(this);
            Database = new Database(this);
            AuthenticationService = new AuthenticationService(this);
            RateUsService = new RateUsService(this);
            ImageService = new ImageService(this);
            TrackingService = new LocalyticsAdapterService(this);
            RssService = new RssService(this);
            IAPService = new IAPService(this);
            CameraService = new BasicCameraService(this);
            SettingsService = new SettingsService(this);
            KeyboardService = new KeyboardService(this);
            MarkDownService = new MarkDownService(this);
            LogService = new LogService(this, StorageService);
        }
コード例 #16
0
ファイル: PhaserService.cs プロジェクト: Number22/PoorPlayer
 public PhaserService()
 {
     _effect = new BASS_BFX_PHASER();
     Band DryMix = new Band(0, +2.0f, -2.0f, 0.1f, "DryMix");
     Band WetMix = new Band(0, +2.0f, -2.0f, 0.1f, "WetMix");
     Band Feedback = new Band(0, +1.0f, -1.0f, 0.05f, "Feedback");
     Band Freq = new Band(0, 1000.0f, 0.0f, 50f, "Freq");
     Band Range = new Band(0, 10.0f, 0.0f, 0.5f, "Range");
     Band Rate = new Band(0, 10.0f, 0.0f, 0.5f, "Rate");
     Bands = new List<Band>() { DryMix, WetMix, Feedback, Freq, Range, Rate };
     Settings = new SettingsService<Band>("PhaserEffect");
     CurrentSettings = Settings.GetCurrentSettings();
     CurrentSettings.SetPreset(Bands, "CurrentPreset");
     IsActive = CurrentSettings.IsActive;
     BandChanged += ((object sender, ChangedEventArgs e) => { SetEffectToBand(e.Value, e.BandIndex); });
     PresetNames = new List<string>(CurrentSettings.Presets.Keys);
     EffectName = "Phaser";
     PresetName = "CurrentPreset";
 }
コード例 #17
0
ファイル: ChorusService.cs プロジェクト: Number22/PoorPlayer
 public ChorusService()
 {
     _effect = new BASS_BFX_CHORUS();
     Band DryMix = new Band(0, +2.0f, -2.0f, 0.05f, "DryMix");
     Band WetMix = new Band(0, +2.0f, -2.0f, 0.05f, "WetMix");
     Band Feedback = new Band(0, +0.5f, -0.5f, 0.05f, "Feedback");
     Band MinSweep = new Band(0, 500.0f, 0.0f, 1f, "MinSweep");
     Band MaxSweep = new Band(0, 500.0f, 0.0f, 1f, "MaxSweep");
     Band Rate = new Band(0, 400.0f, 0.0f, 1f, "Rate");
     Bands = new List<Band>() { DryMix, WetMix, Feedback, MinSweep, MaxSweep, Rate };
     Settings = new SettingsService<Band>("ChorusEffect");
     CurrentSettings = Settings.GetCurrentSettings();
     CurrentSettings.SetPreset(Bands, "CurrentPreset");
     IsActive = CurrentSettings.IsActive;
     BandChanged += ((object sender, ChangedEventArgs e) => { SetEffectToBand(e.Value, e.BandIndex); });
     PresetNames = new List<string>(CurrentSettings.Presets.Keys);
     PresetName = "CurrentPreset";
     EffectName = "Chorus";
 }
コード例 #18
0
        /// <summary>
        /// Creates settings load/save dialog</summary>
        /// <param name="settings">Settings service</param>
        public SettingsLoadSaveDialog(SettingsService settings)
        {
            if (settings == null)
                throw new ArgumentNullException();
            m_settingsService = settings;
            InitializeComponent();

            m_saveDialog = new SaveFileDialog();
            m_saveDialog.OverwritePrompt = true;
            m_saveDialog.Title = "Export settings".Localize();
            m_saveDialog.Filter = "Setting file".Localize() + "(*.xml)|*.xml";
            m_saveDialog.InitialDirectory = m_settingsService.DefaultSettingsPath;

            m_openDialog = new OpenFileDialog();
            m_openDialog.Title = "Import settings".Localize();
            m_openDialog.CheckFileExists = true;
            m_openDialog.CheckPathExists = true;
            m_openDialog.Multiselect = false;
            m_openDialog.Filter = m_saveDialog.Filter;
            m_openDialog.InitialDirectory = m_settingsService.DefaultSettingsPath;
        }
コード例 #19
0
        /// <summary>
        /// Constructor</summary>
        /// <param name="settings">Settings service to use for saving and loading the settings</param>
        public SettingsLoadSaveViewModel(SettingsService settings)
        {
            Title = "Load and Save Settings".Localize();

            if (settings == null)
                throw new ArgumentNullException();

            m_settingsService = settings;

            m_saveDialog = new SaveFileDialog();
            m_saveDialog.OverwritePrompt = true;
            m_saveDialog.Title = "Export settings";
            m_saveDialog.Filter = "Setting file(*.xml)|*.xml";

            m_openDialog = new OpenFileDialog();
            m_openDialog.Title = "Import settings";
            m_openDialog.CheckFileExists = true;
            m_openDialog.CheckPathExists = true;
            m_openDialog.Multiselect = false;
            m_openDialog.Filter = "Setting file(*.xml)|*.xml";

            Action = SettingsAction.Save;
        }
コード例 #20
0
        public TestController()
        {
            Log.Instance = new TestLogger();

            // Create root services first.
            var systemInformationService = new SystemInformationService();
            var apiService = new ApiService();
            ApiService = new ApiService();
            BackupService = new BackupService();
            StorageService = new StorageService();
            TimerService = new TestTimerService();
            DaylightService = new TestDaylightService();
            DateTimeService = new TestDateTimeService();

            SettingsService = new SettingsService(BackupService, StorageService);
            ResourceService = new ResourceService(BackupService, StorageService, SettingsService);
            SchedulerService = new SchedulerService(TimerService, DateTimeService);
            NotificationService = new NotificationService(DateTimeService, ApiService, SchedulerService, SettingsService, StorageService, ResourceService);
            SystemEventsService = new SystemEventsService(this, NotificationService, ResourceService);
            AutomationService = new AutomationService(SystemEventsService, systemInformationService, apiService);
            ComponentService = new ComponentService(SystemEventsService, systemInformationService, apiService, SettingsService);
            AreaService = new AreaService(ComponentService, AutomationService, SystemEventsService, systemInformationService, apiService, SettingsService);
        }
コード例 #21
0
        public void SaveExisitingSetting()
        {
            var mockRepo = new Mock<ISettingsRepository>();
            mockRepo.Setup(x => x.Get("Test")).Returns(ExpectedLink).Verifiable();
            MockRepo = mockRepo;

            Service = new SettingsService<NzbDashSettings, Setting>(MockRepo.Object, logger.Object);

            var model = F.Create<Setting>();
            var result = Service.SaveSettings(model);

            Assert.That(result, Is.True);
            MockRepo.Verify(x => x.Get(It.IsAny<string>()), Times.Once);
            MockRepo.Verify(x => x.Update(It.IsAny<GlobalSettings>()), Times.Never);
            MockRepo.Verify(x => x.Insert(It.IsAny<GlobalSettings>()), Times.Once);
        }
コード例 #22
0
ファイル: SettingsGUI.cs プロジェクト: ysk1965/UnityProject
        private static void DrawWallHackSection()
        {
            using (var changed = new EditorGUI.ChangeCheckScope())
            {
                var fold = GUITools.DrawFoldHeader("WallHack Detector", ACTkEditorPrefsSettings.WallHackFoldout);
                if (changed.changed)
                {
                    ACTkEditorPrefsSettings.WallHackFoldout = fold;
                }
            }

            if (!ACTkEditorPrefsSettings.WallHackFoldout)
            {
                return;
            }

            GUILayout.Space(-3f);

            using (GUITools.Vertical(GUITools.PanelWithBackground))
            {
                GUILayout.Label(
                    "Wireframe module uses own shader under the hood and it should be included into the build.",
                    EditorStyles.wordWrappedLabel);

                ReadGraphicsAsset();

                if (graphicsSettingsAsset != null && includedShaders != null)
                {
                    // outputs whole included shaders list, use for debug
                    //EditorGUILayout.PropertyField(includedShaders, true);

                    var shaderIndex = GetWallhackDetectorShaderIndex();

                    EditorGUI.BeginChangeCheck();

                    var status = shaderIndex != -1 ? ColorTools.GetGreenString() + ">included" : ColorTools.GetRedString() + ">not included";
                    GUILayout.Label("Shader status: <color=#" + status + "</color>", GUITools.RichLabel);

                    GUILayout.Space(5f);
                    EditorGUILayout.HelpBox("You don't need to include it if you're not going to use Wireframe module",
                                            MessageType.Info, true);
                    GUILayout.Space(5f);

                    if (shaderIndex != -1)
                    {
                        if (GUILayout.Button("Remove shader"))
                        {
                            includedShaders.DeleteArrayElementAtIndex(shaderIndex);
                            includedShaders.DeleteArrayElementAtIndex(shaderIndex);
                        }

                        GUILayout.Space(3);
                    }
                    else
                    {
                        using (GUITools.Horizontal())
                        {
                            if (GUILayout.Button("Auto Include"))
                            {
                                var shader = Shader.Find(WallHackDetector.WireframeShaderName);
                                if (shader != null)
                                {
                                    includedShaders.InsertArrayElementAtIndex(includedShaders.arraySize);
                                    var newItem = includedShaders.GetArrayElementAtIndex(includedShaders.arraySize - 1);
                                    newItem.objectReferenceValue = shader;
                                }
                                else
                                {
                                    Debug.LogError(EditorTools.ConstructError("Can't find " + WallHackDetector.WireframeShaderName +
                                                                              " shader!"));
                                }
                            }

                            if (GUILayout.Button("Include manually (see readme.pdf)"))
                            {
#if UNITY_2018_3_OR_NEWER
                                SettingsService.OpenProjectSettings("Project/Graphics");
#else
                                EditorApplication.ExecuteMenuItem("Edit/Project Settings/Graphics");
#endif
                            }
                        }

                        GUILayout.Space(3);
                    }

                    if (EditorGUI.EndChangeCheck())
                    {
                        graphicsSettingsAsset.ApplyModifiedProperties();
                    }
                }
                else
                {
                    GUILayout.Label("Can't automatically control " + WallHackDetector.WireframeShaderName +
                                    " shader existence at the Always Included Shaders list. Please, manage this manually in Graphics Settings.");
                    if (GUILayout.Button("Open Graphics Settings"))
                    {
                        EditorApplication.ExecuteMenuItem("Edit/Project Settings/Graphics");
                    }
                }
            }
        }
コード例 #23
0
        public TripResultViewModel(INetworkService networkService, IMessenger messengerService, SettingsService settings,
                                   IFavoritesService favorites, IFileService fileService)
        {
            _networkService   = networkService;
            _messengerService = messengerService;
            _settingsService  = settings;
            _favoritesService = favorites;
            _fileService      = fileService;

            _messengerService.Register <MessageTypes.PlanFoundMessage>(this, PlanFound);
        }
コード例 #24
0
        // Editor window GUI paint
        void OnGUI()
        {
            InitStyles();

            if (!s_DidReload)
            {
                s_DidReload = true;
                UpdateWindow();
            }

            CreateResources();

            Event e             = Event.current;
            float toolBarHeight = EditorStyles.toolbar.fixedHeight;
            bool  refresh       = false;

            GUILayout.BeginArea(new Rect(0, 0, position.width, toolBarHeight));


            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            EditorGUI.BeginChangeCheck();

            int incomingChangesetCount = incomingList.Root == null ? 0 : incomingList.Root.ChildCount;

            m_ShowIncoming = !GUILayout.Toggle(!m_ShowIncoming, "Outgoing", EditorStyles.toolbarButton);

            GUIContent cont = GUIContent.Temp("Incoming" + (incomingChangesetCount == 0 ? "" : " (" + incomingChangesetCount.ToString() + ")"));

            m_ShowIncoming = GUILayout.Toggle(m_ShowIncoming, cont, EditorStyles.toolbarButton);

            if (EditorGUI.EndChangeCheck())
            {
                refresh = true;
            }

            GUILayout.FlexibleSpace();

            // Global context custom commands goes here
            using (new EditorGUI.DisabledScope(Provider.activeTask != null))
            {
                foreach (CustomCommand c in Provider.customCommands)
                {
                    if (c.context == CommandContext.Global && GUILayout.Button(c.label, EditorStyles.toolbarButton))
                    {
                        c.StartTask();
                    }
                }
            }

            bool showDeleteEmptyChangesetsButton =
                Mathf.FloorToInt(position.width - s_ToolbarButtonsWidth - s_SettingsButtonWidth - s_DeleteChangesetsButtonWidth) > 0 &&
                HasEmptyPendingChangesets();

            if (showDeleteEmptyChangesetsButton && GUILayout.Button("Delete Empty Changesets", EditorStyles.toolbarButton))
            {
                DeleteEmptyPendingChangesets();
            }

            bool showSettingsButton = Mathf.FloorToInt(position.width - s_ToolbarButtonsWidth - s_SettingsButtonWidth) > 0;

            if (showSettingsButton && GUILayout.Button("Settings", EditorStyles.toolbarButton))
            {
                SettingsService.OpenProjectSettings("Project/Editor");
                EditorWindow.FocusWindowIfItsOpen <InspectorWindow>();
                GUIUtility.ExitGUI();
            }

            Color origColor = GUI.color;

            GUI.color = new Color(1, 1, 1, 1 * .5f);
            bool refreshButtonClicked = GUILayout.Button(refreshIcon, EditorStyles.toolbarButton);

            refresh   = refresh || refreshButtonClicked;
            GUI.color = origColor;

            if (refresh)
            {
                if (refreshButtonClicked)
                {
                    Provider.InvalidateCache();
                }
                UpdateWindow();
            }

            GUILayout.EndArea();

            Rect rect = new Rect(0, toolBarHeight, position.width, position.height - toolBarHeight - k_BottomBarHeight);

            bool repaint = false;

            GUILayout.EndHorizontal();

            // Disabled Window view
            if (!Provider.isActive)
            {
                Color tmpColor = GUI.color;
                GUI.color   = new Color(0.8f, 0.5f, 0.5f);
                rect.height = toolBarHeight;
                GUILayout.BeginArea(rect);

                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                GUILayout.FlexibleSpace();
                string msg = "DISABLED";
                if (Provider.enabled)
                {
                    if (Provider.onlineState == OnlineState.Updating)
                    {
                        GUI.color = new Color(0.8f, 0.8f, 0.5f);
                        msg       = "CONNECTING...";
                    }
                    else
                    {
                        msg = "OFFLINE";
                    }
                }

                GUILayout.Label(msg, EditorStyles.miniLabel);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndArea();

                rect.y += rect.height;
                if (!string.IsNullOrEmpty(Provider.offlineReason))
                {
                    GUI.Label(rect, Provider.offlineReason);
                }

                GUI.color = tmpColor;
                repaint   = false;
            }
            else
            {
                if (m_ShowIncoming)
                {
                    repaint |= incomingList.OnGUI(rect, hasFocus);
                }
                else
                {
                    repaint |= pendingList.OnGUI(rect, hasFocus);
                }


                rect.y     += rect.height;
                rect.height = k_BottomBarHeight;

                // Draw separation line over the button
                GUI.Label(rect, GUIContent.none, s_Styles.bottomBarBg);

                var  content      = EditorGUIUtility.TrTextContent("Apply All Incoming Changes");
                var  buttonSize   = EditorStyles.miniButton.CalcSize(content);
                Rect progressRect = new Rect(rect.x, rect.y - 2, rect.width - buttonSize.x - 5f, rect.height);
                ProgressGUI(progressRect, Provider.activeTask, false);

                if (m_ShowIncoming)
                {
                    // Draw "apply incoming" button
                    var buttonRect = rect;
                    buttonRect.width  = buttonSize.x;
                    buttonRect.height = buttonSize.y;
                    buttonRect.y      = rect.y + 2f;
                    buttonRect.x      = position.width - buttonSize.x - 5f;

                    using (new EditorGUI.DisabledScope(incomingList.Size == 0))
                    {
                        if (GUI.Button(buttonRect, content, EditorStyles.miniButton))
                        {
                            Asset root = new Asset("");
                            Task  t    = Provider.GetLatest(new AssetList()
                            {
                                root
                            });
                            t.SetCompletionAction(CompletionAction.OnGotLatestPendingWindow);
                        }
                    }
                }
            }

            if (repaint)
            {
                Repaint();
            }
        }
コード例 #25
0
ファイル: Runner.cs プロジェクト: xinqinglhj/AutoTest.Net
        public static int Main(string[] args)
        {
            ConsoleOptions options = new ConsoleOptions(args);

            // Create SettingsService early so we know the trace level right at the start
            SettingsService    settingsService = new SettingsService();
            InternalTraceLevel level           = (InternalTraceLevel)settingsService.GetSetting("Options.InternalTraceLevel", InternalTraceLevel.Default);

            if (options.trace != InternalTraceLevel.Default)
            {
                level = options.trace;
            }

            InternalTrace.Initialize("nunit-console_%p.log", level);

            log.Info("NUnit-console.exe starting");

            if (!options.nologo)
            {
                WriteCopyright();
            }

            if (options.help)
            {
                options.Help();
                return(ConsoleUi.OK);
            }

            if (options.NoArgs)
            {
                Console.Error.WriteLine("fatal error: no inputs specified");
                options.Help();
                return(ConsoleUi.OK);
            }

            if (!options.Validate())
            {
                foreach (string arg in options.InvalidArguments)
                {
                    Console.Error.WriteLine("fatal error: invalid argument: {0}", arg);
                }
                options.Help();
                return(ConsoleUi.INVALID_ARG);
            }

            // Add Standard Services to ServiceManager
            ServiceManager.Services.AddService(settingsService);
            ServiceManager.Services.AddService(new DomainManager());
            //ServiceManager.Services.AddService( new RecentFilesService() );
            ServiceManager.Services.AddService(new ProjectService());
            //ServiceManager.Services.AddService( new TestLoader() );
            ServiceManager.Services.AddService(new AddinRegistry());
            ServiceManager.Services.AddService(new AddinManager());
            ServiceManager.Services.AddService(new TestAgency());

            // Initialize Services
            ServiceManager.Services.InitializeServices();

            foreach (string parm in options.Parameters)
            {
                if (!Services.ProjectService.CanLoadProject(parm) && !PathUtils.IsAssemblyFileType(parm))
                {
                    Console.WriteLine("File type not known: {0}", parm);
                    return(ConsoleUi.INVALID_ARG);
                }
            }

            try
            {
                ConsoleUi consoleUi = new ConsoleUi();
                return(consoleUi.Execute(options));
            }
            catch (FileNotFoundException ex)
            {
                Console.WriteLine(ex.Message);
                return(ConsoleUi.FILE_NOT_FOUND);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unhandled Exception:\n{0}", ex.ToString());
                return(ConsoleUi.UNEXPECTED_ERROR);
            }
            finally
            {
                if (options.wait)
                {
                    Console.Out.WriteLine("\nHit <enter> key to continue");
                    Console.ReadLine();
                }

                log.Info("NUnit-console.exe terminating");
            }
        }
コード例 #26
0
 private void TypingConcurrentOperation_SearchComplete(string searchText, object arg2)
 {
     SettingsService.AddRecentSearchText(searchText, discardPrefixes: true);
 }
コード例 #27
0
        public void Setup()
        {
            Database.SetInitializer <AmazonContext>(null);
            XmlConfigurator.Configure(new FileInfo(AppSettings.log4net_Config));

            _dbFactory = new DbFactory();
            _time      = new TimeService(_dbFactory);
            _settings  = new SettingsService(_dbFactory);

            _styleHistoryService = new StyleHistoryService(_log, _time, _dbFactory);
            _styleManager        = new StyleManager(_log, _time, _styleHistoryService);
            _actionService       = new SystemActionService(_log, _time);
            _quantityManager     = new QuantityManager(_log, _time);
            _priceManager        = new PriceManager(_log, _time, _dbFactory, _actionService, _settings);
            _cacheService        = new CacheService(_log, _time, _actionService, _quantityManager);
            _barcodeService      = new BarcodeService(_log, _time, _dbFactory);
            _weightService       = new WeightService();

            IEmailSmtpSettings smtpSettings = new EmailSmtpSettings();

            using (var db = new UnitOfWork())
            {
                _company = db.Companies.GetFirstWithSettingsAsDto();

                if (AppSettings.IsDebug)
                {
                    smtpSettings = SettingsBuilder.GetSmtpSettingsFromAppSettings();
                }
                else
                {
                    smtpSettings = SettingsBuilder.GetSmtpSettingsFromCompany(_company);
                }

                _addressService = AddressService.Default;
                _emailService   = new EmailService(_log, smtpSettings, _addressService);

                //todo check itemHist
                _autoCreateNonameListingService = new AutoCreateNonameListingService(_log,
                                                                                     _time,
                                                                                     _dbFactory,
                                                                                     _cacheService,
                                                                                     _barcodeService,
                                                                                     _emailService, null,
                                                                                     AppSettings.IsDebug);

                var marketplaces = new MarketplaceKeeper(_dbFactory, true);
                marketplaces.Init();

                var shipmentPrividers = db.ShipmentProviders.GetByCompanyId(_company.Id);

                var apiFactory = new MarketFactory(marketplaces.GetAll(), _time, _log, _dbFactory, AppSettings.JavaPath);

                var weightService = new WeightService();

                var serviceFactory = new ServiceFactory();
                var rateProviders  = serviceFactory.GetShipmentProviders(_log,
                                                                         _time,
                                                                         _dbFactory,
                                                                         weightService,
                                                                         shipmentPrividers,
                                                                         null,
                                                                         null,
                                                                         null,
                                                                         null);

                _magentoApi    = (Magento20MarketApi)apiFactory.GetApi(_company.Id, MarketType.Magento, MarketplaceKeeper.ShopifyDWS);
                _shopifyDWSApi = (ShopifyApi)apiFactory.GetApi(_company.Id, MarketType.Shopify, MarketplaceKeeper.ShopifyDWS);
                _eBayApi       = (eBayApi)apiFactory.GetApi(_company.Id, MarketType.eBay, "");
                _amazonApi     = (AmazonApi)apiFactory.GetApi(_company.Id, MarketType.Amazon, MarketplaceKeeper.AmazonComMarketplaceId);
                _walmartApi    = (WalmartApi)apiFactory.GetApi(_company.Id, MarketType.Walmart, "");
            }
        }
コード例 #28
0
 public BuddySettings(Action <bool> enableCallback, IBuddyItemDao buddyItemDao, IBuddySubscriptionDao buddySubscriptionDao, SettingsService settingsService)
 {
     InitializeComponent();
     _enableCallback       = enableCallback;
     _buddyItemDao         = buddyItemDao;
     _buddySubscriptionDao = buddySubscriptionDao;
     _settingsService      = settingsService;
 }
コード例 #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HelperService" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="settingsService">The settings service.</param>
 public HelperService(ILogger <HelperService> logger, SettingsService settingsService)
 {
     _logger          = logger;
     _settingsService = settingsService;
 }
コード例 #30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PoeOverlayBase"/> class.
        /// </summary>
        /// <param name="windowManager">The window manager.</param>
        /// <param name="dockingHelper">The docking helper.</param>
        public PoeOverlayBase(IWindowManager windowManager, DockingHelper dockingHelper, ClientLurker lurker, SettingsService settingsService)
            : base(windowManager)
        {
            this._dockingHelper   = dockingHelper;
            this._lurker          = lurker;
            this._settingsService = settingsService;

            this._dockingHelper.OnWindowMove       += this.DockingHelper_OnWindowMove;
            this._dockingHelper.OnForegroundChange += this.DockingHelper_OnForegroundChange;
            this._lurker.PoeClosed       += this.Lurker_PoeClosed;
            this._settingsService.OnSave += this.SettingsService_OnSave;
        }
コード例 #31
0
        public GeoLocationViewModel()
        {
            _settingsService = ((App)Application.Current).SettingsService;

            _settingsService.PropertyChanged += _settingsService_PropertyChanged;
        }
コード例 #32
0
 public TransferStashService2(IPlayerItemDao playerItemDao, TransferStashServiceCache cache, TransferStashService transferStashService, SafeTransferStashWriter stashWriter, SettingsService settings, IHelpService helpService, IReplicaItemDao replicaItemDao)
 {
     _playerItemDao        = playerItemDao;
     _cache                = cache;
     _transferStashService = transferStashService;
     _stashWriter          = stashWriter;
     _settings             = settings;
     _helpService          = helpService;
     this._replicaItemDao  = replicaItemDao;
 }
コード例 #33
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="repoPath">Tuple with Repository, path and branch</param>
        /// <returns></returns>
        public async Task Load(Tuple <Repository, string, string> repoPath)
        {
            IsSupportedFile = true;
            Repository      = repoPath.Item1;
            Path            = repoPath.Item2;

            if (!GlobalHelper.IsInternet())
            {
                //Sending NoInternet message to all viewModels
                Messenger.Default.Send(new GlobalHelper.LocalNotificationMessageType {
                    Message = "No Internet", Glyph = "\uE704"
                });
            }
            else
            {
                isLoading = true;

                if (string.IsNullOrWhiteSpace(repoPath.Item3))
                {
                    SelectedBranch = await RepositoryUtility.GetDefaultBranch(Repository.Id);
                }
                else
                {
                    SelectedBranch = repoPath.Item3;
                }

                IsImage = false;

                if ((Path.ToLower().EndsWith(".exe")) ||
                    (Path.ToLower().EndsWith(".pdf")) ||
                    (Path.ToLower().EndsWith(".ttf")) ||
                    (Path.ToLower().EndsWith(".suo")) ||
                    (Path.ToLower().EndsWith(".mp3")) ||
                    (Path.ToLower().EndsWith(".mp4")) ||
                    (Path.ToLower().EndsWith(".avi")))
                {
                    /*
                     * Unsupported file types
                     */
                    IsSupportedFile = false;
                    isLoading       = false;
                    return;
                }
                if ((Path.ToLower()).EndsWith(".png") ||
                    (Path.ToLower()).EndsWith(".jpg") ||
                    (Path.ToLower()).EndsWith(".jpeg") ||
                    (Path.ToLower().EndsWith(".gif")))
                {
                    /*
                     * Image file types
                     */

                    IsImage = true;
                    String uri = (await RepositoryUtility.GetRepositoryContentByPath(Repository, Path, SelectedBranch))?[0].Content.DownloadUrl;
                    if (!string.IsNullOrWhiteSpace(uri))
                    {
                        ImageFile = new BitmapImage(new Uri(uri));
                    }
                    isLoading = false;
                    return;
                }
                if ((Path.ToLower()).EndsWith(".md"))
                {
                    /*
                     *  Files with .md extension
                     */
                    TextContent = (await RepositoryUtility.GetRepositoryContentByPath(Repository, Path, SelectedBranch))?[0].Content.Content;
                    isLoading   = false;
                    return;
                }

                /*
                 *  Code files
                 */

                String content = (await RepositoryUtility.GetRepositoryContentByPath(Repository, Path, SelectedBranch))?[0].Content.Content;
                if (content == null)
                {
                    IsSupportedFile = false;
                    isLoading       = false;
                    return;
                }
                SyntaxHighlightStyleEnum style = (SyntaxHighlightStyleEnum)SettingsService.Get <int>(SettingsKeys.HighlightStyleIndex);
                bool lineNumbers = SettingsService.Get <bool>(SettingsKeys.ShowLineNumbers);
                HTMLContent = await HiliteAPI.TryGetHighlightedCodeAsync(content, Path, style, lineNumbers, CancellationToken.None);

                if (HTMLContent == null)
                {
                    /*
                     *  Plain text files (Getting HTML for syntax highlighting failed)
                     */

                    RepositoryContent result = await RepositoryUtility.GetRepositoryContentTextByPath(Repository, Path, SelectedBranch);

                    if (result != null)
                    {
                        TextContent = result.Content;
                    }
                }

                if (HTMLContent == null && TextContent == null)
                {
                    IsSupportedFile = false;
                }

                isLoading = false;
            }
        }
コード例 #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HelpViewModel"/> class.
 /// </summary>
 /// <param name="windowManager">The window manager.</param>
 /// <param name="dockingHelper">The docking helper.</param>
 /// <param name="processLurker">The process lurker.</param>
 /// <param name="settingsService">The settings service.</param>
 public HelpViewModel(IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService)
     : base(windowManager, dockingHelper, processLurker, settingsService)
 {
     this._windowManager = windowManager;
 }
コード例 #35
0
 public SettingsController(SiriusDbContext context, IMapper mapper)
 {
     _settingsService = new SettingsService(context, mapper);
 }
コード例 #36
0
        private void PopulateSearchTerms(string jsonString)
        {
            JToken token = JObject.Parse(jsonString);

            var kinks = token["kinks"].Select(x =>
                                              new SearchTermModel
            {
                Category        = "kinks",
                DisplayName     = WebUtility.HtmlDecode((string)x["name"]),
                UnderlyingValue = (string)x["fetish_id"]
            });

            var genders = SearchTermFromArray(token, "genders");

            var roles = SearchTermFromArray(token, "roles");

            var orientations = SearchTermFromArray(token, "orientations");

            var positions = SearchTermFromArray(token, "positions");

            var languages = SearchTermFromArray(token, "languages");

            // oversight, this is not send per the endpoint, must hard-code
            var furryPrefs = new[]
            {
                "No furry characters, just humans", "No humans, just furry characters", "Furries ok, Humans Preferred",
                "Humans ok, Furries Preferred", "Furs and / or humans"
            }.Select(x => new SearchTermModel
            {
                Category    = "furryprefs",
                DisplayName = x
            }).Union(new List <SearchTermModel>
            {
                new SearchTermModel
                {
                    Category        = "furryprefs",
                    DisplayName     = "No furry preference set",
                    UnderlyingValue = "None"
                }
            });

            Dispatcher.BeginInvoke((Action)(() =>
            {
                availableSearchTerms = new ObservableCollection <SearchTermModel>();
                availableSearchTerms
                .AddRange(kinks)
                .AddRange(genders)
                .AddRange(roles)
                .AddRange(orientations)
                .AddRange(positions)
                .AddRange(languages)
                .AddRange(furryPrefs);

                selectedSearchTerms = new ObservableCollection <SearchTermModel>();

                OnPropertyChanged("AvailableSearchTerms");
                OnPropertyChanged("SelectedSearchTerms");

                AvailableSearchTerms.Refresh();
                SelectedSearchTerms.Refresh();

                SettingsService.SaveSearchTerms(ChatModel.CurrentCharacter.Name, new SearchTermsModel
                {
                    AvailableTerms = availableSearchTerms.ToList()
                });
            }));
        }
コード例 #37
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManaBulbViewModel" /> class.
        /// </summary>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="windowManager">The window manager.</param>
        /// <param name="dockingHelper">The docking helper.</param>
        /// <param name="clientLurker">The client lurker.</param>
        /// <param name="processLurker">The process lurker.</param>
        /// <param name="settingsService">The settings service.</param>
        /// H
        public ManaBulbViewModel(IEventAggregator eventAggregator, IWindowManager windowManager, DockingHelper dockingHelper, ClientLurker clientLurker, ProcessLurker processLurker, SettingsService settingsService)
            : base(windowManager, dockingHelper, processLurker, settingsService, clientLurker)
        {
            this._eventAggregator = eventAggregator;
            this._eventAggregator.Subscribe(this);

            this.ClientLurker.LocationChanged   += this.Lurker_LocationChanged;
            this.ClientLurker.RemainingMonsters += this.Lurker_RemainingMonsters;
            this.SettingsService.OnSave         += this.SettingsService_OnSave;
        }
コード例 #38
0
        /// <summary>
        /// Moves a downloaded file/folder to the final destination.
        /// Shows an error message if something went wrong.
        /// </summary>
        /// <param name="srcPath">Path of the source file/folder</param>
        /// <param name="destName">New name for the file/folder</param>
        /// <returns>Result of the action. TRUE if all went well or FALSE in other case.</returns>
        public async Task <bool> FinishDownload(string srcPath, string destName)
        {
            try
            {
                // If transfer is child of a folder transfer, doesn't need to do anything
                // because the parent folder transfer will do the final required action.
                if (this.Transfer.getFolderTransferTag() > 0)
                {
                    return(true);
                }

                string defaultDownloadLocation = ResourceService.SettingsResources.GetString("SR_DefaultDownloadLocation");
                this.ExternalDownloadPath = this.ExternalDownloadPath ?? await SettingsService.LoadSettingAsync <string>(defaultDownloadLocation, null);

                if (string.IsNullOrWhiteSpace(this.ExternalDownloadPath))
                {
                    return(false);
                }

                if (this.Transfer.isFolderTransfer())
                {
                    await FolderService.MoveFolderAsync(srcPath, this.ExternalDownloadPath, destName);
                }
                else
                {
                    await FileService.MoveFileAsync(srcPath, this.ExternalDownloadPath, destName);
                }

                return(true);
            }
            catch (Exception e)
            {
                string alertMessage, logMessage;
                if (this.Transfer == null || string.IsNullOrWhiteSpace(destName))
                {
                    logMessage   = "Error finishing a download to an external location";
                    alertMessage = ResourceService.AppMessages.GetString("AM_DownloadFailed");
                }
                else
                {
                    if (this.Transfer.isFolderTransfer())
                    {
                        logMessage   = string.Format("Error finishing download folder '{0}'", destName);
                        alertMessage = string.Format(ResourceService.AppMessages.GetString("AM_DownloadFolderFailed"), destName);
                    }
                    else
                    {
                        logMessage   = string.Format("Error finishing download file '{0}'", destName);
                        alertMessage = string.Format(ResourceService.AppMessages.GetString("AM_DownloadFileFailed"), destName);
                    }
                }

                LogService.Log(MLogLevel.LOG_LEVEL_ERROR, logMessage, e);
                UiService.OnUiThread(async() =>
                {
                    await DialogService.ShowAlertAsync(
                        ResourceService.AppMessages.GetString("AM_DownloadFailed_Title"), alertMessage);
                });

                return(false);
            }
        }
コード例 #39
0
 public GridSquareNameFixer(Settings settings, IDataRepository dataRepository, SettingsService settingsService)
 {
     this.settings        = settings;
     this.dataRepository  = dataRepository;
     this.settingsService = settingsService;
 }
コード例 #40
0
 public void Setup()
 {
     var restClient = new WorldpayRestClient(Configuration.ServiceKey);
     _settingsService = restClient.GetSettingsService();
 }
コード例 #41
0
        //================================================================================
        // 関数
        //================================================================================
        /// <summary>
        /// GUI を描画する時に呼び出されます
        /// </summary>
        private void OnGUI()
        {
            if (Event.current.type == EventType.Repaint)
            {
                var backgroundRect = new Rect
                                     (
                    x: 0,
                    y: 0,
                    width: EditorGUIUtility.currentViewWidth,
                    height: EditorGUIUtility.singleLineHeight
                                     );

                EditorStyles.toolbar.Draw
                (
                    position: backgroundRect,
                    isHover: false,
                    isActive: true,
                    on: true,
                    hasKeyboardFocus: false
                );
            }

            var entities = TimeEntities.LoadFromConfig();
            var settings = CompileTimeMeasurerSettings.LoadFromEditorPrefs();

            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Settings", EditorStyles.toolbarButton))
                {
                    SettingsService.OpenUserPreferences("Preferences/UniCompileTimeMeasurer");
                }
                if (GUILayout.Button("Clear", EditorStyles.toolbarButton))
                {
                    entities.Clear();
                    TimeEntities.SaveToConfig(entities);
                    Repaint();
                }
            }

            using (var scope = new EditorGUILayout.ScrollViewScope(m_scrollPosition))
            {
                for (var i = entities.Entities.Count - 1; i >= 0; i--)
                {
                    var entry             = entities.Entities[i];
                    var dateTimeFormat    = settings.DateTimeFormat;
                    var elapsedTimeFormat = settings.ElapsedTimeFormat;
                    var elapsedTimeSuffix = settings.ElapsedTimeSuffix;

                    var dateTime = string.IsNullOrWhiteSpace(dateTimeFormat)
                                                        ? entry.DateTime.ToString()
                                                        : entry.DateTime.ToString(dateTimeFormat)
                    ;

                    var elapsedTime = string.IsNullOrWhiteSpace(elapsedTimeFormat)
                                                        ? entry.ElapsedTime.TotalSeconds.ToString()
                                                        : entry.ElapsedTime.ToString(elapsedTimeFormat)
                    ;

                    var label1 = dateTime;
                    var label2 = elapsedTime + elapsedTimeSuffix;

                    EditorGUILayout.LabelField(label1, label2);
                }

                m_scrollPosition = scope.scrollPosition;
            }
        }
コード例 #42
0
        public async void MultipleDownload(String downloadPath = null)
        {
            if (this.Type == ContainerType.FolderLink)
            {
                this.SelectedNodes = App.LinkInformation.SelectedNodes;
            }
            else
            {
                this.SelectedNodes = ChildNodes.Where(n => n.IsMultiSelected).ToList();
            }

            if (this.SelectedNodes.Count < 1)
            {
                return;
            }

            // Only 1 Folder Picker can be open at 1 time
            if (this.AppInformation.PickerOrAsyncDialogIsOpen)
            {
                return;
            }

            #if WINDOWS_PHONE_80
            if (!SettingsService.LoadSetting <bool>(SettingsResources.QuestionAskedDownloadOption, false))
            {
                var result = await DialogService.ShowOptionsDialog(AppMessages.QuestionAskedDownloadOption_Title,
                                                                   AppMessages.QuestionAskedDownloadOption,
                                                                   new[]
                {
                    new DialogButton(AppMessages.QuestionAskedDownloadOption_YesButton, () =>
                    {
                        SettingsService.SaveSetting(SettingsResources.ExportImagesToPhotoAlbum, true);
                    }),
                    new DialogButton(AppMessages.QuestionAskedDownloadOption_NoButton, () =>
                    {
                        SettingsService.SaveSetting(SettingsResources.ExportImagesToPhotoAlbum, false);
                    })
                });

                if (result == MessageDialogResult.CancelNo)
                {
                    return;
                }

                SettingsService.SaveSetting(SettingsResources.QuestionAskedDownloadOption, true);
            }
            #elif WINDOWS_PHONE_81
            if (downloadPath == null)
            {
                if (!await FolderService.SelectDownloadFolder())
                {
                    return;
                }
                else
                {
                    downloadPath = AppService.GetSelectedDownloadDirectoryPath();
                }
            }
            #endif

            ProgressService.SetProgressIndicator(true, ProgressMessages.PrepareDownloads);

            // Give the app the time to display the progress indicator
            await Task.Delay(5);

            // First count the number of downloads before proceeding to the transfers.
            int downloadCount = 0;
            foreach (var node in SelectedNodes)
            {
                var folderNode = node as FolderNodeViewModel;
                if (folderNode != null)
                {
                    downloadCount += NodeService.GetRecursiveNodes(this.MegaSdk, AppInformation, folderNode).Count;
                }
                else
                {
                    downloadCount++;
                }
            }

            if (!await AppService.DownloadLimitCheck(downloadCount))
            {
                ProgressService.SetProgressIndicator(false);
                return;
            }

            foreach (var node in SelectedNodes)
            {
                node.Download(TransfersService.MegaTransfers, downloadPath);
            }

            ProgressService.SetProgressIndicator(false);

            this.IsMultiSelectActive = false;
        }
コード例 #43
0
 /// <summary>
 /// Creates a new <see cref="UISettingsSectionViewModel"/> instance
 /// </summary>
 /// <param name="messenger">The <see cref="IMessenger"/> instance to use</param>
 /// <param name="settingsService">The <see cref="ISettingsService"/> instance to use</param>
 public UISettingsSectionViewModel(IMessenger messenger, ISettingsService settingsService)
     : base(messenger, settingsService)
 {
     _ClearStdinBufferOnRequest = SettingsService.GetValue <bool>(SettingsKeys.ClearStdinBufferOnRequest);
     _ShowPBrainButtons         = SettingsService.GetValue <bool>(SettingsKeys.ShowPBrainButtons);
 }
コード例 #44
0
        public void DeleteSettingThatDoesntExist()
        {
            var model = F.Create<Setting>();
            var mockRepo = new Mock<ISettingsRepository>();
            mockRepo.Setup(x => x.Get("Test")).Returns((GlobalSettings)null).Verifiable();
            MockRepo = mockRepo;

            Service = new SettingsService<NzbDashSettings, Setting>(MockRepo.Object, logger.Object);

            var result = Service.Delete(model);

            Assert.That(result, Is.True);
            logger.Verify(x => x.Trace(It.IsAny<string>()), Times.Once);
            MockRepo.Verify(x => x.Get(It.IsAny<string>()), Times.Once);
            MockRepo.Verify(x => x.Update(It.IsAny<GlobalSettings>()), Times.Never);
            MockRepo.Verify(x => x.Insert(It.IsAny<GlobalSettings>()), Times.Never);
            MockRepo.Verify(x => x.Delete(It.IsAny<GlobalSettings>()), Times.Never); // Null so nothing to delete
        }
コード例 #45
0
 static SettingsService() { Instance = Instance ?? new SettingsService(); }
コード例 #46
0
ファイル: SettingsWindow.xaml.cs プロジェクト: onka13/NoDb
 public SettingsWindow(SettingsService settingsService)
 {
     _settingsService = settingsService ?? new SettingsService(App.SolutionService.GetSettingsFolder());
     InitializeComponent();
 }
コード例 #47
0
ファイル: DSP.cs プロジェクト: Number22/PoorPlayer
        public DSP()
        {
            DSPGainBand = new SingleBand(0.0f, 15.0f, -15.0f, 1.0f, "Gain");
            DSPStereoEnhancerWetDryBand = new Band(0.5f, 1.0f, 0.0f, 0.01f, "WetDry");
            DSPStereoEnhancerWideCoeffBand = new Band(2.0f, 10.0f, 0.0f, 0.2f, "WideCoef");
            DSPDelaySamplesBand = new Band(4096.0f, 88200.0f, 0.0f, 1.0f, "Samples");
            DSPDelayWetDryBand = new Band(0.5f, 1.0f, 0.0f, 0.01f, "WetDry");
            DSPDelayFeedbackBand = new Band(0.5f, 1.0f, 0.0f, 0.01f, "Feedback");
            TempoBand = new Band(0.0f, 100.0f, -50.0f, 1.0f, "Tempo");
            TempoPitchBand = new Band(0.0f, 20.0f, -20.0f, 1.0f, "TempoPitch");
            TempoFreqBand = new Band(44100.0f, 57330, 30870, 441f, "TempoFreq");

            TempoBands = new List<Band>()
            {
                TempoBand,
                TempoPitchBand,
                TempoFreqBand
            };

            DSPDelayBands = new List<Band>()
            {
                DSPDelaySamplesBand,
                DSPDelayWetDryBand,
                DSPDelayFeedbackBand
            };

            DSPStereoEnhancerBands = new List<Band>()
            {
                DSPStereoEnhancerWetDryBand,
                DSPStereoEnhancerWideCoeffBand
            };

            SettingsTempo = new SettingsService<Band>("Tempo");
            CurrentSettingsTempo = SettingsTempo.GetCurrentSettings();
            CurrentSettingsTempo.SetPreset(TempoBands, "CurrentPreset");
            TempoIsActive = CurrentSettingsTempo.IsActive;

            SettingsDSPDelay = new SettingsService<Band>("DSPDelay");
            CurrentSettingsDSPDelay = SettingsDSPDelay.GetCurrentSettings();
            CurrentSettingsDSPDelay.SetPreset(DSPDelayBands, "CurrentPreset");
            DSPDelayIsActive = CurrentSettingsDSPDelay.IsActive;

            SettingsDSPStereoEnhancer = new SettingsService<Band>("DSPStereoEnhancer");
            CurrentSettingsDSPStereoEnhancer = SettingsDSPStereoEnhancer.GetCurrentSettings();
            CurrentSettingsDSPStereoEnhancer.SetPreset(DSPStereoEnhancerBands, "CurrentPreset");
            DSPStereoEnhancerIsActive = CurrentSettingsDSPStereoEnhancer.IsActive;

            TempoBandChanged += ((object sender, ChangedEventArgs e) => { SetTempoValueToBand(e.Value, e.BandIndex); });
            DSPStereoEnhancerBandChanged += ((object sender, ChangedEventArgs e) => { SetStereoEnhancerValueToBand(e.Value, e.BandIndex); });
            DSPDelayBandChanged += ((object sender, ChangedEventArgs e) => { SetDSPDelayValueToBand(e.Value, e.BandIndex); });

            StereoEnhancerEnabled = (DSPStereoEnhancerIsActive == StatusEffect.Enabled) ? true : false;
            DelayEnabled = (DSPDelayIsActive == StatusEffect.Enabled) ? true : false;
            TempoEnabled = (TempoIsActive == StatusEffect.Enabled) ? true : false;

            DSPDelayEnabledEvent += DSPDelayEnableChanged;
            DSPStereoEnhancerEnabledEvent += DSPStereoEnhancerEnableChanged;
            TempoEnabledEvent += TempoEnableChanged;
            DSPMonoInvertEvent += DSPMonoInvertChanged;
            DSPMonoCheckedEvent += DSPMonoCheckedChanged;
            DSPGainBand.ValueChanged += DSPGainValueChanged;
        }
コード例 #48
0
        public override void OnInspectorGUI()
        {
            // Ensure changes done through script are reflected immediately in Inspector by Syncing m_TempPlatformSettings with Actual Settings.
            SyncPlatformSettings();

            serializedObject.Update();

            HandleCommonSettingUI();

            GUILayout.Space(EditorGUI.kSpacing);

            if (AllTargetsAreVariant())
            {
                HandleVariantSettingUI();
            }
            else if (AllTargetsAreMaster())
            {
                HandleMasterSettingUI();
            }

            GUILayout.Space(EditorGUI.kSpacing);

            HandleTextureSettingUI();

            GUILayout.Space(EditorGUI.kSpacing);

            // Only show the packable object list when:
            // - This is a master atlas.
            // - It is not currently selecting multiple atlases.
            if (targets.Length == 1 && AllTargetsAreMaster())
            {
                HandlePackableListUI();
            }

            bool spriteAtlasPackignEnabled = (EditorSettings.spritePackerMode == SpritePackerMode.BuildTimeOnlyAtlas ||
                                              EditorSettings.spritePackerMode == SpritePackerMode.AlwaysOnAtlas);

            if (spriteAtlasPackignEnabled)
            {
                if (GUILayout.Button(styles.packButton, GUILayout.ExpandWidth(false)))
                {
                    SpriteAtlas[] spriteAtlases = new SpriteAtlas[targets.Length];
                    for (int i = 0; i < spriteAtlases.Length; ++i)
                    {
                        spriteAtlases[i] = (SpriteAtlas)targets[i];
                    }

                    SpriteAtlasUtility.PackAtlases(spriteAtlases, EditorUserBuildSettings.activeBuildTarget);

                    // Packing an atlas might change platform settings in the process, reinitialize
                    SyncPlatformSettings();

                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                if (GUILayout.Button(styles.disabledPackLabel, EditorStyles.helpBox))
                {
                    SettingsService.OpenProjectSettings("Project/Editor");
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #49
0
ファイル: MainViewModel.cs プロジェクト: sibbl/ParkenDD
        public MainViewModel(IParkenDdClient client,
            VoiceCommandService voiceCommandService,
            JumpListService jumpList,
            ParkingLotListFilterService filterService,
            SettingsService settings,
            StorageService storage,
            GeolocationService geo,
            TrackingService tracking,
            ExceptionService exceptionService)
        {
            _client = client;
            _voiceCommands = voiceCommandService;
            _jumpList = jumpList;
            _filterService = filterService;
            _settings = settings;
            _storage = storage;
            _geo = geo;
            _tracking = tracking;
            _exceptionService = exceptionService;

            Messenger.Default.Register(this, (SettingChangedMessage msg) =>
            {
                if (msg.IsSetting(nameof(_settings.ShowExperimentalCities)))
                {
                    var temp = SelectedCity;
                    _selectedCity = null;
                    RaisePropertyChanged(() => SelectedCity);
                    RaisePropertyChanged(() => MetaDataCities);
                    _selectedCity = temp;
                    RaisePropertyChanged(() => SelectedCity);
                }
            });

            PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(MetaDataCities))
                {
                    UpdateServiceData();
                }
            };

            NetworkInformation.NetworkStatusChanged += sender =>
            {
                UpdateInternetAvailability();
            };
            UpdateInternetAvailability();
        }
コード例 #50
0
 public GrimDawnDetector(SettingsService settingsService)
 {
     _settingsService = settingsService;
 }
コード例 #51
0
ファイル: ReviewAppService.cs プロジェクト: sibbl/ParkenDD
 public ReviewAppService(SettingsService settings, ResourceService res)
 {
     _settings = settings;
     _res = res;
 }
コード例 #52
0
 public static void OpenSettings()
 {
     SettingsService.OpenProjectSettings("Project/MultiTarget Build Settings");
 }
コード例 #53
0
        public void GetNullSettings()
        {
            var mockRepo = new Mock<ISettingsRepository>();
            mockRepo.Setup(x => x.Get("Test")).Returns(ExpectedLink).Verifiable();
            MockRepo = mockRepo;

            Service = new SettingsService<NzbDashSettings, Setting>(MockRepo.Object, logger.Object);

            var result = Service.GetSettings();

            Assert.That(result.Id, Is.EqualTo(0));
            MockRepo.Verify(x => x.Get(It.IsAny<string>()), Times.Once);
        }
コード例 #54
0
 private void Save()
 {
     SettingsService.SaveSettings();
     MessengerInstance.Send(new NavigationMessage("Home"));
 }
コード例 #55
0
        public void SetUp()
        {
            var mockRepo = new Mock<ISettingsRepository>();
            logger = new Mock<ILogger>();
            ExpectedLink = new GlobalSettings
            {
                Id = 1,
                Content = "oDuq+yWcOzb7qgRvmyljVAS6dLdT1fydgeyMuObYkYJwzTNTXlwC4+V/Tp0O6FZuKfKbDuaonSXMzg8ndZhM118am2HiobAd37KrCFcb7X594TmzrHUFCuqflHPOl3FsZnKnZXqsvABt6QCnFZLb3eG6smE/uqQ5QVohtt2qzi8ZrGifb5pjXJIfSDwnXGj951zKfxQ7Wq84QmAUU5eqPdDBq2ODsLnRfVamrieVPIxzhhaFFKLJF9QvAE8SPm4i",
                SettingsName = "PageName",
            };

            F = new Fixture();
            ExpectedGetLinks = F.CreateMany<GlobalSettings>().ToList();

            mockRepo.Setup(x => x.GetAll()).Returns(ExpectedGetLinks).Verifiable();

            mockRepo.Setup(x => x.Get(It.IsAny<string>())).Returns(ExpectedLink).Verifiable();

            mockRepo.Setup(x => x.Update(It.IsAny<GlobalSettings>())).Returns(true).Verifiable();

            mockRepo.Setup(x => x.Insert(It.IsAny<GlobalSettings>())).Returns(1).Verifiable();

            mockRepo.Setup(x => x.Delete(It.IsAny<GlobalSettings>())).Returns(true).Verifiable();

            MockRepo = mockRepo;
            Service = new SettingsService<NzbDashSettings, Setting>(MockRepo.Object, logger.Object);
        }
コード例 #56
0
        private static void DrawHeaderBlock(string searchContext)
        {
            if (BuildManagerUtility.TryMatchSearch(searchContext, ShowProjectSettingsLabel.text))
            {
                if (GUILayout.Button(ShowProjectSettingsLabel))
                {
                    SettingsService.OpenProjectSettings(BuildManagerUtility.ProjectSettingsPath);
                }

                EditorGUILayout.Separator();
            }

            using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope())
            {
                if (BuildManagerUtility.TryMatchSearch(searchContext, OpenBuiltPlayerOptionsLabel.text))
                {
                    OpenBuiltPlayerOptionsSetting.value = (OpenBuiltPlayerOptions)EditorGUILayout.EnumFlagsField(OpenBuiltPlayerOptionsLabel, OpenBuiltPlayerOptionsSetting);
                    SettingsGUILayout.DoResetContextMenuForLastRect(OpenBuiltPlayerOptionsSetting);
                }

                CreateStandardizedBuildOutputSetting.value = SettingsGUILayout.SettingsToggle(CreateStandardizedBuildOutputLabel, CreateStandardizedBuildOutputSetting, searchContext);

                if (changeCheckScope.changed)
                {
                    Settings.Save();
                }
            }

            using (new EditorGUI.DisabledScope(!CreateStandardizedBuildOutputSetting))
            {
                using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope())
                {
                    using (new EditorGUI.IndentLevelScope())
                    {
                        GroupByBuildNameSetting.value   = SettingsGUILayout.SettingsToggle(GroupByBuildNameLabel, GroupByBuildNameSetting, searchContext);
                        GroupByBuildTargetSetting.value = SettingsGUILayout.SettingsToggle(GroupByBuildTargetLabel, GroupByBuildTargetSetting, searchContext);

                        if (changeCheckScope.changed)
                        {
                            Settings.Save();
                        }

                        if (!BuildManagerUtility.TryMatchSearch(searchContext, StandardizedBuildOutputPathLabel.text) &&
                            !BuildManagerUtility.TryMatchSearch(searchContext, ChangeButtonLabel.text))
                        {
                            return;
                        }

                        Rect position = EditorGUILayout.GetControlRect();
                        position = EditorGUI.PrefixLabel(position, StandardizedBuildOutputPathLabel);

                        if (GUI.Button(position, ChangeButtonLabel, EditorStyles.miniButton))
                        {
                            string value = EditorUtility.OpenFolderPanel("Builds folder location", Path.GetDirectoryName(StandardizedBuildOutputPath), Path.GetFileName(StandardizedBuildOutputPath));

                            if (string.IsNullOrEmpty(value) == false)
                            {
                                StandardizedBuildOutputPathSetting.SetValue(value, true);
                            }
                        }

                        SettingsGUILayout.DoResetContextMenuForLastRect(StandardizedBuildOutputPathSetting);
                        position = EditorGUILayout.GetControlRect();

                        if (Event.current.type == EventType.MouseUp && Event.current.button == 0 && position.Contains(Event.current.mousePosition))
                        {
                            string path = Directory.Exists(StandardizedBuildOutputPath) ? StandardizedBuildOutputPath : Path.GetDirectoryName(Application.dataPath);
                            Assert.IsFalse(string.IsNullOrWhiteSpace(path));
                            Process.Start(path);
                        }

                        string outputLabel = StandardizedBuildOutputPathSetting == DefaultStandardizedBuildOutputPath
                                                 ? $"./{DefaultStandardizedBuildOutputPath}"
                                                 : StandardizedBuildOutputPath;

                        EditorGUI.LabelField(position, outputLabel, EditorStyles.miniLabel);
                        SettingsGUILayout.DoResetContextMenuForLastRect(StandardizedBuildOutputPathSetting);
                    }
                }
            }
        }
コード例 #57
0
 private void OpenSettings()
 {
     SettingsService.OpenUserPreferences("Preferences/Screenshot");
 }
コード例 #58
0
        private void UpdateWatermark()
        {
            string watermarkText1 = @"Type in the search box to search. Press Ctrl+F to focus the search box. Results (up to 1000) will display here.

Search for multiple words separated by space (space means AND). Enclose multiple words in double-quotes """" to search for the exact phrase.

Use syntax like '$property Prop' to narrow results down by item kind. Supported kinds: ";

            string watermarkText2 = @"Use the under(FILTER) clause to filter results to only the nodes where any of the parent nodes in the parent chain matches the FILTER. Examples:
 • $task csc under($project Core)
 • Copying file under(Parent)

Examples:
";

            Inline MakeLink(string query, string before = " • ", string after = "\r\n")
            {
                var hyperlink = new Hyperlink(new Run(query));

                hyperlink.Click += (s, e) => searchLogControl.SearchText = query;

                var span = new System.Windows.Documents.Span();

                if (before != null)
                {
                    span.Inlines.Add(new Run(before));
                }

                span.Inlines.Add(hyperlink);

                if (after != null)
                {
                    if (after == "\r\n")
                    {
                        span.Inlines.Add(new LineBreak());
                    }
                    else
                    {
                        span.Inlines.Add(new Run(after));
                    }
                }

                return(span);
            }

            var watermark = new TextBlock();

            watermark.Inlines.Add(watermarkText1);

            bool isFirst = true;

            foreach (var nodeKind in nodeKinds)
            {
                if (!isFirst)
                {
                    watermark.Inlines.Add(", ");
                }

                isFirst = false;
                watermark.Inlines.Add(MakeLink(nodeKind, before: null, after: null));
            }

            watermark.Inlines.Add(new LineBreak());
            watermark.Inlines.Add(new LineBreak());

            watermark.Inlines.Add(watermarkText2);

            foreach (var example in searchExamples)
            {
                watermark.Inlines.Add(MakeLink(example));
            }

            var recentSearches = SettingsService.GetRecentSearchStrings();

            if (recentSearches.Any())
            {
                watermark.Inlines.Add(@"
Recent:
");

                foreach (var recentSearch in recentSearches.Where(s => !searchExamples.Contains(s) && !nodeKinds.Contains(s)))
                {
                    watermark.Inlines.Add(MakeLink(recentSearch));
                }
            }

            searchLogControl.WatermarkContent = watermark;
        }
コード例 #59
0
        public void TestProcessCodeConfig()
        {
            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.ConfigPath).Returns(settingsService.ConfigPath);

            Mock<IProjectService> mockProjectService = new Mock<IProjectService>();
            mockProjectService.SetupGet(x => x.Name).Returns("Adrian.WindowsPhone");

            CodeConfig codeConfig = new CodeConfig
            {
                References = new List<string> { "test" }
            };

            MockPathBase mockPathBase = new MockPathBase();

            this.mockFileSystem.SetupGet(x => x.Path).Returns(mockPathBase);

            ////this.mockSettingsService.SetupGet(x => x.UseNugetForPlugins).Returns(false);

            /*this.service.ProcessCodeConfig(mockProjectService.Object, "SQLite", "source", "destination");

            mockProjectService.Verify(
                x => x.AddReference(
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<bool>(),
                It.IsAny<bool>()));*/
        }
コード例 #60
0
        public ActionResult SendTestEmail()
        {
            var sb = new StringBuilder();

            sb.AppendFormat("<p>{0}</p>", string.Concat("This is a test email from ", SettingsService.GetSettings().ForumName));
            var email = new Email
            {
                EmailFrom = SettingsService.GetSettings().AdminEmailAddress,
                EmailTo   = SettingsService.GetSettings().AdminEmailAddress,
                NameTo    = "Email Test Admin",
                Subject   = string.Concat("Email Test From ", SettingsService.GetSettings().ForumName)
            };

            email.Body = _emailService.EmailTemplate(email.NameTo, sb.ToString());
            _emailService.SendMail(email);

            TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel
            {
                Message     = "Test Email Sent",
                MessageType = GenericMessages.success
            };
            return(RedirectToAction("TestEmail"));
        }