public ShaderLabFormattingGeneralOptionsControl(GeneralOptions page)
        {
            InitializeComponent();

            BindToOption(FormatOnCloseBraceCheckBox, page, nameof(page.AutomaticallyFormatBlockOnCloseBrace));
            BindToOption(FormatOnPasteCheckBox, page, nameof(page.AutomaticallyFormatOnPaste));
        }
 public TaskBoardCardsModel(GeneralOptions options, WorkItemSelectionService workItemSelectionService,
                            IVisualStudioAdapter visualStudioAdapter)
 {
     this.options = options;
     this.workItemSelectionService = workItemSelectionService;
     this.visualStudioAdapter = visualStudioAdapter;
 }
        public HlslFormattingGeneralOptionsControl(GeneralOptions page)
        {
            InitializeComponent();

            BindToOption(FormatOnSemicolonCheckBox, page, nameof(page.AutomaticallyFormatStatementOnSemicolon));
            BindToOption(FormatOnCloseBraceCheckBox, page, nameof(page.AutomaticallyFormatBlockOnCloseBrace));
            BindToOption(FormatOnPasteCheckBox, page, nameof(page.AutomaticallyFormatOnPaste));
        }
Example #4
0
 void Awake()
 {
     if (instance != null) {
         Debug.Log ("GeneralOptions already exists");
         Destroy (gameObject);
         return;
     }
     instance = this;
 }
        public void GeneralOptions()
        {

            var original = new GeneralOptions(Theme.Dark, false,0.5,125);
            var converter = new GeneralOptionsConverter();
            var state = converter.Convert(original);
            var restored = converter.Convert(state);
            restored.ShouldBeEquivalentTo(original);
        }
Example #6
0
 public static GeneralOptions GetInstance()
 {
     if (instance == null) {
         GameObject go = new GameObject("GeneralOptionsManagerNew");
         go.AddComponent<GeneralOptions>();
         instance = go.GetComponent<GeneralOptions>();
     }
     return instance;
 }
        private void SerializeAndDeserializeWithCulture(string cultureName)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo(cultureName);

            var original = new GeneralOptions(Theme.Dark, false,0.5,125);
            var converter = new GeneralOptionsConverter();
            var state = converter.Convert(original);
            var restored = converter.Convert(state);
            restored.ShouldBeEquivalentTo(original);
        }
Example #8
0
        public AutoWrapper(SVsServiceProvider serviceProvider, IClassifierAggregatorService aggregatorService, IWpfTextView textView)
        {
            var service = serviceProvider.GetService<CommentatorService>();
            this.options = service.GetOptions();

            this.view = textView;
            this.classifier = aggregatorService.GetClassifier(this.view.TextBuffer);

            this.view.TextBuffer.Changed += this.TextBuffer_Changed;
            this.view.Closed += this.View_Closed;
        }
Example #9
0
        /// <summary>
        /// Sets the controls according to the configuration.
        /// </summary>
        private void ConfigToControls()
        {
            changing = true;

            GeneralOptions generalOptions = commConfig.GeneralOptions;

            chkIsBound.Checked          = generalOptions.IsBound;
            chkSendModifiedData.Checked = generalOptions.SendModifiedData;
            numSendAllDataPeriod.SetValue(generalOptions.SendAllDataPeriod);
            chkEnableCommands.Checked      = generalOptions.EnableCommands;
            chkEnableFileCommands.Checked  = generalOptions.EnableFileCommands;
            chkStartLinesOnCommand.Checked = generalOptions.StartLinesOnCommand;
            numMaxLogSize.SetValue(generalOptions.MaxLogSize);

            ctrlClientConnection.ConnectionOptions = commConfig.ConnectionOptions.DeepClone();
            changing = false;
        }
Example #10
0
 /// <summary>
 /// Creates an Instance of the Class
 /// </summary>
 public ChatManager()
 {
     this._logger              = Log.GenInstance();
     this._leadOptions         = Settings.LeadChatOptions;
     this._contactOptions      = Settings.ContactChatOptions;
     this._accountOptions      = Settings.AccountChatOptions;
     this._caseOptions         = Settings.CaseChatOptions;
     this._opportunityOptions  = Settings.OpportunityChatOptions;
     this._userActivityLog     = (Settings.ChatActivityLogCollection.ContainsKey("useractivity")) ? Settings.ChatActivityLogCollection["useractivity"] : null;
     this._sFDCUtility         = SFDCUtility.GetInstance();
     this._activityLogs        = Settings.ChatActivityLogCollection;
     this._customObjectOptions = Settings.CustomObjectChatOptions;
     this._userActivityOptions = Settings.UserActivityChatOptions;
     this._popupPages          = Settings.SFDCOptions.SFDCPopupPages;
     this._generalOptions      = Settings.SFDCOptions;
     this._sfdcUtilityHelper   = SFDCUtiltiyHelper.GetInstance();
 }
Example #11
0
        public OptionsModel(
            ISettingsFaultFinder faultFinder,
            IOptionTasks optionTasks,
            IOutlookAccountPasswordProvider outlookAccountPasswordProvider,
            Contracts.Options data,
            GeneralOptions generalOptions,
            IProfileType profileType,
            bool isGoogle)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (faultFinder == null)
            {
                throw new ArgumentNullException(nameof(faultFinder));
            }
            if (optionTasks == null)
            {
                throw new ArgumentNullException(nameof(optionTasks));
            }
            if (outlookAccountPasswordProvider == null)
            {
                throw new ArgumentNullException(nameof(outlookAccountPasswordProvider));
            }
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }
            if (profileType == null)
            {
                throw new ArgumentNullException(nameof(profileType));
            }

            _faultFinder = faultFinder;
            _optionTasks = optionTasks;
            _outlookAccountPasswordProvider = outlookAccountPasswordProvider;
            _generalOptions = generalOptions;
            ProfileType     = profileType;

            Id = data.Id;

            _isGoogle = isGoogle;

            InitializeData(data);
        }
Example #12
0
        public async Task UpdateOptions(Options options, GeneralOptions generalOptions)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }
            if (_profileId != options.Id)
            {
                throw new ArgumentException($"Cannot update runner for profile '{_profileId}' with options of profile '{options.Id}'");
            }

            if (_isRunning == 1)
            {
                s_logger.Info($"Applying options to profile '{options.Name}' ({_profileId}) which is currently running.");
            }

            _pendingOutlookItems.Clear();
            _fullSyncPending = false;

            if (!_profile.IsEmpty)
            {
                _profile.FolderChangeWatcher.ItemSavedOrDeleted -= FolderChangeWatcher_ItemSavedOrDeleted;
                _profile.FolderChangeWatcher.Dispose();
            }

            _profile = new ProfileData(
                options.Inactive,
                options.Name,
                generalOptions.CheckIfOnline,
                TimeSpan.FromMinutes(options.SynchronizationIntervalInMinutes),
                options.ProxyOptions,
                options.Inactive
          ? NullOutlookSynchronizer.Instance
          : await _synchronizerFactory.CreateSynchronizer(options, generalOptions),
                !options.Inactive && options.EnableChangeTriggeredSynchronization
          ? _folderChangeWatcherFactory.Create(options.OutlookFolderEntryId, options.OutlookFolderStoreId)
          : NullItemCollectionChangeWatcher.Instance);

            _profile.FolderChangeWatcher.ItemSavedOrDeleted += FolderChangeWatcher_ItemSavedOrDeleted;

            _errorHandlingStrategy = new ErrorHandlingStrategy(_profile, _dateTimeProvider, generalOptions.MaxSucessiveWarnings);
        }
Example #13
0
        internal PythonToolsService(IServiceContainer container)
        {
            _container = container;

            var langService = new PythonLanguageInfo(container);

            _container.AddService(langService.GetType(), langService, true);

            IVsTextManager textMgr = (IVsTextManager)container.GetService(typeof(SVsTextManager));

            if (textMgr != null)
            {
                var langPrefs = new LANGPREFERENCES[1];
                langPrefs[0].guidLang = typeof(PythonLanguageInfo).GUID;
                ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null));
                _langPrefs = new LanguagePreferences(this, langPrefs[0]);

                Guid             guid = typeof(IVsTextManagerEvents2).GUID;
                IConnectionPoint connectionPoint;
                ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint);
                connectionPoint.Advise(_langPrefs, out _langPrefsTextManagerCookie);
            }

            _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService));
            var compModel = (IComponentModel)container.GetService(typeof(SComponentModel));

            _interpreterOptionsService = compModel.GetService <IInterpreterOptionsService>();
            if (_interpreterOptionsService != null)     // not available in some test cases...
            {
                _interpreterOptionsService.InterpretersChanged       += InterpretersChanged;
                _interpreterOptionsService.DefaultInterpreterChanged += UpdateDefaultAnalyzer;
                LoadInterpreterOptions();
            }

            _idleManager              = new IdleManager(container);
            _advancedOptions          = new AdvancedEditorOptions(this);
            _debuggerOptions          = new DebuggerOptions(this);
            _generalOptions           = new GeneralOptions(this);
            _surveyNews               = new SurveyNewsService(container);
            _globalInterpreterOptions = new GlobalInterpreterOptions(this, _interpreterOptionsService);
            _globalInterpreterOptions.Load();
            _debugInteractiveOptions = new PythonInteractiveCommonOptions(this, "Debug Interactive Window", "");

            _logger = new PythonToolsLogger(ComponentModel.GetExtensions <IPythonToolsLogger>().ToArray());
            InitializeLogging();
        }
        public async Task SetUp()
        {
            _synchronizerFactory          = MockRepository.GenerateStub <ISynchronizerFactory>();
            _synchronizationProfileRunner = new SynchronizationProfileRunner(
                _synchronizerFactory,
                MockRepository.GenerateStub <ISynchronizationReportSink>(),
                MockRepository.GenerateStub <IFolderChangeWatcherFactory> (),
                delegate { },
                MockRepository.GenerateStub <ISynchronizationRunLogger> ());

            var options        = new Options();
            var generalOptions = new GeneralOptions();

            _stubSynchronizer = new StubSynchronizer();
            _synchronizerFactory.Expect(f => f.CreateSynchronizer(options, generalOptions)).Return(Task.FromResult <IOutlookSynchronizer>(_stubSynchronizer));
            await _synchronizationProfileRunner.UpdateOptions(options, generalOptions);
        }
Example #15
0
        private void sendEmailChk_CheckedChanged(object sender, EventArgs e)
        {
            if (sendEmailChk.Checked && !loading)
            {
                GeneralOptions go = _mceOptions.GeneralOptions; // Get the current copy of GO

                eMailSettingsForm eMailForm = new eMailSettingsForm(_pipeProxy, go);
                if (eMailForm.ShowDialog() == System.Windows.Forms.DialogResult.Abort)
                {
                    sendEmailChk.Checked = false; // the user did not enter any server address
                }
                else
                {
                    _mceOptions.UpdateGeneralOptions(go, false); // Save the updated settings
                }
            }
        }
Example #16
0
 private ReportLogMode GetReportLogMode(GeneralOptions options)
 {
     if (options.LogReportsWithoutWarningsOrErrors)
     {
         // HINT: althoug it is possible that in this case LogReportsWithWarnings is false,
         // the UI doesnt offer that feature to just configure logging of reports without errors and warning
         return(ReportLogMode.All);
     }
     else if (options.LogReportsWithWarnings)
     {
         return(ReportLogMode.WarningsOrErrors);
     }
     else
     {
         return(ReportLogMode.OnlyWithErrors);
     }
 }
Example #17
0
 private ReportPopupMode GetReportPopupMode(GeneralOptions options)
 {
     if (options.ShowReportsWithWarningsImmediately)
     {
         // HINT: althoug it is possible that in this case ShowReportsWithErrorsImmediately is false,
         // the UI doesnt offer that feature to just show reports with warnings immediately
         return(ReportPopupMode.WarningsAndErrors);
     }
     else if (options.ShowReportsWithErrorsImmediately)
     {
         return(ReportPopupMode.JustErrors);
     }
     else
     {
         return(ReportPopupMode.NoPopup);
     }
 }
Example #18
0
        //private GeneralOptionsDto GetGeneralOptionsDto()
        //{
        //    Task<GeneralOptionsDto> task = Task.Run<GeneralOptionsDto>(async () => await GetGeneralOptionsDtoAsync());
        //    return task.Result;
        //}

        private async Task <GeneralOptionsDto> GetGeneralOptionsDtoAsync()
        {
            // Call from a background thread to avoid blocking the UI thread
            //var generalOptions = GeneralOptions.Instance;

            // Call from a background thread to avoid blocking the UI thread
            var generalOptions = await GeneralOptions.GetLiveInstanceAsync();

            return(new GeneralOptionsDto
            {
                LineLengthTruncationLimit = generalOptions.LineLengthTruncationLimit,
                OverallLinesLimit = generalOptions.OverallLinesLimit,
                ShowFileNamesInPopUp = generalOptions.ShowFileNamesInPopUp,
                ShowReadMeDotTxt = generalOptions.ShowReadMeDotTxt,
                ShowSolutionOpenPopUpDotTxt = generalOptions.ShowSolutionOpenPopUpDotTxt,
            });
        }
Example #19
0
 /// <summary>
 /// Read eMail settings from the General Options memory object into the GUI page
 /// </summary>
 /// <param name="go">General Options to read settings from</param>
 private void ReadSettings(GeneralOptions go)
 {
     smtpServer.Text              = go.eMailSettings.eMailBasicSettings.smtpServer;
     portNo.Text                  = go.eMailSettings.eMailBasicSettings.port.ToString();
     sslChk.Checked               = go.eMailSettings.eMailBasicSettings.ssl;
     fromAddress.Text             = go.eMailSettings.eMailBasicSettings.fromAddress;
     toAddress.Text               = go.eMailSettings.eMailBasicSettings.toAddresses;
     sendSuccessChk.Checked       = go.eMailSettings.successEvent;
     sendFailedChk.Checked        = go.eMailSettings.failedEvent;
     sendCancelledChk.Checked     = go.eMailSettings.cancelledEvent;
     sendStartChk.Checked         = go.eMailSettings.startEvent;
     sendDownloadErrorChk.Checked = go.eMailSettings.downloadFailedEvent;
     sendQueueChk.Checked         = go.eMailSettings.queueEvent;
     userName.Text                = go.eMailSettings.eMailBasicSettings.userName;
     passWord.Text                = go.eMailSettings.eMailBasicSettings.password;
     confirmPassword.Text         = go.eMailSettings.eMailBasicSettings.password;
 }
        protected ProfileModelFactoryBase(IProfileType profileType, IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, GeneralOptions generalOptions, IViewOptions viewOptions, OptionModelSessionData sessionData)
        {
            if (profileType == null)
            {
                throw new ArgumentNullException(nameof(profileType));
            }
            if (optionsViewModelParent == null)
            {
                throw new ArgumentNullException(nameof(optionsViewModelParent));
            }
            if (outlookAccountPasswordProvider == null)
            {
                throw new ArgumentNullException(nameof(outlookAccountPasswordProvider));
            }
            if (availableCategories == null)
            {
                throw new ArgumentNullException(nameof(availableCategories));
            }
            if (optionTasks == null)
            {
                throw new ArgumentNullException(nameof(optionTasks));
            }
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }
            if (viewOptions == null)
            {
                throw new ArgumentNullException(nameof(viewOptions));
            }
            if (sessionData == null)
            {
                throw new ArgumentNullException(nameof(sessionData));
            }

            ProfileType                    = profileType;
            OptionsViewModelParent         = optionsViewModelParent;
            OutlookAccountPasswordProvider = outlookAccountPasswordProvider;
            AvailableCategories            = availableCategories;
            OptionTasks                    = optionTasks;
            GeneralOptions                 = generalOptions;
            ViewOptions                    = viewOptions;
            SessionData                    = sessionData;
            ServerSettingsDetector         = new Lazy <IServerSettingsDetector>(CreateServerSettingsDetector);
        }
Example #21
0
        public OptionsCollectionViewModel(
            GeneralOptions generalOptions,
            IOutlookAccountPasswordProvider outlookAccountPasswordProvider,
            IReadOnlyList <string> availableEventCategories,
            Func <Guid, string> profileDataDirectoryFactory,
            IUiService uiService,
            IOptionTasks optionTasks)
        {
            _optionTasks = optionTasks;
            _profileDataDirectoryFactory = profileDataDirectoryFactory;
            _uiService = uiService;
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }
            if (profileDataDirectoryFactory == null)
            {
                throw new ArgumentNullException(nameof(profileDataDirectoryFactory));
            }
            if (optionTasks == null)
            {
                throw new ArgumentNullException(nameof(optionTasks));
            }

            _generalOptions = generalOptions;


            _optionsViewModelFactory = new OptionsViewModelFactory(
                this,
                outlookAccountPasswordProvider,
                availableEventCategories,
                optionTasks);
            AddCommand                      = new DelegateCommand(_ => Add());
            AddMultipleCommand              = new DelegateCommand(_ => AddMultiple());
            CloseCommand                    = new DelegateCommand(shouldSaveNewOptions => Close((bool)shouldSaveNewOptions));
            DeleteSelectedCommand           = new DelegateCommandHandlingRequerySuggested(_ => DeleteSelected(), _ => CanDeleteSelected);
            CopySelectedCommand             = new DelegateCommandHandlingRequerySuggested(_ => CopySelected(), _ => CanCopySelected);
            MoveSelectedUpCommand           = new DelegateCommandHandlingRequerySuggested(_ => MoveSelectedUp(), _ => CanMoveSelectedUp);
            MoveSelectedDownCommand         = new DelegateCommandHandlingRequerySuggested(_ => MoveSelectedDown(), _ => CanMoveSelectedDown);
            OpenProfileDataDirectoryCommand = new DelegateCommandHandlingRequerySuggested(_ => OpenProfileDataDirectory(), _ => CanOpenProfileDataDirectory);
            ExpandAllCommand                = new DelegateCommandHandlingRequerySuggested(_ => ExpandAll(), _ => _options.Count > 0);
            CollapseAllCommand              = new DelegateCommandHandlingRequerySuggested(_ => CollapseAll(), _ => _options.Count > 0);
            ExportAllCommand                = new DelegateCommandHandlingRequerySuggested(_ => ExportAll(), _ => _options.Count > 0);
            ImportCommand                   = new DelegateCommandHandlingRequerySuggested(_ => Import(), _ => true);
        }
        public void SendNotification(Notification notification, GeneralOptions options)
        {
            var notifierFactory = new NotifierFactory(this, options);
            var notifierType    = options.Common.NotifierType;

            var notifier = notifierFactory.GetNotifier(notifierType);

            try
            {
                _logger.Info($"Sending notification using {notifierType.ToString()} notifier");
                notifier.Send(notification);
                _logger.Info("Notification sent");
            }
            catch (Exception exception)
            {
                _exceptionHandler.Handle(exception);
            }
        }
Example #23
0
        private void SetPropertiesToDefaultValues(GeneralOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            foreach (var propInfo in options.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                var propNameAttrib     = GetAttribute <PropertyNameAttribute>(propInfo);
                var defaultValueAttrib = GetAttribute <DefaultValueAttribute>(propInfo);
                if (propNameAttrib == null || defaultValueAttrib == null)
                {
                    continue;
                }
                propInfo.SetValue(options, defaultValueAttrib.Value, null);
            }
        }
        internal ScrollOptionsViewModel(GeneralOptions model)
        {
            _model        = model;
            AvailableKeys = Enum
                            .GetValues(typeof(InteractionKey))
                            .Cast <InteractionKey>()
                            .ToArray();

            AvailableScrollProfiles = Enum
                                      .GetValues(typeof(ScrollType))
                                      .Cast <ScrollType>()
                                      .ToArray();

            AvailableVelocityCurves = Enum
                                      .GetValues(typeof(VelocityCurve))
                                      .Cast <VelocityCurve>()
                                      .ToArray();
        }
Example #25
0
        /// <summary>
        /// Sets the configuration according to the controls.
        /// </summary>
        private void ControlsToConfing()
        {
            // general options
            GeneralOptions generalOptions = serverConfig.GeneralOptions;

            generalOptions.UnrelIfInactive       = decimal.ToInt32(numUnrelIfInactive.Value);
            generalOptions.GenerateAckCmd        = chkGenerateAckCmd.Checked;
            generalOptions.MaxLogSize            = decimal.ToInt32(numMaxLogSize.Value);
            generalOptions.DisableFormulas       = chkDisableFormulas.Checked;
            generalOptions.EnableFormulasObjNums = ScadaUtils.ParseRange(txtEnableFormulasObjNums.Text, true, true);

            // listener options
            ListenerOptions listenerOptions = serverConfig.ListenerOptions;

            listenerOptions.Port      = decimal.ToInt32(numPort.Value);
            listenerOptions.Timeout   = decimal.ToInt32(numTimeout.Value);
            listenerOptions.SecretKey = ScadaUtils.HexToBytes(txtSecretKey.Text.Trim());
        }
        protected ProfileBase(IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, ISettingsFaultFinder settingsFaultFinder, GeneralOptions generalOptions, IViewOptions viewOptions, OptionModelSessionData sessionData)
        {
            if (optionsViewModelParent == null)
            {
                throw new ArgumentNullException(nameof(optionsViewModelParent));
            }
            if (outlookAccountPasswordProvider == null)
            {
                throw new ArgumentNullException(nameof(outlookAccountPasswordProvider));
            }
            if (availableCategories == null)
            {
                throw new ArgumentNullException(nameof(availableCategories));
            }
            if (optionTasks == null)
            {
                throw new ArgumentNullException(nameof(optionTasks));
            }
            if (settingsFaultFinder == null)
            {
                throw new ArgumentNullException(nameof(settingsFaultFinder));
            }
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }
            if (viewOptions == null)
            {
                throw new ArgumentNullException(nameof(viewOptions));
            }
            if (sessionData == null)
            {
                throw new ArgumentNullException(nameof(sessionData));
            }

            OptionsViewModelParent         = optionsViewModelParent;
            OutlookAccountPasswordProvider = outlookAccountPasswordProvider;
            AvailableCategories            = availableCategories;
            OptionTasks         = optionTasks;
            SettingsFaultFinder = settingsFaultFinder;
            GeneralOptions      = generalOptions;
            ViewOptions         = viewOptions;
            SessionData         = sessionData;
        }
Example #27
0
        private ProfilerPlugin(Package package, IVsOutputWindowPane outputPaneTizen, IVsThreadedWaitDialogFactory dialogFactory)
        {
            _package         = package ?? throw new ArgumentNullException(nameof(package));
            _outputPaneTizen = outputPaneTizen;
            _dialogFactory   = dialogFactory;

            OLEServiceProvider =
                GetService(typeof(Microsoft.VisualStudio.OLE.Interop.IServiceProvider)) as
                Microsoft.VisualStudio.OLE.Interop.IServiceProvider;

            VsUiShell5 = GetIVsUIShell5();

            ExplorerWindowCommand.Initialize(_package);
            ProfilingProgressWindowCommand.Initialize(_package);

            GeneralOptions   = new GeneralOptions(new SettingsStore(_package, SettingsCollectionPath));
            HeaptrackOptions = new HeaptrackOptions(new SettingsStore(_package, SettingsCollectionPath));

            RegisterMenuHandlers();

            ProfileLauncher.Initialize();
            HeaptrackLauncher.Initialize();

            ProfileLauncher   = ProfileLauncher.Instance;
            HeaptrackLauncher = HeaptrackLauncher.Instance;
            HeaptrackLauncher.OnSessionFinished += HandleMenuItemRunMemoryProfiler;

            _solutionListener = new SolutionListener(_package)
            {
                AfterOpenSolution = delegate
                {
                    _solutionSessionsContainer.Update();
                    return(VSConstants.S_OK);
                },
                AfterCloseSolution = delegate
                {
                    _solutionSessionsContainer.Update();
                    return(VSConstants.S_OK);
                }
            };
            _solutionListener.Initialize();

            _solutionSessionsContainer = new SolutionSessionsContainer((DTE2)Package.GetGlobalService(typeof(SDTE)));
        }
Example #28
0
    public override void Initialize(GeneralOptions options, GameScene gameScene)
    {
        difficultLevel = (DifficultLevel)options["difficultLevel"];
        if (difficultLevel == DifficultLevel.Normal)
        {
            ShuffeNum = 6;
            SearchNum = 3;
            matchTime = 240f;
            // matchTime = 40f;
        }
        else
        {
            ShuffeNum = 10;
            SearchNum = 5;
            matchTime = 360;
        }

        base.Initialize(options, gameScene);
    }
        public MultipleOptionsTemplateViewModel(
            NameSpace session,
            IOptionsViewModelParent parent,
            GeneralOptions generalOptions,
            IServerSettingsTemplateViewModel serverSettingsViewModel,
            ProfileType profileType)

        {
            _parent  = parent;
            _session = session;
            if (session == null)
            {
                throw new ArgumentNullException(nameof(session));
            }
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }

            _discoverResourcesCommand = new DelegateCommandWithoutCanExecuteDelegation(_ =>
            {
                ComponentContainer.EnsureSynchronizationContext();
                DiscoverResourcesAsync();
            });

            _getAccountSettingsCommand = new DelegateCommandWithoutCanExecuteDelegation(_ =>
            {
                ComponentContainer.EnsureSynchronizationContext();
                GetAccountSettings();
            });

            _networkSettingsViewModel = new NetworkSettingsViewModel();

            SubOptions = new[] { _networkSettingsViewModel };

            _serverSettingsViewModel = serverSettingsViewModel;
            _profileType             = profileType;
            _generalOptions          = generalOptions;
        }
Example #30
0
        internal PythonToolsService(IServiceContainer container)
        {
            _container = container;

            var langService = new PythonLanguageInfo(container);

            _container.AddService(langService.GetType(), langService, true);

            _langPrefs = new Lazy <LanguagePreferences>(() => new LanguagePreferences(this, typeof(PythonLanguageInfo).GUID));

            _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService));
            var compModel = (IComponentModel)container.GetService(typeof(SComponentModel));

            _interpreterRegistry = compModel.GetService <IInterpreterRegistryService>();
            if (_interpreterRegistry != null)
            {
                _interpreterRegistry.InterpretersChanged += InterpretersChanged;
            }

            _interpreterOptionsService = compModel.GetService <IInterpreterOptionsService>();
            if (_interpreterOptionsService != null)     // not available in some test cases...
            {
                _interpreterOptionsService.DefaultInterpreterChanged += UpdateDefaultAnalyzer;
                LoadInterpreterOptions();
            }

            _idleManager              = new IdleManager(container);
            _advancedOptions          = new AdvancedEditorOptions(this);
            _debuggerOptions          = new DebuggerOptions(this);
            _generalOptions           = new GeneralOptions(this);
            _surveyNews               = new SurveyNewsService(container);
            _suppressDialogOptions    = new SuppressDialogOptions(this);
            _globalInterpreterOptions = new GlobalInterpreterOptions(this, _interpreterOptionsService, _interpreterRegistry);
            _globalInterpreterOptions.Load();
            _interactiveOptions = new PythonInteractiveOptions(this, "Interactive");
            _interactiveOptions.Load();
            _debugInteractiveOptions = new PythonInteractiveOptions(this, "Debug Interactive Window");
            _debuggerOptions.Load();
            _factoryProviders = ComponentModel.DefaultExportProvider.GetExports <IPythonInterpreterFactoryProvider, Dictionary <string, object> >();
            _logger           = new PythonToolsLogger(ComponentModel.GetExtensions <IPythonToolsLogger>().ToArray());
            InitializeLogging();
        }
Example #31
0
        public async Task SetOptions(Options[] options, GeneralOptions generalOptions)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }

            Dictionary <Guid, SynchronizationProfileRunner> workersById = new Dictionary <Guid, SynchronizationProfileRunner>();

            foreach (var option in options)
            {
                try
                {
                    SynchronizationProfileRunner profileRunner;
                    if (!_runnersById.TryGetValue(option.Id, out profileRunner))
                    {
                        profileRunner = new SynchronizationProfileRunner(
                            _synchronizerFactory,
                            _reportSink,
                            _folderChangeWatcherFactory,
                            _ensureSynchronizationContext,
                            _runLogger,
                            DateTimeProvider.Instance,
                            option.Id);
                    }

                    await profileRunner.UpdateOptions(option, generalOptions);

                    workersById.Add(option.Id, profileRunner);
                }
                catch (Exception x)
                {
                    ExceptionHandler.Instance.LogException(x, s_logger);
                }
            }

            _runnersById = workersById;
        }
Example #32
0
        public QueueManager()
        {
            // Connect net drives and setup search records for source locations
            foreach (MonitorJobOptions mjo in MCEBuddyConf.GlobalMCEConfig.AllMonitorTasks)
            {
                string searchPath = mjo.searchPath;
                string domainName = mjo.domainName;
                string userName   = mjo.userName;
                string password   = mjo.password;

                // Connect network drives if needed
                if (Util.Net.IsUNCPath(searchPath))
                {
                    ConnectNet(searchPath, domainName, userName, password);
                }
            }

            // Connect net drives for task destinations
            foreach (ConversionJobOptions cjo in MCEBuddyConf.GlobalMCEConfig.AllConversionTasks)
            {
                string destinationPath = cjo.destinationPath;
                string domainName      = cjo.domainName;
                string userName        = cjo.userName;
                string password        = cjo.password;

                // Connect network drives if needed - If there is a temp folder specific in the task, then we assume the temp folder is connected to same machine as the destination path
                if (Util.Net.IsUNCPath(destinationPath))
                {
                    ConnectNet(destinationPath, domainName, userName, password);
                }
            }

            // Check if the temp folder is a network drive if so, connect using the general authentication
            GeneralOptions go = MCEBuddyConf.GlobalMCEConfig.GeneralOptions;

            if (Util.Net.IsUNCPath(go.tempWorkingPath))
            {
                ConnectNet(go.tempWorkingPath, go.domainName, go.userName, go.password);
            }

            _minimumAge = MCEBuddyConf.GlobalMCEConfig.GeneralOptions.minimumAge;
        }
Example #33
0
        private async Task <GeneralOptionsDto> GetGeneralOptionsDtoAsync()
        {
            // Call from a background thread to avoid blocking the UI thread
            //var generalOptions = GeneralOptions.Instance;

            // Call from a background thread to avoid blocking the UI thread
            var generalOptions = await GeneralOptions.GetLiveInstanceAsync();

            var hiddenOptions = await HiddenOptions.GetLiveInstanceAsync();

            return(new GeneralOptionsDto
            {
                LastPopUpDateTime = hiddenOptions.LastPopUpDateTime,
                MaximumPopUpsWeekDay = generalOptions.MaximumPopUpsWeekDay.GetAsInteger(),
                MaximumPopUpsWeekEnd = generalOptions.MaximumPopUpsWeekEnd.GetAsInteger(),
                PopUpIntervalInMins = generalOptions.PopUpIntervalInMins.GetAsInteger(),
                PopUpCountToday = hiddenOptions.PopUpCountToday,
                TimeOutInMilliSeconds = generalOptions.TimeOutInMilliSeconds.GetAsInteger(),
            });
        }
Example #34
0
        private void oKcmd_Click(object sender, EventArgs e)
        {
            if (!CheckValidTimes())
            {
                return;
            }

            WriteGeneralSettings();                         // Write the latest settings

            GeneralOptions go = _mceOptions.GeneralOptions; // Get the current copy of GO

            // Validate and update the expert form settings
            SettingsSystemSettingsForm esf = new SettingsSystemSettingsForm(go);

            esf.WriteAndValidateSettings();

            _mceOptions.UpdateGeneralOptions(go, false); // Save the updated settings

            this.Close();                                // locale not changed, we're good
        }
        public TfsQueryShortcutViewModel(TfsQueryShortcutAssigner shortcutAssigner,
            TfsQueryShortcutOpener shortcutOpener, TfsQueryShortcutStore store, GeneralOptions options)
        {
            this.store = store;
            this.options = options;

            commandHandlerMappings = new Dictionary<int, Action>
            {
                {MenuCommands.AssignTfsQueryShortcut1, () => shortcutAssigner.Assign(0)},
                {MenuCommands.AssignTfsQueryShortcut2, () => shortcutAssigner.Assign(1)},
                {MenuCommands.AssignTfsQueryShortcut3, () => shortcutAssigner.Assign(2)},
                {MenuCommands.AssignTfsQueryShortcut4, () => shortcutAssigner.Assign(3)},
                {MenuCommands.AssignTfsQueryShortcut5, () => shortcutAssigner.Assign(4)},
                {MenuCommands.OpenTfsQuery1, () => shortcutOpener.Open(0)},
                {MenuCommands.OpenTfsQuery2, () => shortcutOpener.Open(1)},
                {MenuCommands.OpenTfsQuery3, () => shortcutOpener.Open(2)},
                {MenuCommands.OpenTfsQuery4, () => shortcutOpener.Open(3)},
                {MenuCommands.OpenTfsQuery5, () => shortcutOpener.Open(4)},
            };
        }
 public void SaveOptions(GeneralOptions options)
 {
     using (var key = OpenOptionsKey())
     {
         key.SetValue(s_shouldCheckForNewerVersionsValueName, options.ShouldCheckForNewerVersions ? 1 : 0);
         key.SetValue(s_checkIfOnline, options.CheckIfOnline ? 1 : 0);
         key.SetValue(s_storeAppDataInRoamingFolder, options.StoreAppDataInRoamingFolder ? 1 : 0);
         key.SetValue(s_disableCertificateValidation, options.DisableCertificateValidation ? 1 : 0);
         key.SetValue(s_enableTls12, options.EnableTls12 ? 1 : 0);
         key.SetValue(s_enableSsl3, options.EnableSsl3 ? 1 : 0);
         key.SetValue(s_fixInvalidSettings, options.FixInvalidSettings ? 1 : 0);
         key.SetValue(s_DisplayAllProfilesAsGeneric, options.DisplayAllProfilesAsGeneric ? 1 : 0);
         key.SetValue(s_LogReportsWithoutWarningsOrErrors, options.LogReportsWithoutWarningsOrErrors ? 1 : 0);
         key.SetValue(s_LogReportsWithWarnings, options.LogReportsWithWarnings ? 1 : 0);
         key.SetValue(s_ShowReportsWithWarningsImmediately, options.ShowReportsWithWarningsImmediately ? 1 : 0);
         key.SetValue(s_ShowReportsWithErrorsImmediately, options.ShowReportsWithErrorsImmediately ? 1 : 0);
         key.SetValue(s_MaxReportAgeInDays, options.MaxReportAgeInDays);
         key.SetValue(s_EnableDebugLog, options.EnableDebugLog ? 1 : 0);
     }
 }
        public TfsQueryShortcutViewModel(TfsQueryShortcutAssigner shortcutAssigner,
                                         TfsQueryShortcutOpener shortcutOpener, TfsQueryShortcutStore store, GeneralOptions options)
        {
            this.store   = store;
            this.options = options;

            commandHandlerMappings = new Dictionary <int, Action>
            {
                { MenuCommands.AssignTfsQueryShortcut1, () => shortcutAssigner.Assign(0) },
                { MenuCommands.AssignTfsQueryShortcut2, () => shortcutAssigner.Assign(1) },
                { MenuCommands.AssignTfsQueryShortcut3, () => shortcutAssigner.Assign(2) },
                { MenuCommands.AssignTfsQueryShortcut4, () => shortcutAssigner.Assign(3) },
                { MenuCommands.AssignTfsQueryShortcut5, () => shortcutAssigner.Assign(4) },
                { MenuCommands.OpenTfsQuery1, () => shortcutOpener.Open(0) },
                { MenuCommands.OpenTfsQuery2, () => shortcutOpener.Open(1) },
                { MenuCommands.OpenTfsQuery3, () => shortcutOpener.Open(2) },
                { MenuCommands.OpenTfsQuery4, () => shortcutOpener.Open(3) },
                { MenuCommands.OpenTfsQuery5, () => shortcutOpener.Open(4) },
            };
        }
 // Use this for initialization
 public virtual void Initialize(GeneralOptions options, GameScene gameScene)
 {
     this.gameScene = gameScene;
     difficultLevel = (DifficultLevel)options["difficultLevel"];
     gameMode       = (GameMode)options["gameMode"];
     isSavedGame    = (bool)options ["isSavedGame"];
     SetupRowColOfBoard(difficultLevel);
     // setup custom fsm
     fsm = gameObject.AddComponent <CustomFSMManager> ();
     fsm.Initialize(typeof(GameState), this, false);
     StateMachineChange = new StateMachineChangeDelegate(fsm.StateMachineChange);
     if (isSavedGame)
     {
         StateMachineChange(GameState.LoadSavedGame);
     }
     else
     {
         StateMachineChange(GameState.StartGame);
     }
 }
Example #39
0
        // Factory method to read from config
        public static Options loadFromConfig(bool withDefaults = false)
        {
            lock (lockObject)
            {
                logger.Info("Loading configuration");
                GeneralOptions generalOpts = null;
                AWSOptions awsOpts = null;
                try
                {
                    generalOpts = GeneralOptions.load();
                    awsOpts = AWSOptions.load();
                    if (!String.IsNullOrEmpty(generalOpts.DomainName) 
                        && generalOpts.DomainName[generalOpts.DomainName.Length - 1] != '.')
                    {
                        logger.Debug("Forcefully terminating domain name with dot.");
                        generalOpts.DomainName = generalOpts.DomainName + ".";
                    }
                }
                catch (FileNotFoundException)
                {
                    if (generalOpts == null)
                    {
                        generalOpts = new GeneralOptions();
                        generalOpts.ExternalIPNeeded = true;
                        generalOpts.HasInitialDelay = true;
                        generalOpts.IPProviders = new List<IPProvider>();
                        generalOpts.RunOnStart = false;
                        generalOpts.TimerPeriodSec = 300;
                    }

                    if (awsOpts == null)
                    {
                        awsOpts = new AWSOptions();
                        awsOpts.AWSAccessKey = String.Empty;
                        awsOpts.AWSSecretKey = String.Empty;
                        awsOpts.HostedZoneId = String.Empty;
                    }
                }
                return new Options(generalOpts, awsOpts);
            }
        }
Example #40
0
    /// <summary>
    /// Создаёт экземпляры всех настроек и получает значения, чтобы провести процесс валидации при старте приложения.
    /// </summary>
    public static IServiceCollection AddOptionsAndSecretsValidationOnStartup(this IServiceCollection services)
    {
        ////перместить валидацию в общий процесс прогрева https://andrewlock.net/reducing-latency-by-pre-building-singletons-in-asp-net-core/
        try
        {
            HostOptions        hostOptions        = services.BuildServiceProvider().GetService <IOptions <HostOptions> >().Value;
            AwsOptions         awsOptions         = services.BuildServiceProvider().GetService <IOptions <AwsOptions> >().Value;
            ApplicationOptions applicationOptions = services.BuildServiceProvider().GetService <IOptions <ApplicationOptions> >().Value;
            GeneralOptions     generalOptions     = services.BuildServiceProvider().GetService <IOptions <GeneralOptions> >().Value;
            IdempotencyOptions idempotencyOptions = services.BuildServiceProvider().GetService <IOptions <IdempotencyOptions> >().Value;

            AppSecrets appSecrets = services.BuildServiceProvider().GetService <IOptions <AppSecrets> >().Value;
        }
        catch (OptionsValidationException ex)
        {
            Console.WriteLine($"Error validating {ex.OptionsType.FullName}: {string.Join(", ", ex.Failures)}");
            throw;
        }

        return(services);
    }
        public WorkItemContextMenuViewModel(GeneralOptions options, WorkItemSelectionService workItemSelectionService,
                                            IVisualStudioAdapter visualStudioAdapter)
        {
            this.options = options;
            this.workItemSelectionService = workItemSelectionService;
            this.visualStudioAdapter = visualStudioAdapter;

            commandHandlerMappings = new Dictionary<int, Action>
            {
                {MenuCommands.ShowAffectedChangesetFiles, ShowAffectedChangesetFiles},
                {MenuCommands.ShowChangesetsWithAffectedFiles, ShowChangesetsWithAffectedFiles},
                {MenuCommands.ShowReviewWindow, ShowReviewWindow}
            };

            commandFeatureMappings = new Dictionary<int, Feature>
            {
                {MenuCommands.ShowAffectedChangesetFiles, Feature.ShowAffectedChangesetFiles},
                {MenuCommands.ShowChangesetsWithAffectedFiles, Feature.ShowChangesetsWithAffectedFiles},
                {MenuCommands.ShowReviewWindow, Feature.Review}
            };
        }
 public static void ShowGeneralOptions()
 {
     var dlg = new GeneralOptions();
     dlg.ShowDialog();
 }
Example #43
0
 private Options(GeneralOptions generalOpts, AWSOptions awsOpts)
 {
     this.generalOptions = generalOpts;
     this.awsOptions = awsOpts;
 }
Example #44
0
        private static bool ShouldWrap(
            GeneralOptions options,
            ITextChange change,
            ITextSnapshotLine line,
            LineCommentInfo info,
            out int commentWrapLength)
        {
            commentWrapLength = -1;

            if (info == null || (!info.CommentOnly && !options.CodeWrapEnabled))
            {
                return false;
            }

            // For now, we're only supporting single-line comments.
            if (info.Style != CommentStyle.SingleLine)
            {
                return false;
            }

            // If we just typed whitespace at the *end* of the line, don't do
            // any wrapping yet.  (It will cause us to trim the trailing space,
            // which would makeeverythingruntogetherlikethis!  It also makes
            // newline handling weird.)
            if ((change.Delta > 0) &&
                ((change.NewSpan.End >= line.End) && (change.NewSpan.End <= line.EndIncludingLineBreak)) &&
                change.NewText.All(c => Whitespace.Contains(c)))
            {
                return false;
            }

            commentWrapLength = options.AutoWrapColumn - info.ContentColumnStart;

            // There's some minimum length after which wrapping becomes
            // pointless...
            if (commentWrapLength < options.MinimumWrapWidth)
            {
                return false;
            }

            return true;
        }
        public TfsQueryShortcutStore(GeneralOptions options)
        {
            this.options = options;

            LoadShortcutsFromStorage();
        }