/// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            try
            {
                NLogService.Setup($"{nameof(VSMonoDebuggerPackage)}.log");
                UserSettingsManager.Initialize(this);

                DebugEngineInstallService.TryRegisterAssembly();

                VSMonoDebuggerCommands.Initialize(this);
            }
            catch (UnauthorizedAccessException uex)
            {
                VsShellUtilities.ShowMessageBox(
                    this,
                    "Failed finish installation of VSMonoDebugger - Please run Visual Studio once as Administrator...",
                    $"{nameof(VSMonoDebuggerPackage)} - Register mono debug engine",
                    OLEMSGICON.OLEMSGICON_CRITICAL,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);

                NLogService.Logger.Error(uex);
            }
            catch (Exception ex)
            {
                NLogService.Logger.Error(ex);
            }
        }
Esempio n. 2
0
        protected override void OnInitializeControls(EventArgs e)
        {
            SessionStateData = Session[FLOW_PAGE_SESSION_STATE_KEY] as SessionStateDataStorage;
            if (SessionStateData == null)
            {
                SessionStateData = new SessionStateDataStorage();
                Session[FLOW_PAGE_SESSION_STATE_KEY] = SessionStateData;

                SessionStateData.HiddenFlows = UserSettingsManager.LoadAdminFlowPageHiddenFlowIds(GetCurrentUsername());

                if (SessionStateData.HiddenFlows == null)
                {
                    SessionStateData.HiddenFlows = new CaseInsensitiveList();
                }
            }

            base.OnInitializeControls(e);

            addExchangeBtn.Visible = UserIsAdmin();

            if (!IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                BindFlows();
            }
        }
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            try
            {
                NLogService.Setup($"{nameof(VSMonoDebuggerPackage)}.log");
                DebugEngineInstallService.TryRegisterAssembly();

                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                UserSettingsManager.Initialize(this);
                VSMonoDebuggerCommands.Initialize(this);
            }
            catch (UnauthorizedAccessException uex)
            {
                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                var package = this as Package;
                VsShellUtilities.ShowMessageBox(
                    package,
                    "Failed finish installation of VSMonoDebugger - Please run Visual Studio once as Administrator...",
                    $"{nameof(VSMonoDebuggerPackage)} - Register mono debug engine",
                    OLEMSGICON.OLEMSGICON_CRITICAL,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);

                NLogService.Logger.Error(uex);
            }
            catch (Exception ex)
            {
                NLogService.Logger.Error(ex);
            }

            await base.InitializeAsync(cancellationToken, progress);
        }
Esempio n. 4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            UserSettingsManager <XMLToJSONUserSettings> settingsManager = new UserSettingsManager <XMLToJSONUserSettings>(SettingsFileName);

            XMLToJSONUserSettings settings = settingsManager.LoadSettings();

            FilePath.Text = settings?.FilePath;
            Endpoint.Text = settings?.Endpoint;
        }
Esempio n. 5
0
        private frmUserSettingsNode()
        {
            this._model               = null;
            this._node                = null;
            this._nodeDefinition      = null;
            this._template            = null;
            this._userSettingsManager = null;

            InitializeComponent();
        }
Esempio n. 6
0
 public ExplorerController(Explorer explorer, SignInManager <IdentityUser> signInManager,
                           UserManager <IdentityUser> userManager, UserSettingsManager userSettingsManager,
                           IHostingEnvironment env)
 {
     _explorer            = explorer;
     _signInManager       = signInManager;
     _userManager         = userManager;
     _userSettingsManager = userSettingsManager;
     _env = env;
 }
Esempio n. 7
0
        private void SaveSettingsClicked(object sender, RoutedEventArgs e)
        {
            UserSettingsManager <XMLToJSONUserSettings> settingsManager = new UserSettingsManager <XMLToJSONUserSettings>(SettingsFileName);
            XMLToJSONUserSettings settings = new XMLToJSONUserSettings()
            {
                FilePath = FilePath.Text,
                Endpoint = Endpoint.Text
            };

            settingsManager.SaveSettings(settings);
        }
Esempio n. 8
0
        protected void CollapseAllLinkButton_Click(object sender, EventArgs e)
        {
            IList <DataFlow> flows = FlowService.GetFlows(VisitHelper.GetVisit(), true);

            SessionStateData.HiddenFlows.Clear();
            CollectionUtils.ForEach(flows, delegate(DataFlow dataFlow)
            {
                SessionStateData.HiddenFlows.Add(dataFlow.Id);
            });
            UserSettingsManager.SaveAdminFlowPageHiddenFlowIds(GetCurrentUsername(), SessionStateData.HiddenFlows);
            NeedsRebind = true;
        }
Esempio n. 9
0
        protected void CollapseAllLinkButton_Click(object sender, EventArgs e)
        {
            IDictionary <string, string> flows = DataItemService.GetExchangeList(VisitHelper.GetVisit(), false);

            SessionStateData.HiddenSchedules.Clear();
            CollectionUtils.ForEach(flows, delegate(KeyValuePair <string, string> pair)
            {
                SessionStateData.HiddenSchedules.Add(pair.Key);
            });
            UserSettingsManager.SaveAdminSchedulePageHiddenScheduleIds(GetCurrentUsername(), SessionStateData.HiddenSchedules);
            NeedsRebind = true;
        }
Esempio n. 10
0
 public RegisterModel(
     UserManager <IdentityUser> userManager,
     SignInManager <IdentityUser> signInManager,
     ILogger <RegisterModel> logger,
     IEmailSender emailSender,
     UserSettingsManager userSettingsManager)
 {
     _userManager         = userManager;
     _signInManager       = signInManager;
     _logger              = logger;
     _emailSender         = emailSender;
     _userSettingsManager = userSettingsManager;
 }
Esempio n. 11
0
        public void Save_and_Load_work()
        {
            var manager = new UserSettingsManager();

            var settings = manager.LoadIfExists() ?? manager.MigrateOrDefault();

            var b = (byte)(new Random().NextDouble() * 255);

            settings.WhitebalanceBlue = b;
            // Save should happen automatically!

            var settings2 = manager.LoadIfExists();

            Assert.AreEqual(b, settings.WhitebalanceBlue, "settings.WhitebalanceBlue");
        }
        public void Save_and_Load_work()
        {
            var manager = new UserSettingsManager();

            var settings = manager.LoadIfExists() ?? manager.MigrateOrDefault();

            var testDate = DateTime.UtcNow;

            settings.LastUpdateCheck = testDate;
            //save should happen automatically!

            var settings2 = manager.LoadIfExists();

            Assert.AreEqual(testDate, settings.LastUpdateCheck, "settings.LastUpdateCheck");
        }
Esempio n. 13
0
 protected virtual bool SetFlowExpanded(string flowId, bool isExpanded)
 {
     if (!isExpanded)
     {
         if (!SessionStateData.HiddenFlows.Contains(flowId))
         {
             SessionStateData.HiddenFlows.Add(flowId);
         }
     }
     else
     {
         SessionStateData.HiddenFlows.Remove(flowId);
     }
     UserSettingsManager.SaveAdminFlowPageHiddenFlowIds(GetCurrentUsername(), SessionStateData.HiddenFlows);
     return(isExpanded);
 }
Esempio n. 14
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            try
            {
                NLogService.Setup($"{nameof(VSMonoDebuggerPackage)}.log");
                DebugEngineInstallService.TryRegisterAssembly();

                // see https://github.com/microsoft/VSSDK-Extensibility-Samples/tree/master/AsyncPackageMigration
                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                var dte = await GetServiceAsync(typeof(EnvDTE.DTE)) as EnvDTE.DTE;

                var menuCommandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

                // TODO replace by services
                UserSettingsManager.Initialize(this);
                _monoVisualStudioExtension = new MonoVisualStudioExtension(this, dte);
                _monoDebuggerCommands      = new VSMonoDebuggerCommands(this, menuCommandService, _monoVisualStudioExtension);

                await AttachToEngineCommand.InitializeAsync(this, menuCommandService, _monoVisualStudioExtension);
            }
            catch (UnauthorizedAccessException uex)
            {
                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                var package = this as Package;
                VsShellUtilities.ShowMessageBox(
                    package,
                    "Failed finish installation of VSMonoDebugger - Please run Visual Studio once as Administrator...",
                    $"{nameof(VSMonoDebuggerPackage)} - Register mono debug engine",
                    OLEMSGICON.OLEMSGICON_CRITICAL,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);

                Logger.Error(uex);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            await base.InitializeAsync(cancellationToken, progress);
        }
Esempio n. 15
0
        public static void Main(string[] args)
        {
            if (Debugger.IsAttached)
            {
                var host = new WebHostBuilder()
                           .UseKestrel()
                           .UseContentRoot(Directory.GetCurrentDirectory())
                           .UseIISIntegration()
                           .UseStartup <Startup>()
                           .Build();

                host.Run();
            }
            else
            {
                IConfigurationRoot configuration = new UserSettingsManager().BuildConfiguration(args);

                ConfigureHost(configuration);
            }
        }
Esempio n. 16
0
        public frmUserSettingsNode(MsSqlAuditorModel model, TreeNode node) : this()
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            this._node           = node;
            this._nodeDefinition = node.Tag as ConcreteTemplateNodeDefinition;

            if (this._nodeDefinition == null)
            {
                throw new ArgumentException("Template is not specified for the node.");
            }

            this._model               = model;
            this._template            = GetUserSettings();
            this._userSettingsManager = new UserSettingsManager(
                this._model.Settings.InterfaceLanguage
                );
        }
Esempio n. 17
0
        public static async Task <int> GetUserSelectedProjectIdAsync(this UserSettingsManager userSettingsManager, TdDomainContext context)
        {
            //TODO: We have to take the source context as a param because we have sync callers (child action in navigation).
            //      Trying to use dependency resolver with a sync caller results in the context being invoked without a security provider.
            //      The entire concept of child actions are heavily refactored in MVC 6, so this should not be an issue in future versions.

            var projects = context.Projects;
            var settings = await userSettingsManager.GetSettingsForUserAsync(context.SecurityProvider.CurrentUserId);

            var projectId = settings.SelectedProjectId ?? 0;

            //if user's selected project points to a project that no longer exists, reset
            //  normally this wouldn't happen since the dbcontext will update user settings when projects are deleted
            if (projectId != 0 && projects.All(p => p.ProjectId != projectId))
            {
                projectId = 0;
                await UpdateUserSelectedProjectAsync(userSettingsManager, projectId, context.SecurityProvider.CurrentUserId);

                context.SaveChanges();
            }
            return(projectId);
        }
Esempio n. 18
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            var settingsManager            = new ShellSettingsManager(this);
            var configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            UserSettingsManager.Initialize(configurationSettingsStore);
            MonoLogger.Setup();
            base.Initialize();
            var dte = await GetServiceAsync(typeof(DTE)) as DTE;

            monoExtension = new MonoVisualStudioExtension(dte);
            TryRegisterAssembly();


            Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("/MonoRemoteDebugger.VSExtension;component/Resources/Resources.xaml", UriKind.Relative)
            });

            var mcs = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            InstallMenu(mcs);
        }
        protected override void Initialize()
        {
            var settingsManager            = new ShellSettingsManager(this);
            var configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            UserSettingsManager.Initialize(configurationSettingsStore);
            MonoLogger.Setup();
            base.Initialize();
            var dte = (DTE)GetService(typeof(DTE));

            monoExtension = new MonoVisualStudioExtension(dte);
            TryRegisterAssembly();


            Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("/MonoDebugger.VS2015;component/Resources/Resources.xaml", UriKind.Relative)
            });

            var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            InstallMenu(mcs);
        }
        protected override void Initialize()
        {
            UserSettingsManager.Initialize(this);

            MonoLogger.Setup();

            base.Initialize();

            var dte = (DTE)GetService(typeof(DTE));

            _monoExtension = new MonoVisualStudioExtension(dte);

            TryRegisterAssembly();

            Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("/MonoRemoteDebugger.VSExtension;component/Resources/Resources.xaml", UriKind.Relative)
            });

            InstallMenu();

            // Workaround: Don't show Visual Studio WPF DataBinding errors in Output window
            System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical;
        }
Esempio n. 21
0
        public void Migration_works()
        {
            var manager = new UserSettingsManager();

            var settings = manager.MigrateOrDefault();
        }
Esempio n. 22
0
        public static async Task UpdateUserSelectedProjectAsync(this UserSettingsManager userSettingsManager, int projectId, string userId)
        {
            var settings = await userSettingsManager.GetSettingsForUserAsync(userId);

            settings.SelectedProjectId = projectId;
        }
Esempio n. 23
0
 protected void ExpandAllLinkButton_Click(object sender, EventArgs e)
 {
     SessionStateData.HiddenSchedules.Clear();
     UserSettingsManager.SaveAdminSchedulePageHiddenScheduleIds(GetCurrentUsername(), SessionStateData.HiddenSchedules);
     NeedsRebind = true;
 }