public MethodLocator(string assemblyPath, string language, IShell shell) { this.assemblyPath = assemblyPath; this.methodsInType = new Dictionary<Type,List<MethodInfo>>(); this.shell = shell; this.languageUtil = shell.GetLanguageUtil(language); }
public SettingsViewModel(IShell shell, ISettingsService settingsService, ICacheService cacheService, IBoard board, INewsService newsService) { Shell = shell; Board = board; SettingsService = settingsService; CacheService = cacheService; AvailableLanguages = new ObservableCollection<CultureInfo>( new[] { "en-US", "ru" }.Select(l => new CultureInfo(l))); CurrentLanguage = CultureInfo.CurrentUICulture; currentLanguageIndex = AvailableLanguages.IndexOf(CurrentLanguage); Application.Current.Suspending += ApplyLanguage; FontScale = SettingsService.FontScale; AvailableThemes = new ObservableCollection<Theme>(Utils.GetEnumValues<Theme>()); CurrentThemeIndex = AvailableThemes.IndexOf(SettingsService.CurrentTheme); AvailableRepliesDisplayModes = new ObservableCollection<RepliesDisplayMode>(Utils.GetEnumValues<RepliesDisplayMode>()); Version = CreateVersion(); IsRedstoneBuild = Utils.IsRedstone(); SetupMediaDownloadFolder(); AvailableDomains = new ObservableCollection<string>(board.UrlService.AvailableDomains); CurrentDomainIndex = SettingsService.CurrentDomain == "" ? 0 : AvailableDomains.IndexOf(SettingsService.CurrentDomain); NewsService = newsService; }
public static MenuItem ToMenuItem(this IMenuRegister menuRegister, IShell shell) { var menuItem = new MenuItem { Header = menuRegister.Name, FontWeight = menuRegister.FontWeight, Tag = new MenuTag(menuRegister.Name, menuRegister.Group), Command = menuRegister.Command, CommandParameter = menuRegister.CommandParameter, IsCheckable = menuRegister.Checkable, Icon = menuRegister.Icon, FlowDirection = menuRegister.FlowDirection }; if (menuRegister.Gesture != null) { menuItem.InputGestureText = menuRegister.Gesture.GetDisplayStringForCulture(CultureInfo.CurrentCulture); shell.AddKeyBinding(menuItem.Command, menuRegister.Gesture); } INotifyPropertyChanged viewModel = null; if (menuRegister.ViewModelFactory != null) { viewModel = menuRegister.ViewModelFactory(); } if (menuRegister.ViewFactory != null) { var view = menuRegister.ViewFactory(viewModel); view.DataContext = viewModel; menuItem.Header = view; } if (menuRegister.Style != null) menuItem.SetResourceReference(FrameworkElement.StyleProperty, menuRegister.Style); return menuItem; }
public MsDeployPackage(ILog log, IShell shell, TemplateConfigurer config, IOutput output) { _log = log; _shell = shell; _config = config; _output = output; }
public Monitor(IShell shell, Configuration configuration) { this.shell = shell; this.configuration = configuration; this.breakpointMetadataList = new Dictionary<MDbgBreakpoint, BreakpointMetadata>(); this.parameterSerializer = new FuncEvalSerializer(shell.Debugger, configuration.appType != "web", shell); }
public PostsViewModel(IShell shell, IBoard board, string boardId, IList<PostViewModel> threadPosts, IEnumerable<PostViewModel> posts) { Posts = new ObservableCollection<PostViewModel>(posts.Select(CreatePostViewModel)); BoardId = boardId; Board = board; ThreadPosts = threadPosts; Shell = shell; }
public WorkspaceViewModel(CShell.Workspace workspace) { this.shell = shell; DisplayName = "Workspace Explorer"; this.workspace = workspace; this.workspace.PropertyChanged += WorkspaceOnPropertyChanged; }
/// <summary> /// Initializes the command manager. /// </summary> /// <param name="commandHandles">The command handles.</param> /// <param name="shell">The shell.</param> public DefaultCommandManager(ComponentHandle<ICommand, CommandTraits>[] commandHandles, IShell shell) { this.commandHandles = commandHandles; this.shell = (DefaultShell) shell; commandPresentations = new Dictionary<string, CommandPresentation>(); }
public SceneEditorViewModel(LanguageDefinitionManager languageDefinitionManager, IErrorList errorList, IShell shell) : base(languageDefinitionManager) { _errorList = errorList; _shell = shell; }
public LoginViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService, IShell shell, IDialogService dialogService, IBiometricsService biometricsService) { Guard.NotNull(cTimeService, nameof(cTimeService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(shell, nameof(shell)); Guard.NotNull(dialogService, nameof(dialogService)); Guard.NotNull(biometricsService, nameof(biometricsService)); this._cTimeService = cTimeService; this._applicationStateService = applicationStateService; this._shell = shell; this._dialogService = dialogService; this._biometricsService = biometricsService; var canLogin = this.WhenAnyValue(f => f.EmailAddress, f => f.Password, (email, password) => string.IsNullOrWhiteSpace(email) == false && string.IsNullOrWhiteSpace(password) == false); this.Login = UwCoreCommand.Create(canLogin, this.LoginImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.LoggingIn")) .HandleExceptions() .TrackEvent("Login"); var deviceAvailable = this._biometricsService.BiometricAuthDeviceIsAvailableAsync().ToObservable(); var userAvailable = this._biometricsService.HasUserForBiometricAuthAsync().ToObservable(); var canRememberedLogin = deviceAvailable .CombineLatest(userAvailable, (deviceAvail, userAvail) => deviceAvail && userAvail) .ObserveOnDispatcher(); this.RememberedLogin = UwCoreCommand.Create(canRememberedLogin, this.RememberedLoginImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.LoggingIn")) .HandleExceptions() .TrackEvent("LoginRemembered"); this.DisplayName = CTime2Resources.Get("Navigation.Login"); }
public RecentThreadsViewModel( RecentThreadsService repositoryService, IBoard board, IShell shell, FavoriteThreadsService favoriteThreads) : base(repositoryService, board, shell) { FavoriteThreads = favoriteThreads; var dialog = new MessageDialog( Localization.GetForView("RecentThreads", "ClearConfirmationContent"), Localization.GetForView("RecentThreads", "ClearConfirmationTitle")); dialog.AddButton( Localization.GetForView("RecentThreads", "ConfirmClear"), async () => { IsLoading = true; Threads.Clear(); RepositoryService.Items.Clear(); await RepositoryService.Save(); IsLoading = false; }); dialog.AddButton( Localization.GetForView("RecentThreads", "DontClear"), () => { }); ClearConfirmationDialog = dialog; }
public NavigationView(IShell shell) { InitializeComponent(); this.shell = shell; icon(ApplicationIcons.FileExplorer).docked_to(DockState.DockRightAutoHide); uxNavigationTreeView.ImageList = new ImageList(); ApplicationIcons.all().each(x => uxNavigationTreeView.ImageList.Images.Add(x.name_of_the_icon, x)); }
public CoreModule(IShell shell, IStateManager stateManager, IMainWindow mainWindow) { this.shell = shell; this.stateManager = stateManager; this.mainWindow = mainWindow; this.shell.AttemptingDeactivation += ShellDeactivating; }
public ExtendedPostingViewModel(IShell shell, IBoard board, PostInfo postInfo, ThreadLink threadLink) { PostInfo = postInfo; Shell = shell; Board = board; BoardId = threadLink.BoardId; Parent = threadLink.ThreadNumber; SetupProperties(); }
public PostsViewModel(IShell shell, IBoard board, string boardId, IList<PostViewModel> threadPosts, long postNumber) { Posts = new ObservableCollection<PostViewModel>(); Board = board; Shell = shell; BoardId = boardId; ThreadPosts = threadPosts; LoadPost(postNumber); }
public CSharpCompletion(IShell shell) { projectContent = new CSharpProjectContent(); Shell = shell; Shell.AssemblyReferenced += Shell_AssemblyReferenced; LoadAssemblies(Shell.LoadedAssemblyLocations.Concat(GetDefaultAssemblies())); }
public FavoritesViewModel(FavoriteThreadsService threadsRepositoryService, FavoritePostsService favoritePostsService, IBoard board, IShell shell) : base(threadsRepositoryService, board, shell) { FavoritePosts = favoritePostsService; Posts = new ObservableCollection<PostViewModel>(); }
public NewFileCommandHandler( ICommandService commandService, IShell shell, [ImportMany] IEditorProvider[] editorProviders) { _commandService = commandService; _shell = shell; _editorProviders = editorProviders; }
public StateManager(IShell shell, IFileSystem fileSystem) { this.shell = shell; this.fileSystem = fileSystem; applicationDirectory = fileSystem.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "GitWorkbench"); }
public ExtendedPostingViewModel(IShell shell, IBoard board, PostInfo postInfo, string boardId) { PostInfo = postInfo; Shell = shell; Board = board; BoardId = boardId; Parent = 0; IsNewThread = true; SetupProperties(); }
public NUnit(IShell shell, ILog log) { Shell = shell; Log = log; NUnitConsolePath = @"nunit-console.exe"; FrameworkVersion = Environment.Version.ToString(2); TeamCityPlatform = "MSIL"; TeamCityNUnitVersion = "NUnit-2.6.2"; }
private void RefreshToolboxItems(IShell shell) { _items.Clear(); if (shell.ActiveItem == null) return; _items.AddRange(_toolboxService.GetToolboxItems(shell.ActiveItem.GetType()) .Select(x => new ToolboxItemViewModel(x))); }
public void InitCompletion(IShell shell) { _completion = new CSharpCompletion(shell); Parallel.ForEach(_editors, (e) => { CodeTextEditor target; if(e.TryGetTarget(out target)) { target.Completion = _completion; } }); }
public ShellServicesModule( IUnityContainer container, IRegionManager regionManager, IShell shell, ResourceDictionary resourceDictionary) { _container = container; _regionManager = regionManager; _shell = shell; _resourceDictionary = resourceDictionary; }
public BoardViewModel(IShell shell, IBoard board, IAttachmentViewer attachmentViewer, FavoriteBoardsService favoriteBoardsService) { Shell = shell; Board = board; AttachmentViewer = attachmentViewer; FavoriteBoardsService = favoriteBoardsService; Threads = new ObservableCollection<BoardThreadViewModel>(); Pages = new BindableCollection<int>(); TryAgainAction = ChangePage; }
public SprintSelectorViewModel(Project project, Func<Project,Sprint,ProjectDetailsViewModel> projectDetailsFactory, ProjectRepository projectRepository, IShell shell) { _project = project; _projectDetailsFactory = projectDetailsFactory; _projectRepository = projectRepository; _shell = shell; _projectRepository.GetSprintsObservable(_project).ToProperty(this, t => t.AllSprints, out allSprints); }
public static string GetCurrentLocationInSource(MDbgEngine debugger, IShell shell) { if (!debugger.Processes.Active.Threads.HaveActive) { return ""; // we won't try to show current location } MDbgThread thr = debugger.Processes.Active.Threads.Active; MDbgSourcePosition pos = thr.CurrentSourcePosition; if (pos == null) { MDbgFrame f = thr.CurrentFrame; if (f.IsManaged) { CorDebugMappingResult mappingResult; uint ip; f.CorFrame.GetIP(out ip, out mappingResult); string s = "IP: " + ip + " @ " + f.Function.FullName + " - " + mappingResult; return s; } else { return "<Located in native code.>"; } } else { string fileLoc = shell.FileLocator.GetFileLocation(pos.Path); if (fileLoc == null) { // Using the full path makes debugging output inconsistant during automated test runs. // For testing purposes we'll get rid of them. //CommandBase.WriteOutput("located at line "+pos.Line + " in "+ pos.Path); return "located at line " + pos.Line + " in " + System.IO.Path.GetFileName(pos.Path); } else { IMDbgSourceFile file = shell.SourceFileMgr.GetSourceFile(fileLoc); string prefixStr = pos.Line.ToString(CultureInfo.InvariantCulture) + ":"; if (pos.Line < 1 || pos.Line > file.Count) { shell.WriteLine("located at line " + pos.Line + " in " + pos.Path); throw new Exception(string.Format("Could not display current location; file {0} doesn't have line {1}.", file.Path, pos.Line)); } Debug.Assert((pos.Line > 0) && (pos.Line <= file.Count)); return file[pos.Line]; } } }
public ProjectSelectorViewModel( ProjectRepository projectRepository, Func<Project,SprintSelectorViewModel> sprintSelectorFactory, IShell shell ) { _projectRepository = projectRepository; _sprintSelectorFactory = sprintSelectorFactory; _shell = shell; _projectRepository.GetAllObservable(). ToProperty(this, t => t.AllProjects, out _allProjects); }
/// <summary> /// Executes the current extension. /// </summary> /// <param name="shell">The <see cref="IShell" /> object on which the current extension will be executed.</param> protected async override void DoExecute(IShell shell) { if (shell.HasActiveDocument) { await SafeExecutionContext.ExecuteAsync((Form) shell.Owner, async () => { var blogSetting = this.SettingProvider.GetExtensionSetting<BlogSetting>(); if (string.IsNullOrEmpty(blogSetting.MetaWeblogAddress) || string.IsNullOrEmpty(blogSetting.UserName) || string.IsNullOrEmpty(blogSetting.Password)) { MessageBox.Show(Resources.MissingBlogConfigurationMsg, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var gateway = new BlogGateway(blogSetting.MetaWeblogAddress, blogSetting.UserName, blogSetting.Password); if (await gateway.TestConnectionAsync()) { var blogPublishDialog = new FrmBlogPublish(gateway); if (blogPublishDialog.ShowDialog() == DialogResult.OK) { var selectedCategories = blogPublishDialog.SelectedCategories.Select(s => s.Title).ToList(); var postInfo = new PostInfo { Categories = selectedCategories, DateCreated = DateTime.Now, Description = HtmlUtilities.Tidy(HtmlUtilities.ReplaceFileSystemImages(shell.Note.Content)), Title = shell.Note.Title }; await gateway.PublishBlog(postInfo, selectedCategories); shell.StatusText = Resources.PublishSucceeded; } } else { MessageBox.Show(Resources.BlogExtensionCannotConnectToBlogService, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }); } else { MessageBox.Show(Resources.NoActiveNoteOpened, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Start() { this.display.Resize(this.gameSettings.RowsSize, this.gameSettings.ColsSize); this.data.EnemyTanks.Add(environmentFactory.CreateEnemyTank(1, 1, Direction.Left)); this.data.EnemyTanks.Add(environmentFactory.CreateEnemyTank(2, 20, Direction.Down)); this.data.EnemyTanks.Add(environmentFactory.CreateEnemyTank(4, 28, Direction.Up)); this.data.EnemyTanks.Add(environmentFactory.CreateEnemyTank(4, 4, Direction.Right)); this.playerTank.Shots += new EventHandler(ShotCount); this.playerTank.OnShots(); //Enemy //if (!menu.Run()) //{ // return; //} this.display.Print(); //After Start while (this.gameSettings.IsPlayerAlive) { if (this.timer.ShellSpeed()) { for (int shell = this.data.Shells.Count - 1; shell >= 0; shell--) { if (this.data.Shells[shell].Map == null) { continue; } this.display.OldX = this.data.Shells[shell].RowPosition; this.display.OldY = this.data.Shells[shell].ColumnPosition; bool isMoved = this.data.Shells[shell].Move(); this.display.NewX = this.data.Shells[shell].RowPosition; this.display.NewY = this.data.Shells[shell].ColumnPosition; if (!isMoved) { this.data.Shells.Remove(this.data.Shells[shell]); } if (this.playerTank.Map == null) { this.gameSettings.IsPlayerAlive = false; return; } this.display.Update(); } //Shell Move Update if (this.timer.GameTimePassed()) { this.display.OldX = playerTank.RowPosition; this.display.OldY = playerTank.ColumnPosition; if (!this.keyboard.IsKeyUp(Key.Space) && this.timer.ShellCooldownPassed()) { var shell = this.playerTank.Shoot(); if (shell.Map != null) { this.display.NewX = shell.RowPosition; this.display.NewY = shell.ColumnPosition; this.display.Update(); this.data.Shells.Add(shell); } } //Shell Shoot Update else if (!this.keyboard.IsKeyUp(Key.Up)) { var info = this.playerTank.MoveUp(); this.display.NewX = this.playerTank.RowPosition; this.display.NewY = this.playerTank.ColumnPosition; this.display.Update(); } else if (!this.keyboard.IsKeyUp(Key.Down)) { var info = this.playerTank.MoveDown(); this.display.NewX = this.playerTank.RowPosition; this.display.NewY = this.playerTank.ColumnPosition; this.display.Update(); } else if (!this.keyboard.IsKeyUp(Key.Left)) { var info = this.playerTank.MoveLeft(); this.display.NewX = this.playerTank.RowPosition; this.display.NewY = this.playerTank.ColumnPosition; this.display.Update(); } else if (!this.keyboard.IsKeyUp(Key.Right)) { var info = this.playerTank.MoveRight(); this.display.NewX = this.playerTank.RowPosition; this.display.NewY = this.playerTank.ColumnPosition; this.display.Update(); } //Player Tank Update for (int tank = this.data.EnemyTanks.Count - 1; tank >= 0; tank--) { if (this.data.EnemyTanks[tank].Map != null) { this.display.OldX = this.data.EnemyTanks[tank].RowPosition; this.display.OldY = this.data.EnemyTanks[tank].ColumnPosition; IShell shell = this.data.EnemyTanks[tank].DetectPlayer(); if (shell != null) { this.data.Shells.Add(shell); } else if (this.data.EnemyTanks[tank].Move()) { this.display.NewX = this.data.EnemyTanks[tank].RowPosition; this.display.NewY = this.data.EnemyTanks[tank].ColumnPosition; this.display.Update(); } } else { this.display.Update(); this.data.EnemyTanks.RemoveAt(tank); } } if (this.data.EnemyTanks.Count == 0) { //menu.Victory(); return; } //Enemy Tanks Update if (this.map[this.playerTank.RowPosition, this.playerTank.ColumnPosition] is Road) { this.gameSettings.IsPlayerAlive = false; } } } } //menu.GameOver(); }
public static void ShowMessages(this IShell shell) { shell.ShowView <ManageMessagesView>(new ViewRequest("manage-messages"), new UiShowOptions { Title = "Messages" }); }
public override async Task <string> OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body) { if (args.Length == 0) { var descriptions = core.Commands.Select(GetDescription); return(string.Join("\n", descriptions)); } else { var name = args[0]; var cmd = core.TryGetCommand(name); if (cmd == default) { return($"コマンド {name} は見つかりませんでした."); } var sb = new StringBuilder(); sb.AppendLine(GetDescription(cmd)); sb.Append("使い方: "); sb.AppendLine(cmd.Usage); if (cmd.Aliases != null) { sb.AppendLine(string.Join(", ", cmd.Aliases)); } sb.AppendLine(DumpPermission(cmd.Permission)); return(sb.ToString()); } }
public EditParameterIdentificationView(IShell shell, IImageListRetriever imageListRetriever) : base(shell, imageListRetriever) { InitializeComponent(); }
private static MetroWindow GetWindow(this IShell shell) { return(shell.Container.Resolve <IDockWindow>() as MetroWindow); //return Application.Current.MainWindow as MetroWindow; }
public static void ShowUsers(this IShell shell) { shell.ShowView <ManageUsersView>(new ViewRequest("manage-users"), new UiShowOptions { Title = "Users" }); }
public ManageMessagesViewModel(IShell shell, IDomain0Service domain0, IMapper mapper) : base(shell, domain0, mapper) { }
internal override void ExecuteInternal(IShell shell, object parameter) { GoToSite("https://github.com/Christian-Nunnally/visual-drop/issues"); }
public ShaderViewPanelCommandHandler(IShell shell) { _shell = shell; }
public CodeEditor() { _codeAnalysisRunner = new JobRunner(1); _shell = IoC.Get <IShell>(); _snippetManager = IoC.Get <SnippetManager>(); _lineNumberMargin = new LineNumberMargin(this); _breakpointMargin = new BreakPointMargin(this, IoC.Get <IDebugManager2>().Breakpoints); _selectedLineBackgroundRenderer = new SelectedLineBackgroundRenderer(this); _selectedWordBackgroundRenderer = new SelectedWordBackgroundRenderer(); _columnLimitBackgroundRenderer = new ColumnLimitBackgroundRenderer(); _selectedDebugLineBackgroundRenderer = new SelectedDebugLineBackgroundRenderer(); TextArea.TextView.Margin = new Thickness(10, 0, 0, 0); TextArea.TextView.BackgroundRenderers.Add(_selectedDebugLineBackgroundRenderer); TextArea.TextView.LineTransformers.Add(_selectedDebugLineBackgroundRenderer); TextArea.SelectionBrush = Brush.Parse("#AA569CD6"); TextArea.SelectionCornerRadius = 0; this.GetObservable(LineNumbersVisibleProperty).Subscribe(s => { if (s) { TextArea.LeftMargins.Add(_lineNumberMargin); } else { TextArea.LeftMargins.Remove(_lineNumberMargin); } }); this.GetObservable(ShowBreakpointsProperty).Subscribe(s => { if (s) { TextArea.LeftMargins.Insert(0, _breakpointMargin); } else { TextArea.LeftMargins.Remove(_breakpointMargin); } }); this.GetObservable(HighlightSelectedWordProperty).Subscribe(s => { if (s) { TextArea.TextView.BackgroundRenderers.Add(_selectedWordBackgroundRenderer); } else { TextArea.TextView.BackgroundRenderers.Remove(_selectedWordBackgroundRenderer); } }); this.GetObservable(HighlightSelectedLineProperty).Subscribe(s => { if (s) { TextArea.TextView.BackgroundRenderers.Insert(0, _selectedLineBackgroundRenderer); } else { TextArea.TextView.BackgroundRenderers.Remove(_selectedLineBackgroundRenderer); } }); this.GetObservable(ShowColumnLimitProperty).Subscribe(s => { if (s) { TextArea.TextView.BackgroundRenderers.Add(_columnLimitBackgroundRenderer); } else { TextArea.TextView.BackgroundRenderers.Remove(_columnLimitBackgroundRenderer); } }); Options = new AvaloniaEdit.TextEditorOptions { ConvertTabsToSpaces = true, IndentationSize = 4 }; BackgroundRenderersProperty.Changed.Subscribe(s => { if (s.Sender == this) { if (s.OldValue != null) { foreach (var renderer in (ObservableCollection <IBackgroundRenderer>)s.OldValue) { TextArea.TextView.BackgroundRenderers.Remove(renderer); } } if (s.NewValue != null) { foreach (var renderer in (ObservableCollection <IBackgroundRenderer>)s.NewValue) { TextArea.TextView.BackgroundRenderers.Add(renderer); } } } }); DocumentLineTransformersProperty.Changed.Subscribe(s => { if (s.Sender == this) { if (s.OldValue != null) { foreach (var renderer in (ObservableCollection <IVisualLineTransformer>)s.OldValue) { TextArea.TextView.LineTransformers.Remove(renderer); } } if (s.NewValue != null) { foreach (var renderer in (ObservableCollection <IVisualLineTransformer>)s.NewValue) { TextArea.TextView.LineTransformers.Add(renderer); } } } }); this.GetObservable(CaretOffsetProperty).Subscribe(s => { if (Document?.TextLength > s) { CaretOffset = s; } }); /*_analysisTriggerEvents.Select(_ => Observable.Timer(TimeSpan.FromMilliseconds(300)).ObserveOn(AvaloniaScheduler.Instance) * .SelectMany(o => DoCodeAnalysisAsync())).Switch().Subscribe(_ => { });*/ _analysisTriggerEvents.Throttle(TimeSpan.FromMilliseconds(300)).ObserveOn(AvaloniaScheduler.Instance).Subscribe(async _ => { await DoCodeAnalysisAsync(); }); this.GetObservableWithHistory(SourceFileProperty).Subscribe((file) => { if (file.Item1 != file.Item2) { if (System.IO.File.Exists(file.Item2.Location)) { using (var fs = System.IO.File.OpenText(file.Item2.Location)) { Document = new TextDocument(fs.ReadToEnd()) { FileName = file.Item2.Location }; } } _isLoaded = true; RegisterLanguageService(file.Item2); TextArea.TextView.Redraw(); } }); TextArea.TextEntering += (sender, e) => { _textEntering = true; }; Observable.FromEventPattern(TextArea.Caret, nameof(TextArea.Caret.PositionChanged)).Throttle(TimeSpan.FromMilliseconds(100)).ObserveOn(AvaloniaScheduler.Instance).Subscribe(e => { if (_intellisenseManager != null && !_textEntering) { if (TextArea.Selection.IsEmpty) { var location = Document.GetLocation(CaretOffset); _intellisenseManager.SetCursor(CaretOffset, location.Line, location.Column, UnsavedFiles.ToList()); } else if (_currentSnippetContext != null) { var offset = Document.GetOffset(TextArea.Selection.StartPosition.Location); _intellisenseManager.SetCursor(offset, TextArea.Selection.StartPosition.Line, TextArea.Selection.StartPosition.Column, UnsavedFiles.ToList()); } } if (CaretOffset > 0) { var prevLocation = new TextViewPosition(Document.GetLocation(CaretOffset - 1)); var visualLocation = TextArea.TextView.GetVisualPosition(prevLocation, VisualYPosition.LineBottom); var visualLocationTop = TextArea.TextView.GetVisualPosition(prevLocation, VisualYPosition.LineTop); var position = visualLocation - TextArea.TextView.ScrollOffset; position = position.Transform(TextArea.TextView.TransformToVisual(TextArea).Value); _intellisenseControl.SetLocation(position); _completionAssistantControl.SetLocation(position); _selectedWordBackgroundRenderer.SelectedWord = GetWordAtOffset(CaretOffset); Line = TextArea.Caret.Line; Column = TextArea.Caret.Column; EditorCaretOffset = TextArea.Caret.Offset; TextArea.TextView.InvalidateLayer(KnownLayer.Background); } }); TextArea.TextEntered += (sender, e) => { _intellisenseManager?.OnTextInput(e, CaretOffset, TextArea.Caret.Line, TextArea.Caret.Column); _textEntering = false; }; _intellisense = new IntellisenseViewModel(); _completionAssistant = new CompletionAssistantViewModel(_intellisense); EventHandler <KeyEventArgs> tunneledKeyUpHandler = (send, ee) => { if (CaretOffset > 0) { _intellisenseManager?.OnKeyUp(ee, CaretOffset, TextArea.Caret.Line, TextArea.Caret.Column); } }; EventHandler <KeyEventArgs> tunneledKeyDownHandler = (send, ee) => { if (CaretOffset > 0) { _intellisenseManager?.OnKeyDown(ee, CaretOffset, TextArea.Caret.Line, TextArea.Caret.Column); if (ee.Key == Key.Tab && _currentSnippetContext == null && LanguageService != null) { var wordStart = Document.FindPrevWordStart(CaretOffset); if (wordStart > 0) { string word = Document.GetText(wordStart, CaretOffset - wordStart); var codeSnippet = _snippetManager.GetSnippet(LanguageService, SourceFile.Project?.Solution, SourceFile.Project, word); if (codeSnippet != null) { var snippet = SnippetParser.Parse(LanguageService, CaretOffset, TextArea.Caret.Line, TextArea.Caret.Column, codeSnippet.Snippet); _intellisenseManager.CloseIntellisense(); using (Document.RunUpdate()) { Document.Remove(wordStart, CaretOffset - wordStart); _intellisenseManager.IncludeSnippets = false; _currentSnippetContext = snippet.Insert(TextArea); } if (_currentSnippetContext.ActiveElements.Count() > 0) { IDisposable disposable = null; disposable = Observable.FromEventPattern <SnippetEventArgs>(_currentSnippetContext, nameof(_currentSnippetContext.Deactivated)).Take(1).Subscribe(o => { _currentSnippetContext = null; _intellisenseManager.IncludeSnippets = true; disposable.Dispose(); }); } else { _currentSnippetContext = null; _intellisenseManager.IncludeSnippets = true; } } } } } }; AddHandler(KeyDownEvent, tunneledKeyDownHandler, RoutingStrategies.Tunnel); AddHandler(KeyUpEvent, tunneledKeyUpHandler, RoutingStrategies.Tunnel); }
public override async Task <string> OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body) { return(string.Join(" ", TinySegmenter.Instance.Segment(body))); }
public override async Task <bool> OnRepliedContextually(IPost n, IPost?context, Dictionary <string, object> store, IShell shell, Server core) { if (n.User.Id == shell.Myself?.Id) { return(false); } if (n.Text == null) { return(false); } foreach (var(pattern, code) in langs) { var m = Regex.Match(n.Text.TrimMentions(), $"{pattern}[にへ]再翻訳"); if (m.Success) { await TranslateAsync((string)store["code"], code, (string)store["result"], n, shell, core); core.Storage[n.User].Add(StatRetranslatedCount); return(true); } } return(false); }
private async Task TranslateAsync(string from, string to, string text, IPost n, IShell shell, Server core) { core.LikeWithLimited(n.User); var result = await core.ExecCommand($"/translate {from} {to} {text}"); var reply = await shell.ReplyAsync(n, result); if (reply == null) { return; } EconomyModule.Pay(n, shell, core); core.LikeWithLimited(n.User); core.RegisterContext(reply, this, new Dictionary <string, object>() { { "result", result }, { "code", to }, }); }
public static void ShowRoles(this IShell shell) { shell.ShowView <ManageRolesView>(new ViewRequest("manage-roles"), new UiShowOptions { Title = "Roles" }); }
public static bool CanExecute(IShell shell) { return(shell.IsProgressing == false); }
public ProjectViewModel(ISolutionParentViewModel parent, IProject model) : base(parent, model) { studio = IoC.Get <IStudio>(); shell = IoC.Get <IShell>(); Items = new ObservableCollection <ProjectItemViewModel>(); Items.BindCollections(model.Items, p => { return(ProjectItemViewModel.Create(p)); }, (pivm, p) => pivm.Model == p); ConfigureCommand = ReactiveCommand.Create(() => { if (configuration == null) { configuration = new ProjectConfigurationDialogViewModel(model, () => { configuration = null; }); shell.AddDocument(configuration, false); } else { shell.SelectedDocument = configuration; } //shell.ModalDialog.ShowDialog(); }); DebugCommand = ReactiveCommand.Create(() => { //shell.Debug(model); }); BuildCommand = ReactiveCommand.Create(async() => await studio.BuildAsync(model)); CleanCommand = ReactiveCommand.Create(() => studio.Clean(model)); ManageReferencesCommand = ReactiveCommand.Create(() => { }); SetProjectCommand = ReactiveCommand.Create(() => { model.Solution.StartupProject = model; model.Solution.Save(); studio.InvalidateCodeAnalysis(); var root = this.FindRoot(); if (root != null) { root.VisitChildren(solutionItem => { solutionItem.RaisePropertyChanged(nameof(FontWeight)); }); } }); OpenInExplorerCommand = ReactiveCommand.Create(() => Platform.OpenFolderInExplorer(Model.CurrentDirectory)); NewItemCommand = ReactiveCommand.Create(() => { shell.ModalDialog = new NewItemDialogViewModel(model); shell.ModalDialog.ShowDialogAsync(); }); RemoveCommand = ReactiveCommand.Create(() => { studio.CloseDocumentsForProject(Model); Model.Solution.RemoveItem(Model); Model.Solution.Save(); }); DevConsoleCommand = ReactiveCommand.Create(() => { PlatformSupport.LaunchShell(Model.CurrentDirectory, Model.ToolChain?.BinDirectory, Model.Debugger2?.BinDirectory); }); }
public abstract int CompareTo(IShell other);
public static void ShowApplications(this IShell shell) { shell.ShowView <ManageApplicationsView>(new ViewRequest("manage-applications"), new UiShowOptions { Title = "Applications" }); }
public static void ShowPermissions(this IShell shell) { shell.ShowView <ManagePermissionsView>(new ViewRequest("manage-permissions"), new UiShowOptions { Title = "Permissions" }); }
public StartupViewModel(IShell shell, ISourcesCacheProvider cacheProvider, IDockWindow window) { _shell = shell; _cacheProvider = cacheProvider; _window = window; var appConfigStorage = new AppConfigStorage(); var config = appConfigStorage.Load(); Title = "App settings"; // Title AppTitle = shell.Title; this.WhenAnyValue(x => x.AppTitle) .Subscribe(x => shell.Title = x); // Theme Accent = config.Accent ?? "Blue"; IsDark = config.IsDark; UpdateTheme(); this.ObservableForProperty(x => x.Accent) .Subscribe(x => { config.Accent = x.Value; appConfigStorage.Save(config); UpdateTheme(); }); this.ObservableForProperty(x => x.IsDark) .Subscribe(x => { config.IsDark = x.Value; appConfigStorage.Save(config); UpdateTheme(); }); // Server Urls var urls = config.ServerUrl? .Split(';') .Select(x => Uri.TryCreate(x, UriKind.Absolute, out var result) ? result : null as Uri) .Where(x => x != null) .ToArray(); ServerUrlsSource = new SourceList <Uri>(); if (urls != null) { ServerUrlsSource.AddRange(urls); ServerUrl = urls.First(); } ServerUrlsSource .Connect() .ObserveOnDispatcher() .Bind(out _serverUrls) .ToCollection() .Subscribe(items => { config.ServerUrl = string.Join(";", items); appConfigStorage.Save(config); }); this.WhenAnyValue(x => x.ServerUrl) .Skip(1) .Subscribe(_ => UpdateSourcesCache()); // Authorization Tokens var tokens = config.AuthToken? .Split(';') .Where(x => !string.IsNullOrEmpty(x)) .ToArray(); AuthTokensSource = new SourceList <string>(); if (tokens != null) { AuthTokensSource.AddRange(tokens); AuthToken = tokens.First(); } AuthTokensSource .Connect() .ObserveOnDispatcher() .Bind(out _authTokens) .ToCollection() .Subscribe(items => { config.AuthToken = string.Join(";", items); appConfigStorage.Save(config); }); this.WhenAnyValue(x => x.AuthToken) .Skip(1) .Subscribe(_ => UpdateSourcesCache()); // Create Commands var hasUrl = this.WhenAny(x => x.ServerUrl, x => x.Value != null); NewLogCommand = CreateCommandWithInit(NewLog, hasUrl); NewKeepAliveCommand = CreateCommandWithInit(NewKeepAlive, hasUrl); NewMetricsCommand = CreateCommandWithInit(NewMetrics, hasUrl); RemoveEntitiesCommand = CreateCommandWithInit(RemoveEntities, hasUrl); ManageGroupsCommand = CreateCommandWithInit(ManageGroups, hasUrl); RemoveUrlCommand = ReactiveCommand.Create <Uri>(url => ServerUrlsSource.Remove(url)); RemoveAuthTokenCommand = ReactiveCommand.Create <string>(token => AuthTokensSource.Remove(token)); RefreshCommand = ReactiveCommand.CreateFromTask(Refresh, hasUrl); UpdateSourcesCache(); }
public View(string header, IShell shell, IRepository repo) { Header = header; Shell = shell; Repository = repo; }
public override async Task <string> OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body) { return(string.Concat(body.Select(c => c + "゛"))); }
internal static Task <ForceResetPasswordDialogData> ShowForceResetPasswordDialog(this IShell shell, string locale, List <string> locales) { var window = shell.GetWindow(); return(window.Invoke(async() => { var forceResetPasswordDialog = new ForceResetPasswordDialog(window, new ForceResetPasswordDialogSettings { LocaleInitial = locale, Locales = locales }) { Title = "Force Reset Password" }; await window.ShowMetroDialogAsync(forceResetPasswordDialog); var result = await forceResetPasswordDialog.WaitForButtonPressAsync(); await window.HideMetroDialogAsync(forceResetPasswordDialog); return result; })); }
public override async Task <string> OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body) { var count = 3; if (args.Length > 0 && !int.TryParse(args[0], out count)) { throw new CommandException(); } return(string.Concat(Enumerable.Repeat(0, count).Select(_ => katakana.Random()))); }
public static void RenameArtworks(FsPath directory, IShell shell) { Console.WriteLine("Artwork images at {0} will be renamed.", directory); Console.WriteLine("Press ENTER to continue"); Console.ReadLine(); var imageRepository = new ImageRepository( new ImageLocationsConfig { Directories = Sequence.Array( new DirectoryConfig { Path = directory, Art = true, Zoom = "False" }) }, shell); Console.WriteLine("Reading metadata from attributes..."); imageRepository.LoadFiles(); imageRepository.LoadArt(); Console.WriteLine("Renaming..."); var images = imageRepository.GetAllArts() .GroupBy(_ => _.FullPath) .ToDictionary( gr => gr.Key, gr => ( artists: gr.Select(_ => _.Artist).Where(a => !string.IsNullOrWhiteSpace(a)).ToList(), sets: gr.Where(_ => _.SetCodeIsFromAttribute && !string.IsNullOrWhiteSpace(_.SetCode)).Select(_ => _.SetCode).ToList() )); foreach ((FsPath path, (List <string> artistsList, List <string> setsList)) in images) { string original = path.Basename(); string renamed = Rename(original, artistsList, setsList); if (Str.Equals(renamed, original)) { continue; } Console.WriteLine("\trenaming {0} to {1}", original, renamed); FsPath renamedFullPath = path.Parent().Join(renamed); if (renamedFullPath.IsFile()) { var originalSignature = Signer.CreateSignature(path); var renamedSignature = Signer.CreateSignature(renamedFullPath); if (Str.Equals(originalSignature.Md5Hash, renamedSignature.Md5Hash)) { Console.WriteLine("Deleting {0} as identical to renamed {1}", path, renamedFullPath); path.DeleteFile(); } else { Console.WriteLine("FILE ALREADY EXISTS: {0}", renamedFullPath); } } else { path.MoveFileTo(renamedFullPath); } } Console.WriteLine("Press ENTER to exit"); Console.ReadLine(); }
public static void ShowEnvironments(this IShell shell) { shell.ShowView <ManageEnvironmentsView>(new ViewRequest("manage-environments"), new UiShowOptions { Title = "Environments" }); }
public InstallPluginsCommand(IShell shell, IPluginManager plugins, MainThread mainThread) { this.shell = shell; this.plugins = plugins; this.mainThread = mainThread; }
public ViewInspectorCommandHandler(IShell shell) { _shell = shell; }
/// <summary> /// Initializes an <see cref="Kubectl"/> instance with the provided shell. /// </summary> /// <param name="shell">The shell in which the executable should run.</param> /// <returns>This instance.</returns> public override Kubectl Initialize(IShell shell) => this.Initialize("kubectl", shell);
public ExportScriptCommandHandler(IShell shell) { _shell = shell; }
public ConfiguratorViewModel(IShell shell) { _shell = shell; ParameterViewModels = new Caliburn.Micro.BindableCollection<ParameterViewModel>(); Steps = new Caliburn.Micro.BindableCollection<Step>(); CurrentOperations = new Caliburn.Micro.BindableCollection<CommandViewModel>(); }