private void LoadMyBranches() { _yourBranchesCB.Items.Clear(); if (MyRemote == null) { return; } AsyncLoader.DoAsync( () => MyRemote.GetHostedRepository().Branches, branches => { branches.Sort((a, b) => string.Compare(a.Name, b.Name, true)); int selectItem = 0; for (int i = 0; i < branches.Count; i++) { if (branches[i].Name == _currentBranch) { selectItem = i; } _yourBranchesCB.Items.Add(branches[i].Name); } _createBtn.Enabled = true; if (branches.Count > 0) { _yourBranchesCB.SelectedIndex = selectItem; } }, ex => { ex.Handled = false; }); }
public FileViewer() { TreatAllFilesAsText = false; ShowEntireFile = false; NumberOfVisibleLines = 3; InitializeComponent(); Translate(); TextEditor.ActiveTextAreaControl.TextArea.KeyDown += TextAreaKeyUp; TextEditor.Encoding = Settings.Encoding; IgnoreWhitespaceChanges = false; _async = new AsyncLoader(); _async.LoadingError += (sender, args) => { ResetForText(null); TextEditor.Text = "Unsupported file"; TextEditor.Refresh(); }; TextEditor.ActiveTextAreaControl.TextArea.MouseMove += TextAreaMouseMove; TextEditor.ActiveTextAreaControl.TextArea.MouseLeave += TextAreaMouseLeave; TextEditor.ShowVRuler = false; IsReadOnly = true; }
// //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion /// <summary> ///A test for AsyncLoader`1 Constructor ///</summary> public void AsyncLoaderConstructorTestHelper <T>() { Func <T> loadMethod = null; // TODO: Initialize to an appropriate value AsyncLoader <T> target = new AsyncLoader <T>(loadMethod); Assert.Inconclusive("TODO: Implement code to verify target"); }
private void _pullReqTargetsCB_SelectedIndexChanged(object sender, EventArgs e) { _currentHostedRemote = _pullReqTargetsCB.SelectedItem as IHostedRemote; _remoteBranchesCB.Items.Clear(); _remoteBranchesCB.Text = _strLoading.Text; AsyncLoader.DoAsync( () => _currentHostedRemote.GetHostedRepository().Branches, branches => { branches.Sort((a, b) => String.Compare(a.Name, b.Name, true)); int selectItem = 0; _remoteBranchesCB.Items.Clear(); for (int i = 0; i < branches.Count; i++) { if (branches[i].Name == _currentBranch) { selectItem = i; } _remoteBranchesCB.Items.Add(branches[i].Name); } _createBtn.Enabled = true; if (branches.Count > 0) { _remoteBranchesCB.SelectedIndex = selectItem; } }, ex => { ex.Handled = false; }); }
private void _getFromUserBtn_Click(object sender, EventArgs e) { var search = _searchTB.Text; if (search == null || search.Trim().Length == 0) { return; } PrepareSearch(sender, e); AsyncLoader.DoAsync( () => _gitHoster.GetRepositoriesOfUser(search.Trim()), HandleSearchResult, ex => { if (ex.Exception.Message.Contains("404")) { MessageBox.Show(this, _strUserNotFound.Text, _strError.Text); } else { MessageBox.Show(this, _strCouldNotFetchReposOfUser.Text + Environment.NewLine + ex.Exception.Message, _strError.Text); } _searchBtn.Enabled = true; }); }
private void UpdateMyRepos() { _myReposLV.Items.Clear(); _myReposLV.Items.Add(new ListViewItem { Text = _strLoading.Text }); AsyncLoader.DoAsync( () => _gitHoster.GetMyRepos(), repos => { _myReposLV.Items.Clear(); foreach (var repo in repos) { var lvi = new ListViewItem { Tag = repo, Text = repo.Name }; lvi.SubItems.Add(repo.IsAFork ? _strYes.Text : _strNo.Text); lvi.SubItems.Add(repo.Forks.ToString()); lvi.SubItems.Add(repo.IsPrivate ? _strYes.Text : _strNo.Text); _myReposLV.Items.Add(lvi); } }, ex => { _myReposLV.Items.Clear(); _helpTextLbl.Text = string.Format(_strFailedToGetRepos.Text, _gitHoster.Description) + "\r\n\r\nException: " + ex.Exception.Message + "\r\n\r\n" + _helpTextLbl.Text; }); }
public DashboardItem(Repository repository) : this() { if (repository == null) { return; } Bitmap icon = GetRepositoryIcon(repository); if (AppSettings.DashboardShowCurrentBranch) { _branchNameLoader = new AsyncLoader(); _branchNameLoader.Load(() => { if (!GitCommands.GitModule.IsBareRepository(repository.Path)) { return(GitModule.GetSelectedBranchFast(repository.Path)); } return(string.Empty); }, UpdateBranchName); } Initialize(icon, repository.Path, repository.Title, repository.Description); }
private void _selectedOwner_SelectedIndexChanged(object sender, EventArgs e) { var hostedRemote = _selectHostedRepoCB.SelectedItem as IHostedRemote; if (hostedRemote == null) { return; } var hostedRepo = hostedRemote.GetHostedRepository(); if (hostedRepo == null) { return; } _selectHostedRepoCB.Enabled = false; ResetAllAndShowLoadingPullRequests(); AsyncLoader.DoAsync( hostedRepo.GetPullRequests, res => { SetPullRequestsData(res); _selectHostedRepoCB.Enabled = true; }, ex => MessageBox.Show(this, _strFailedToFetchPullData.Text + Environment.NewLine + ex.Exception.Message, _strError.Text)); }
internal FormFileHistory(GitUICommands aCommands) : base(aCommands) { InitializeComponent(); _asyncLoader = new AsyncLoader(); // set tab page images { var imageList = new ImageList(); tabControl1.ImageList = imageList; imageList.ColorDepth = ColorDepth.Depth8Bit; imageList.Images.Add(global::GitUI.Properties.Resources.IconViewFile); imageList.Images.Add(global::GitUI.Properties.Resources.IconDiff); imageList.Images.Add(global::GitUI.Properties.Resources.IconBlame); tabControl1.TabPages[0].ImageIndex = 0; tabControl1.TabPages[1].ImageIndex = 1; tabControl1.TabPages[2].ImageIndex = 2; } _filterBranchHelper = new FilterBranchHelper(toolStripBranchFilterComboBox, toolStripBranchFilterDropDownButton, FileChanges); _filterRevisionsHelper = new FilterRevisionsHelper(toolStripRevisionFilterTextBox, toolStripRevisionFilterDropDownButton, FileChanges, toolStripRevisionFilterLabel, ShowFirstParent, form: this); _formBrowseMenus = new FormBrowseMenus(FileHistoryContextMenu); _formBrowseMenus.ResetMenuCommandSets(); _formBrowseMenus.AddMenuCommandSet(MainMenuItem.NavigateMenu, FileChanges.MenuCommands.GetNavigateMenuCommands()); _formBrowseMenus.AddMenuCommandSet(MainMenuItem.ViewMenu, FileChanges.MenuCommands.GetViewMenuCommands()); _formBrowseMenus.InsertAdditionalMainMenuItems(toolStripSeparator4); _commitDataManager = new CommitDataManager(() => Module); _fullPathResolver = new FullPathResolver(() => Module.WorkingDir); }
private void LoadAds() { adView = FindViewById <AdView>(Resource.Id.adView_main); var loader = new AsyncLoader(adView, TaskScheduler.FromCurrentSynchronizationContext()); loader.LoadAdViewAsync(CancellationToken.None); }
private void Update() { if (CurrentStatus != WorkingStatus.Started) { return; } if (Environment.TickCount >= _nextUpdateTime || (Environment.TickCount < 0 && _nextUpdateTime > 0)) { // If the previous status call hasn't exited yet, we'll wait until it is // so we don't queue up a bunch of commands if (_commandIsRunning || //don't update status while repository is being modyfied by GitExt //or while any git process is running, mostly repository status will change //after these actions. Moreover, calling git status while other git command is performed //can cause repository crash UICommands.RepoChangedNotifier.IsLocked || GitCommandHelpers.VersionInUse.RaceConditionWhenGitStatusIsUpdatingIndex && Module.IsRunningGitProcess()) { _statusIsUpToDate = false;//tell that computed status isn't up to date return; } _commandIsRunning = true; _statusIsUpToDate = true; if (_ignoredFilesAreStale) { UpdateIgnoredFiles(false); } AsyncLoader.DoAsync(RunStatusCommand, UpdatedStatusReceived, OnUpdateStatusError); // Always update every 5 min, even if we don't know anything changed ScheduleNextJustInCaseUpdate(); } }
private void LoadDiffPatch() { AsyncLoader.DoAsync( () => _currentPullRequestInfo.DiffData, SplitAndLoadDiff, ex => MessageBox.Show(this, _strFailedToLoadDiffData.Text + ex.Message, _strError.Text)); }
internal FormFileHistory(GitUICommands aCommands) : base(aCommands) { InitializeComponent(); _asyncLoader = new AsyncLoader(); // set tab page images { var imageList = new ImageList(); tabControl1.ImageList = imageList; imageList.ColorDepth = ColorDepth.Depth8Bit; imageList.Images.Add(global::GitUI.Properties.Resources.IconViewFile); imageList.Images.Add(global::GitUI.Properties.Resources.IconDiff); imageList.Images.Add(global::GitUI.Properties.Resources.IconBlame); tabControl1.TabPages[0].ImageIndex = 0; tabControl1.TabPages[1].ImageIndex = 1; tabControl1.TabPages[2].ImageIndex = 2; } _filterBranchHelper = new FilterBranchHelper(toolStripBranchFilterComboBox, toolStripBranchFilterDropDownButton, FileChanges); _filterRevisionsHelper = new FilterRevisionsHelper(toolStripRevisionFilterTextBox, toolStripRevisionFilterDropDownButton, FileChanges, toolStripRevisionFilterLabel, ShowFirstParent, form: this); _formBrowseMenus = new FormBrowseMenus(FileHistoryContextMenu); _formBrowseMenus.ResetMenuCommandSets(); _formBrowseMenus.AddMenuCommandSet(MainMenuItem.NavigateMenu, FileChanges.MenuCommands.GetNavigateMenuCommands()); _formBrowseMenus.AddMenuCommandSet(MainMenuItem.ViewMenu, FileChanges.MenuCommands.GetViewMenuCommands()); _formBrowseMenus.InsertAdditionalMainMenuItems(toolStripSeparator4); }
public void InitToolStripBranchFilter() { bool local = localToolStripMenuItem.Checked; bool tag = tagsToolStripMenuItem.Checked; bool remote = remoteToolStripMenuItem.Checked; _NO_TRANSLATE_toolStripBranches.Items.Clear(); if (Module.IsValidGitWorkingDir()) { AsyncLoader.DoAsync(() => GetBranchAndTagRefs(local, tag, remote), branches => { foreach (var branch in branches) { _NO_TRANSLATE_toolStripBranches.Items.Add(branch); } var autoCompleteList = _NO_TRANSLATE_toolStripBranches.AutoCompleteCustomSource.Cast <string>(); if (!autoCompleteList.SequenceEqual(branches)) { _NO_TRANSLATE_toolStripBranches.AutoCompleteCustomSource.Clear(); _NO_TRANSLATE_toolStripBranches.AutoCompleteCustomSource.AddRange(branches.ToArray()); } }); } _NO_TRANSLATE_toolStripBranches.Enabled = Module.IsValidGitWorkingDir(); }
public DashboardItem(Repository repository) : this() { if (repository == null) return; Bitmap icon = GetRepositoryIcon(repository); if (AppSettings.DashboardShowCurrentBranch) { _branchNameLoader = new AsyncLoader(); _branchNameLoader.Load(() => { if (!GitCommands.GitModule.IsBareRepository(repository.Path)) { return GitModule.GetSelectedBranchFast(repository.Path); } return string.Empty; }, UpdateBranchName); } Initialize(icon, repository.Path, repository.Title, repository.Description); }
public FormGoToCommit(GitUICommands aCommands) : base(aCommands) { InitializeComponent(); Translate(); tagsLoader = new AsyncLoader(); }
private void Update() { if (CurrentStatus != WorkingStatus.Started) { return; } if (Environment.TickCount >= _nextUpdateTime || (Environment.TickCount < 0 && _nextUpdateTime > 0)) { // If the previous status call hasn't exited yet, we'll wait until it is // so we don't queue up a bunch of commands if (_commandIsRunning || UICommands.RepoChangedNotifier.IsLocked || Module.IsRunningGitProcess()) { _statusIsUpToDate = false;//tell that computed status isn't up to date return; } _commandIsRunning = true; _statusIsUpToDate = true; AsyncLoader.DoAsync(RunStatusCommand, UpdatedStatusReceived, OnUpdateStatusError); // Always update every 5 min, even if we don't know anything changed ScheduleNextJustInCaseUpdate(); } }
public FormCreateWorktree(GitUICommands commands) : base(commands) { InitializeComponent(); _branchesLoader = new AsyncLoader(); _invalidCharsInPath = Path.GetInvalidFileNameChars(); Translate(); }
private AssetBundleRequest m_cRequest; //The load request /// <summary> /// Start async load the assetbundle /// </summary> /// <param name="asset"></param> /// <param name="resName"></param> /// <param name="callback"></param> public static AsyncLoader StartLoad(AssetBundle asset, string resName) { GameObject obj = new GameObject("AsyncLoader"); AsyncLoader loader = obj.AddComponent <AsyncLoader>(); loader.StartCoroutine(loader.GoLoader(asset, resName)); return(loader); }
public FormGoToCommit(GitUICommands aCommands) : base(aCommands) { InitializeComponent(); Translate(); _tagsLoader = new AsyncLoader(); _branchesLoader = new AsyncLoader(); }
void IDisposable.Dispose() { if (backgroundLoader != null) { backgroundLoader.Cancel(); } backgroundLoader = null; }
protected void OnDestroy() { //TODO 3: deregistrar el evento cuando se destruye el objeto. Comprobar que asyncLoader sea distinto de null por sanidad :) if (asyncLoader != null) { asyncLoader.UnregisterProgressCallback(ProgressLoading); asyncLoader = null; } }
public void CanEnumerateWithoutLoadOrUpdate() { var loader = new AsyncLoader <int>(Seq.ListBased); foreach (var item in loader) { Console.WriteLine("Item: " + item); } }
protected void LoadDeps() { for (int i = 0; i < depsCnt; i++) { AssetBundleData ad = ab.depInfoReader.GetAssetBundleInfo(data.dependencies[i]); AsyncLoader loader = new AsyncLoader(ad); loader.InnerLoad(); } }
public FileViewer() { TreatAllFilesAsText = false; ShowEntireFile = false; NumberOfVisibleLines = 3; InitializeComponent(); Translate(); GitUICommandsSourceSet += FileViewer_GitUICommandsSourceSet; if (GitCommands.Utils.EnvUtils.RunningOnWindows()) _internalFileViewer = new FileViewerWindows(); else _internalFileViewer = new FileViewerMono(); _internalFileViewer.MouseEnter += _internalFileViewer_MouseEnter; _internalFileViewer.MouseLeave += _internalFileViewer_MouseLeave; _internalFileViewer.MouseMove += _internalFileViewer_MouseMove; var internalFileViewerControl = (Control)_internalFileViewer; internalFileViewerControl.Dock = DockStyle.Fill; Controls.Add(internalFileViewerControl); _async = new AsyncLoader(); _async.LoadingError += (sender, args) => { ResetForText(null); _internalFileViewer.SetText("Unsupported file: \n\n" + args.Exception.Message); if (TextLoaded != null) TextLoaded(this, null); }; IgnoreWhitespaceChanges = AppSettings.IgnoreWhitespaceChanges; ignoreWhiteSpaces.Checked = IgnoreWhitespaceChanges; IsReadOnly = true; this.encodingToolStripComboBox.Items.AddRange(new Object[] { "Default (" + Encoding.Default.HeaderName + ")", "ASCII", "Unicode", "UTF7", "UTF8", "UTF32" }); _internalFileViewer.MouseMove += TextAreaMouseMove; _internalFileViewer.MouseLeave += TextAreaMouseLeave; _internalFileViewer.TextChanged += TextEditor_TextChanged; _internalFileViewer.ScrollPosChanged += _internalFileViewer_ScrollPosChanged; _internalFileViewer.SelectedLineChanged += _internalFileViewer_SelectedLineChanged; _internalFileViewer.DoubleClick += (sender, args) => OnRequestDiffView(EventArgs.Empty); this.HotkeysEnabled = true; if (RunTime() && ContextMenuStrip == null) ContextMenuStrip = contextMenu; contextMenu.Opening += ContextMenu_Opening; }
public FormAddToGitIgnore(GitUICommands aCommands, params string[] filePatterns) : base(aCommands) { InitializeComponent(); _ignoredFilesLoader = new AsyncLoader(); Translate(); if (filePatterns != null) FilePattern.Text = string.Join(Environment.NewLine, filePatterns); }
public async Task CanUpdateEmptyLoaderWithEmptyChanges() { var loader = new AsyncLoader <int>( seqFactory: Seq.ListBased, fetchUpdatesAsync: (_, __) => Task.FromResult(Enumerable.Empty <ItemChange <int> >())); await loader.UpdateAsync(); // --- Perform --- loader.Should().BeEmpty(); }
public FileViewer() { TreatAllFilesAsText = false; ShowEntireFile = false; DisableFocusControlOnHover = false; NumberOfVisibleLines = 3; InitializeComponent(); Translate(); if (GitCommands.Settings.RunningOnWindows()) _internalFileViewer = new FileViewerWindows(); else _internalFileViewer = new FileViewerMono(); _internalFileViewer.MouseLeave += _internalFileViewer_MouseLeave; _internalFileViewer.MouseMove += _internalFileViewer_MouseMove; var internalFileViewerControl = (Control)_internalFileViewer; internalFileViewerControl.Dock = DockStyle.Fill; Controls.Add(internalFileViewerControl); _async = new AsyncLoader(); _async.LoadingError += (sender, args) => { ResetForText(null); _internalFileViewer.SetText("Unsupported file"); if (TextLoaded != null) TextLoaded(this, null); }; IgnoreWhitespaceChanges = false; IsReadOnly = true; Settings.WorkingDirChanged += WorkingDirChanged; this.Encoding = Settings.FilesEncoding; this.encodingToolStripComboBox.Items.AddRange(new Object[] { "Default (" + Encoding.Default.HeaderName + ")", "ASCII", "Unicode", "UTF7", "UTF8", "UTF32" }); _internalFileViewer.MouseMove += TextAreaMouseMove; _internalFileViewer.MouseLeave += TextAreaMouseLeave; _internalFileViewer.TextChanged += TextEditor_TextChanged; _internalFileViewer.ScrollPosChanged += new EventHandler(_internalFileViewer_ScrollPosChanged); _internalFileViewer.SelectedLineChanged += new SelectedLineChangedEventHandler(_internalFileViewer_SelectedLineChanged); _internalFileViewer.DoubleClick += (sender, args) => OnRequestDiffView(EventArgs.Empty); this.HotkeysEnabled = true; ContextMenu.Opening += ContextMenu_Opening; }
public void CanLoadEmptyList() { var loader = new AsyncLoader <string>( seqFactory: Seq.ListBased, loadDataAsync: token => Task.FromResult(Enumerable.Empty <string>())); loader.LoadAsync(); Assert.That(loader.ToList(), Is.Empty); }
public void CanAddCollectionChangeHandlersOfDifferentTypes() { var loader = new AsyncLoader <Item>(seqFactory: Seq.ListBased); // Simulate an external consumer of this collection IAsyncCollection <IItem> externalView = loader; externalView.CollectionChanged += DummyChangesListener; //externalView.CollectionChanges += DummyRootListener; // does not compile?? externalView.CollectionChanged += new CollectionChangedHandler <IRoot>(DummyRootListener); }
// Use this for initialization void Start() { AssetBundle ab = null; string path = "" + Application.dataPath + "/example/bundle/combine_uncompress.unity3d"; if (FileLoader.IsExist(path)) { ab = AssetBundleLoader.CreateFromFile(path); this.loader = AsyncLoader.StartLoad(ab, "item", finish_callback); } }
private void LoadDiscussion() { AsyncLoader.DoAsync( () => _currentPullRequestInfo.Discussion, LoadDiscussion, ex => { MessageBox.Show(this, _strCouldNotLoadDiscussion.Text + Environment.NewLine + ex.Exception.Message, _strError.Text); LoadDiscussion(null); }); }
// Use this for initialization void Start () { AssetBundle ab = null; string path = ""+Application.dataPath + "/example/bundle/combine_uncompress.unity3d"; if(FileLoader.IsExist(path)) { ab = AssetBundleLoader.CreateFromFile(path); this.loader = AsyncLoader.StartLoad(ab,"item",finish_callback); } }
private void Awake() { // Простой синглтон if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
public async Task CanUpdateEmptyLoaderWithSingleAddition() { IEnumerable <ItemChange <int> > changes = new[] { new ItemChange <int>(ChangeType.Added, 1) }; var loader = new AsyncLoader <int>( seqFactory: Seq.ListBased, fetchUpdatesAsync: (_, __) => Task.FromResult(changes)); await loader.UpdateAsync(); // --- Perform --- loader.ShouldAllBeEquivalentTo(new[] { 1 }); }
private void Awake() { if (Instance == null) { Instance = this; mLoader = new AsyncLoader(); if (m_DontDestroyOnLoad) { DontDestroyOnLoad(gameObject); } } }
public FormGoToCommit(GitUICommands aCommands) : base(aCommands) { InitializeComponent(); Translate(); _tagsLoader = new AsyncLoader(); _branchesLoader = new AsyncLoader(); LoadTagsAsync(); LoadBranchesAsync(); if (aCommands != null) SetCommitExpressionFromClipboard(); }
public FormAddToGitIgnore(GitUICommands aCommands, params string[] filePatterns) : base(aCommands) { InitializeComponent(); _ignoredFilesLoader = new AsyncLoader(); Translate(); if (filePatterns != null) { FilePattern.Text = string.Join(Environment.NewLine, filePatterns); } }
private void UpdateIgnoredFiles(bool clearImmediately) { if (clearImmediately) { _ignoredFiles = new HashSet <string>(); } AsyncLoader.DoAsync( LoadIgnoredFiles, (ignoredSet) => { _ignoredFiles = ignoredSet; _ignoredFilesAreStale = false; }, (e) => { _ignoredFiles = new HashSet <string>(); } ); }
public FileViewer() { TreatAllFilesAsText = false; ShowEntireFile = false; DisableFocusControlOnHover = false; NumberOfVisibleLines = 3; InitializeComponent(); Translate(); _internalFileViewer = InternalFileViewer; _internalFileViewer.MouseLeave += _internalFileViewer_MouseLeave; _internalFileViewer.MouseMove += _internalFileViewer_MouseMove; var internalFileViewerControl = (Control)_internalFileViewer; internalFileViewerControl.Dock = DockStyle.Fill; Controls.Add(internalFileViewerControl); _async = new AsyncLoader(); _async.LoadingError += (sender, args) => { ResetForText(null); _internalFileViewer.SetText("Unsupported file"); if (TextLoaded != null) TextLoaded(this, null); }; IgnoreWhitespaceChanges = false; IsReadOnly = true; this.Encoding = Settings.Encoding; this.encodingToolStripComboBox.Items.AddRange(EncodingTypes); this.encodingToolStripComboBox.Text = ToolStripComboBoxText; _internalFileViewer.MouseMove += TextAreaMouseMove; _internalFileViewer.MouseLeave += TextAreaMouseLeave; _internalFileViewer.TextChanged += TextEditor_TextChanged; _internalFileViewer.ScrollPosChanged += new EventHandler(_internalFileViewer_ScrollPosChanged); _internalFileViewer.SelectedLineChanged += new SelectedLineChangedEventHandler(_internalFileViewer_SelectedLineChanged); _internalFileViewer.DoubleClick += (sender, args) => OnRequestDiffView(EventArgs.Empty); this.HotkeysEnabled = true; ContextMenu.Opening += ContextMenu_Opening; }
public FileViewer() { TreatAllFilesAsText = false; ShowEntireFile = false; DisableFocusControlOnHover = false; NumberOfVisibleLines = 3; InitializeComponent(); Translate(); if (GitCommands.Settings.RunningOnWindows()) _internalFileViewer = new FileViewerWindows(); else _internalFileViewer = new FileViewerMono(); _internalFileViewer.MouseLeave += _internalFileViewer_MouseLeave; _internalFileViewer.MouseMove += _internalFileViewer_MouseMove; var internalFileViewerControl = (Control)_internalFileViewer; internalFileViewerControl.Dock = DockStyle.Fill; Controls.Add(internalFileViewerControl); _async = new AsyncLoader(); _async.LoadingError += (sender, args) => { ResetForText(null); _internalFileViewer.SetText("Unsupported file"); if (TextLoaded != null) TextLoaded(this, null); }; IgnoreWhitespaceChanges = false; IsReadOnly = true; _internalFileViewer.MouseMove += TextAreaMouseMove; _internalFileViewer.MouseLeave += TextAreaMouseLeave; _internalFileViewer.TextChanged += TextEditor_TextChanged; _internalFileViewer.ScrollPosChanged += new EventHandler(_internalFileViewer_ScrollPosChanged); _internalFileViewer.SelectedLineChanged += new SelectedLineChangedEventHandler(_internalFileViewer_SelectedLineChanged); _internalFileViewer.DoubleClick += (sender, args) => OnRequestDiffView(EventArgs.Empty); this.HotkeysEnabled = true; this.Hotkeys = HotkeySettingsManager.LoadHotkeys(HotkeySettingsName); ContextMenu.Opening += ContextMenu_Opening; }
public FileViewer() { TreatAllFilesAsText = false; ShowEntireFile = false; NumberOfVisibleLines = 3; InitializeComponent(); TextEditor.ActiveTextAreaControl.TextArea.KeyDown += TextArea_KeyUp; IgnoreWhitespaceChanges = false; async = new AsyncLoader(); async.LoadingError += delegate { ResetForText(null); TextEditor.Text = "Unsupported file"; TextEditor.Refresh(); }; }
internal FormFileHistory(GitUICommands aCommands) : base(aCommands) { InitializeComponent(); _asyncLoader = new AsyncLoader(); // set tab page images { var imageList = new ImageList(); tabControl1.ImageList = imageList; imageList.ColorDepth = ColorDepth.Depth8Bit; imageList.Images.Add(global::GitUI.Properties.Resources.IconViewFile); imageList.Images.Add(global::GitUI.Properties.Resources.IconDiff); imageList.Images.Add(global::GitUI.Properties.Resources.IconBlame); tabControl1.TabPages[0].ImageIndex = 0; tabControl1.TabPages[1].ImageIndex = 1; tabControl1.TabPages[2].ImageIndex = 2; } _filterBranchHelper = new FilterBranchHelper(toolStripBranches, toolStripDropDownButton2, FileChanges); _filterRevisionsHelper = new FilterRevisionsHelper(toolStripTextBoxFilter, toolStripDropDownButton1, FileChanges, toolStripLabel2, this); }
public FormCommit(GitUICommands aCommands, CommitKind commitKind, GitRevision editedCommit) : base(true, aCommands) { _taskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); _unstagedLoader = new AsyncLoader(_taskScheduler); _useFormCommitMessage = Settings.UseFormCommitMessage; InitializeComponent(); Message.TextChanged += Message_TextChanged; Message.TextAssigned += Message_TextAssigned; Loading.Image = Properties.Resources.loadingpanel; Translate(); SolveMergeconflicts.Font = new Font(SystemFonts.MessageBoxFont, FontStyle.Bold); SelectedDiff.ExtraDiffArgumentsChanged += SelectedDiffExtraDiffArgumentsChanged; if (IsUICommandsInitialized) StageInSuperproject.Visible = Module.SuperprojectModule != null; StageInSuperproject.Checked = Settings.StageInSuperprojectAfterCommit; closeDialogAfterEachCommitToolStripMenuItem.Checked = Settings.CloseCommitDialogAfterCommit; closeDialogAfterAllFilesCommittedToolStripMenuItem.Checked = Settings.CloseCommitDialogAfterLastCommit; refreshDialogOnFormFocusToolStripMenuItem.Checked = Settings.RefreshCommitDialogOnFormFocus; Unstaged.SetNoFilesText(_noUnstagedChanges.Text); Staged.SetNoFilesText(_noStagedChanges.Text); Message.Enabled = _useFormCommitMessage; commitMessageToolStripMenuItem.Enabled = _useFormCommitMessage; commitTemplatesToolStripMenuItem.Enabled = _useFormCommitMessage; Message.WatermarkText = _useFormCommitMessage ? _enterCommitMessageHint.Text : _commitMessageDisabled.Text; _commitKind = commitKind; _editedCommit = editedCommit; Unstaged.SelectedIndexChanged += UnstagedSelectionChanged; Staged.SelectedIndexChanged += StagedSelectionChanged; Unstaged.DoubleClick += Unstaged_DoubleClick; Staged.DoubleClick += Staged_DoubleClick; HotkeysEnabled = true; Hotkeys = HotkeySettingsManager.LoadHotkeys(HotkeySettingsName); SelectedDiff.AddContextMenuSeparator(); _stageSelectedLinesToolStripMenuItem = SelectedDiff.AddContextMenuEntry(_stageSelectedLines.Text, StageSelectedLinesToolStripMenuItemClick); _stageSelectedLinesToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeys((int)Commands.StageSelectedFile).ToShortcutKeyDisplayString(); _resetSelectedLinesToolStripMenuItem = SelectedDiff.AddContextMenuEntry(_resetSelectedLines.Text, ResetSelectedLinesToolStripMenuItemClick); _resetSelectedLinesToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeys((int)Commands.ResetSelectedFiles).ToShortcutKeyDisplayString(); _resetSelectedLinesToolStripMenuItem.Image = Reset.Image; resetChanges.ShortcutKeyDisplayString = _resetSelectedLinesToolStripMenuItem.ShortcutKeyDisplayString; }
public bool PlayMovieInRadar(string movie, LuaFunction playComplete = null) { if (playComplete != null) { var f = playComplete.CopyReference() as LuaFunction; onCompleteRadar = () => { try { using (f) f.Call().Dispose(); } catch (LuaException e) { Context.FatalError(e.Message); } }; } else onCompleteRadar = () => { }; Stream s = null; try { s = GlobalFileSystem.Open(movie); } catch (FileNotFoundException e) { Log.Write("lua", "Couldn't play movie {0}! File doesn't exist.", e.FileName); onCompleteRadar(); return false; } AsyncLoader l = new AsyncLoader(Media.LoadVqa); IAsyncResult ar = l.BeginInvoke(s, null, null); onLoadComplete = () => { Media.StopFMVInRadar(); world.AddFrameEndTask(_ => Media.PlayFMVInRadar(world, l.EndInvoke(ar), onCompleteRadar)); }; world.AddFrameEndTask(w => w.Add(new AsyncAction(ar, onLoadComplete))); return true; }