private async System.Threading.Tasks.Task OnVisibleRangesSubjectHandlerAsync(Uri uri, IWpfTextView wpfTextView) { try { if (wpfTextView.InLayout || wpfTextView.IsClosed || SessionService.WebViewDidInitialize != true) { return; } _ = CodeStreamService.BrowserService?.NotifyAsync( new HostDidChangeEditorVisibleRangesNotificationType { Params = new HostDidChangeEditorVisibleRangesNotification( uri, EditorService.GetEditorState(wpfTextView)?.ToEditorSelectionsSafe(), wpfTextView.ToVisibleRangesSafe(), wpfTextView.TextSnapshot?.LineCount ) }); } catch (InvalidOperationException ex) { Log.Warning(ex, nameof(OnVisibleRangesSubjectHandlerAsync)); } catch (Exception ex) { Log.Error(ex, nameof(OnVisibleRangesSubjectHandlerAsync)); } await System.Threading.Tasks.Task.CompletedTask; }
public override void Initialize(EditorService service) { base.Initialize(service); pe = new PropertyEditor(); EditorService.Instance.QueryModule<FormViewModule>().RegisterView(pe, "PropertyTab"); }
private void ChangeActiveEditor(IWpfTextView wpfTextView) { try { if (wpfTextView == null || !SessionService.IsWebViewVisible) { return; } if (!wpfTextView.Properties.TryGetProperty(PropertyNames.TextViewFilePath, out string filePath)) { return; } if (filePath.IsNullOrWhiteSpace()) { return; } var activeTextEditor = EditorService.GetActiveTextEditor(TextDocumentFactoryService, wpfTextView); if (activeTextEditor != null && activeTextEditor.Uri != null) { if (Uri.TryCreate(filePath, UriKind.RelativeOrAbsolute, out Uri result)) { if (activeTextEditor.Uri.EqualsIgnoreCase(result)) { _ = CodeStreamService.ChangeActiveEditorAsync(new Uri(filePath), activeTextEditor); SetZoomLevel(wpfTextView.ZoomLevel); } } } } catch (Exception ex) { Log.Warning(ex, nameof(ChangeActiveEditor)); } }
static void Main(string[] args) { EditorService.RegisterAssembly(Assembly.Load("SquadsCore")); Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); }
public override void Initialize(EditorService service) { base.Initialize(service); MenuModule menuModule = EditorService.Instance.QueryModule<MenuModule>(); Menu.MenuItem catalog = new Menu.MenuItem(); catalog.Name = "资源"; catalog.Index = 3; menuModule.AddMenuItem("", catalog); Menu.MenuItem item1 = new Menu.MenuItem(); item1.Name = "图片"; item1.Index = 0; item1.Command = menuCommand_Image; menuModule.AddMenuItem("资源", item1); Menu.MenuItem item2 = new Menu.MenuItem(); item2.Name = "声音"; item2.Index = 1; item2.Command = menuCommand_Sound; menuModule.AddMenuItem("资源", item2); Menu.MenuItem item3 = new Menu.MenuItem(); item3.Name = "自动编译资源"; item3.Index = 0; item3.StateChanged = menuState_ResAutoCompile; menuModule.AddMenuItem("资源", item3); }
/// <summary> /// Handles the Click event of the buttonExpando control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void buttonExpando_Click(object sender, EventArgs e) { ColorPickerDialog picker = null; try { picker = new ColorPickerDialog { OldColor = CurrentColor }; if (picker.ShowDialog() == DialogResult.OK) { CurrentColor = picker.SelectedColor; } EditorService.CloseDropDown(); } catch (Exception ex) { GorgonDialogs.ErrorBox(null, ex); } finally { if (picker != null) { picker.Dispose(); } } }
private void AddDesigner(string fileName = null) { ////Wait till create Intellisense List //while (creating) //{ // System.Threading.Thread.Sleep(1); //} //Create an instance of WorkflowDesigner class. this.wd = new WorkflowDesigner(); DesignerConfigurationService configurationService = wd.Context.Services.GetService <DesignerConfigurationService>(); configurationService.TargetFrameworkName = new FrameworkName(".NETFramework", new System.Version(4, 5)); configurationService.LoadingFromUntrustedSourceEnabled = true; #region Intellisense var expEditor = new EditorService() { IntellisenseData = _inttelisenseList, EditorKeyWord = this.CreateKeywords() }; wd.Context.Services.Publish <IExpressionEditorService>(expEditor); #endregion wd.Context.Items.Subscribe <Selection>(SelectionChanged); //Place the designer canvas in the middle column of the grid. Grid.SetColumn(this.wd.View, 1); if (fileName == null) { var activityBuilder = new ActivityBuilder(); wd.Load(activityBuilder); //Load a new Sequence as default. activityBuilder.Implementation = new Sequence(); } else { this.wd.Load(fileName); } //// view options //var designerView = wd.Context.Services.GetService<DesignerView>(); //designerView.WorkflowShellBarItemVisibility = // ShellBarItemVisibility.Imports | // ShellBarItemVisibility.MiniMap | // ShellBarItemVisibility.Variables | // ShellBarItemVisibility.Arguments | // <-- Uncomment to show again // ShellBarItemVisibility.Zoom; DesignerBorder.Child = wd.View; PropertyBorder.Child = wd.PropertyInspectorView; }
public Response <ViewDefinition> GetView(int id) { return(GetResponse(() => { var viewDef = new EditorService(User).GetView(id); return viewDef; })); }
private void SelectButton_Click(object sender, EventArgs e) { _value = (string)PropertiesList.SelectedItem; if (EditorService != null) { EditorService.CloseDropDown(); } }
public MainWindowVm() { _dataService = new DataService(); _refreshingService = new RefreshingService(this); _editorService = new EditorService(_dataService, _refreshingService); _summaryService = new SummaryService(); RefreshCommand.Execute(null); }
public ColorPicker(Color c) { _TextDisplayed = true; _CheckBox = new CheckBox {Appearance = Appearance.Button, Dock = DockStyle.Fill, TextAlign = ContentAlignment.MiddleCenter}; SetColor(c); Controls.Add(_CheckBox); _EditorService = new EditorService(this); }
public override void Initialize(EditorService service) { base.Initialize(service); bar = new StatusBar(); EditorService.Instance.QueryModule<FormViewModule>().RegisterView(bar, "Status"); Application.Idle += delegate { Idle(); }; }
public async Task Leave_Not_Existed_Project_Should_Returns_False_And_Null() { var projectService = new ProjectService(); var esitorService = new EditorService(projectService, null, null, null); var(joinedTo, project) = await esitorService.Leave("test", new ClaimsPrincipal()); joinedTo.Should().BeFalse(); project.Should().BeNull(); }
private void Setup() { VisualStudioServices.ServiceProvider = this; VisualStudioServices.OLEServiceProvider = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)VisualStudioServices.ServiceProvider.GetService(typeof(Microsoft.VisualStudio.OLE.Interop.IServiceProvider)); VisualStudioServices.ComponentModel = (IComponentModel)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SComponentModel)); EditorService.Create(VisualStudioServices.ServiceProvider, VisualStudioServices.OLEServiceProvider); ProjectSelectionService.Create(); }
public ColorPicker(Color c) { _TextDisplayed = true; _CheckBox = new CheckBox { Appearance = Appearance.Button, Dock = DockStyle.Fill, TextAlign = ContentAlignment.MiddleCenter }; SetColor(c); Controls.Add(_CheckBox); _EditorService = new EditorService(this); }
private void SelectButton_Click(object sender, EventArgs e) { if (PathTree.SelectedNode != null) { _value = PathTree.SelectedNode.FullPath; if (EditorService != null) { EditorService.CloseDropDown(); } } }
public override void Initialize(EditorService service) { base.Initialize(service); menuCtrl = new MenuControl(); menuCtrl.menuStrip1.Items.Clear(); EditorService.Instance.QueryModule<FormViewModule>().RegisterView(menuCtrl, "Menu"); // base.MenuTreeChanged += onMenuTreeChanged; MenuData.Tag = menuCtrl.menuStrip1.Items; }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static async Task InitializeAsync(AsyncPackage package) { // Switch to the main thread - the call to AddCommand in PeekSpSpanCommand's constructor requires // the UI thread. await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new PeekSpContextCommand(package, commandService); VsShellSettingsService.Initialise(package); NotificationService.Initialise(package); EditorService.Initialise(package); }
public ActionResult New(Models.Create createModel) { EditorService.PopulateCreateModelLists(createModel); if (ModelState.IsValid) { int newId = EditorService.CreateNewGame(createModel.SelectedType, createModel.SelectedTemplate, createModel.GameName); return(View("CreateSuccess", new Models.CreateSuccess { Id = newId, Name = createModel.GameName })); } else { return(View(createModel)); } }
protected override void Initialize() { base.Initialize(); EditorService = EditorService.Instance; StageEditModule = EditorService.QueryModule<StageEditModule>(); Presenter = new StageEditControlPresenter(); Presenter.RefGridSetting = new RefGridSetting(); // NOTE 标明该控件需要实时刷新 (并不是所有的XNAControl都要实时刷新) Application.Idle += delegate { Invalidate(); }; }
public PropInPlaceColorChooser(bool editable) { if (editable) { _edit = new PropInPlaceTextbox(false); _edit.Parent = this; _edit.Text = Text; _edit.TabStop = false; } _editorService = new EditorService(this); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque | ControlStyles.ResizeRedraw, true); Cursor = Cursors.Arrow; }
private async System.Threading.Tasks.Task OnTextSelectionChangedSubjectHandlerAsync(TextSelectionChangedSubject subject) { try { Debug.WriteLine($"{nameof(OnTextSelectionChangedSubjectHandlerAsync)} {subject.TextSelection.ToPositionString()}"); var wpfTextView = subject.WpfTextView; var activeEditorState = EditorService?.GetEditorState(wpfTextView); _ = CodeStreamService.EditorSelectionChangedNotificationAsync( wpfTextView.Properties.GetProperty <string>(PropertyNames.TextViewFilePath).ToUri(), activeEditorState, wpfTextView.ToVisibleRangesSafe(), wpfTextView?.TextSnapshot?.LineCount, CodemarkType.Comment, CancellationToken.None); } catch (Exception ex) { Log.Warning(ex, nameof(OnTextSelectionChangedSubjectHandlerAsync)); } }
public IActionResult Index(ArticleViewModel model) { ArticleService articleService = new ArticleService(); var inserted = articleService.Insert(new Article { Title = model.ArticleTitle, Content = model.ArticleContent }); EditorService editorService = new EditorService(); editorService.Insert(new Editor { }); return(Json(inserted)); }
public override void Initialize(EditorService service) { base.Initialize(service); ctrl = new ToolBox(); EditorService.Instance.QueryModule<FormViewModule>().RegisterView(ctrl, "Tools"); base.ToolListChanged += ctrl.toolBoxControl1.OnToolListChanged; MenuModule menu = EditorService.Instance.QueryModule<MenuModule>(); MenuItem mItem = new MenuItem(); mItem.Name = "工具配置"; mItem.Index = 0; menu.AddMenuItem("", mItem); StatusBarModule sbm = EditorService.Instance.QueryModule<StatusBarModule>(); sbm.AddIndicator("当前工具"); sbm.SetIndicator("当前工具", "当前工具:无"); }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void Execute(object sender, EventArgs e) { //TODO: Check if the extension is configured first. //If not, show an info bar with "Configure DB Strings" //Otherwise, carry on as usual. if (!VsShellSettingsService.ReadSetting <bool>("IsExtensionConfigured")) { InfoBarService.Instance.ShowInfoBar ( "Hi! Looks like DbPeek is initialised for the first time. Configure now?", new InfoBarHyperlink("Configure", HyperlinkCommands.Configure), new InfoBarHyperlink("Later", HyperlinkCommands.Later) ); return; } //if everything's alright, capture the selected text. var capturedText = EditorService.GetSelection(); if (!string.IsNullOrWhiteSpace(capturedText)) { try { var result = ThreadHelper.JoinableTaskFactory.Run(async delegate { return(await SpUtilsService.Instance.GetStoredProcedureAsync(capturedText)); }); var dumpFile = FileService.CreateFileWithContents(result); VsShellUtilities.OpenDocument((IServiceProvider)ServiceProvider, @dumpFile); } catch (Exception ex) { NotificationService.PopMessage("Something went wrong!", ex.Message); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { RegisterMetadata(); AddCustomActivityIcons(); AddNativeActivityIcons(); AddToolBox(); if (File.Exists(xamlFile)) { LoadDesignerAndWorkflow(xamlFile); } else { LoadDesignerAndWorkflow(); } StatusBarText.Text = "Loading Intellisense..."; StatusBarText.Foreground = new SolidColorBrush(Colors.Green); StatusBarText.FontSize += 3; intellisenseLoadingTask.GetAwaiter().OnCompleted(() => { EditorService editorService = new EditorService { IntellisenseData = intellisense.IntellisenseList, EditorKeyWord = intellisense.CreateKeywords(), }; wd.Context.Services.Publish <System.Activities.Presentation.View.IExpressionEditorService>(editorService); StatusBarText.Text = ""; StatusBarText.Foreground = new SolidColorBrush(Colors.Black); StatusBarText.FontSize -= 3; }); } catch (Exception ex) { MessageBox.Show(ex.Message + (ex.InnerException != null ? ex.InnerException.Message : string.Empty)); Application.Current.Shutdown(); } }
private void PopulateTypeTreeView() { Cursor cursorBackUp = Cursor; Cursor = Cursors.WaitCursor; List <Type> types; try { types = _typeFinder.GetTypes(IncludeGacCheckBox.Checked); } catch (Exception e) { MessageBox.Show(e.Message, "Error looking up the available types", MessageBoxButtons.OK, MessageBoxIcon.Error); Cursor = cursorBackUp; EditorService.CloseDropDown(); return; } _typeTreeViewController.PopulateTreeNodes(types, _value); Cursor = cursorBackUp; }
public static IServiceCollection AddSpeedWagonCms(this IServiceCollection services, string path, string uploadsPath, IFileProvider contentFileProvider, IFileProvider uploadFileProvider) { IContentService contentService = new CacheLessRuntimeContentService(path, null, contentFileProvider); IEditorService editorService = new EditorService(contentService, SPEEDWAGON_HOST); IContentTypeService contentTypeService = new ContentTypeService(contentService, SPEEDWAGON_HOST); IWebContentService webContentService = new WebContentService(contentService, SPEEDWAGON_HOST); IContentService uploadContentService = new CacheLessRuntimeContentService(uploadsPath, null, uploadFileProvider); IFileUploadService fileUploadService = new FileUploadService(uploadContentService, string.Empty, uploadFileProvider); ISearchService searchService = new LuceneSearchService(contentService, Path.Combine(path, "search")); services.AddSingleton <ISpeedWagonAdminContext>(s => new SpeedWagonAdminContext( path, contentService, contentTypeService, editorService, webContentService, fileUploadService, searchService) ); return(services); }
private void WhenDisposeResource() { EditorService.Destroy(); ProjectSelectionService.Destroy(); }
public override void Initialize(EditorService service) { base.Initialize(service); projectCtrl = new ProjectControl(); MenuBuilder = new ProjectItemContextMenuBuilder(); MenuBuilder.Menu = projectCtrl.contextMenuStrip1; EditorService.Instance.QueryModule<FormViewModule>(null).RegisterView(projectCtrl, "ProjectTab"); MenuModule menuModule = EditorService.Instance.QueryModule<MenuModule>(); MenuItem fileItem = new MenuItem(); fileItem.Name = "文件"; fileItem.Index = 0; menuModule.AddMenuItem("", fileItem); MenuItem item = new MenuItem(); item.Name = "新建"; item.Index = 0; item.Command = menuCommand_New; menuModule.AddMenuItem("文件", item); item = new MenuItem(); item.Name = "打开"; item.Index = 1; item.Command = menuCommand_Open; menuModule.AddMenuItem("文件", item); item = new MenuItem(); item.Name = "保存"; item.Index = 2; item.Command = menuCommand_Save; menuModule.AddMenuItem("文件", item); item = new MenuItem(); item.Name = "关闭"; item.Index = 3; item.Command = menuCommand_Close; menuModule.AddMenuItem("文件", item); item = new MenuItem(); item.Name = "新建场景"; item.Index = 0; item.Command = menuCommand_NewStage; menuModule.AddMenuItem("文件", item); item = new MenuItem(); item.Name = "保存场景"; item.Index = 0; item.Command = menuCommand_SaveStage; menuModule.AddMenuItem("文件", item); item = new MenuItem(); item.Name = "退出"; item.Index = 4; item.Command = menuCommandQuit; menuModule.AddMenuItem("文件", item); fileItem = new Lofinil.GameSDK.Editor.Module.Menu.MenuItem(); fileItem.Name = "项目"; fileItem.Index = 1; menuModule.AddMenuItem("", fileItem); item = new MenuItem(); item.Name = "项目配置"; item.Index = 0; item.Command = menuCommand_ProjConf; menuModule.AddMenuItem("项目", item); item = new MenuItem(); item.Name = "管线预设配置"; item.Index = 1; item.Command = menuCommand_PipelineConf; menuModule.AddMenuItem("项目", item); StatusBarModule statusModule = EditorService.Instance.QueryModule<StatusBarModule>(); statusModule.AddIndicator("项目状态"); statusModule.SetIndicator("项目状态", "项目状态:未加载"); }
public DisplayableSalary(Salary entity, EditorService editor) : base(entity, editor) { }
public override void Initialize(EditorService service) { base.Initialize(service); EditorService.Instance.QueryModule<FormViewModule>().RegisterView(WaitForm.Instance, true); }
private void SelectButton_Click(object sender, EventArgs e) { _value = _typeTreeViewController.GetSelectedType(); EditorService.CloseDropDown(); }
public DisplayableSite(Site entity, EditorService editor) : base(entity, editor) { }
public override void Initialize(EditorService service) { base.Initialize(service); EditorService.Instance.QueryModule<ProjectModule>(null).ProjectLoaded += OnProjectLoaded; EditorService.Instance.QueryModule<ProjectModule>().ProjectSaved += OnProjectSaved; }
public DisplayableEntityVm(T entity, EditorService editor) { Entity = entity; _editor = editor; }
public ActionResult New() { return(View(EditorService.GetCreateModel(TemplateFolder))); }
public override void Initialize(EditorService service) { base.Initialize(service); MenuData = new MenuItem(); }
public DisplayableProject(Project entity, EditorService editor) : base(entity, editor) { }
public ActionResult New() { return(View(EditorService.GetCreateModel())); }
/// <summary> /// Initializes a new instance of the <see cref="GenericValueEditor"/> class using /// the specified type. /// </summary> /// <param name="editedType">The <see cref="Type"/> of object that can be edited by this control.</param> public GenericValueEditor(Type editedType) { SetStyle(ControlStyles.Selectable, true); SetStyle(ControlStyles.FixedHeight, true); autoSize = true; SuspendLayout(); // Text box Control textBox = new TextBox(); InitTextBox(); // editor button editorButton = new EditorButton(); editorButton.Click += new EventHandler(ButtonClicked); // Paint value box previewControl = new PreviewControl(this); previewControl.Click += new EventHandler(PreviewControlClicked); // Add the sub-controls Controls.AddRange(new Control[] {previewControl, textBox, editorButton}); editorService = new EditorService(this); EditedType = editedType; ResumeLayout(); }
public PropInPlaceUITypeEditor(UITypeEditor _editor, bool editable) { this._editor = _editor; if (editable) { _edit = new PropInPlaceTextbox(false); _edit.Parent = this; _edit.Text = Text; _edit.TabStop = false; } _editorService = new EditorService(this); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | Utilities.DoubleBufferStyle | ControlStyles.Opaque | ControlStyles.ResizeRedraw, true); Cursor = Cursors.Arrow; }
public DisplayableEmployee(Employee entity, EditorService editor) : base(entity, editor) { }
public PropInPlaceColorChooser(bool editable) { if (editable) { _edit = new PropInPlaceTextbox(false); _edit.Parent = this; _edit.Text = Text; _edit.TabStop = false; } _editorService = new EditorService(this); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque | ControlStyles.ResizeRedraw, true); Cursor = Cursors.Arrow; }