本文整理汇总了C#中ConcurrentSet.Join方法的典型用法代码示例。如果您正苦于以下问题:C# ConcurrentSet.Join方法的具体用法?C# ConcurrentSet.Join怎么用?C# ConcurrentSet.Join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConcurrentSet
的用法示例。
在下文中一共展示了ConcurrentSet.Join方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow() {
InitializeComponent();
var pushedKeys = new ConcurrentSet<SWF.Keys>();
var betterRunAutocompletionSource = new BetterRunAutocompletionSource();
var webAutocompletionSource = new WebAutocompletionSource();
webAutocompletionSource.Initialize();
var githubAutocompletionSource = new GithubAutocompletionSource();
var startMenuAutocompletionSource = new StartMenuAutocompletionSource();
startMenuAutocompletionSource.Initialize();
var bashAutocompletionSource = new BashAutocompletionSource();
bashAutocompletionSource.Initialize();
var viewModel = new RootViewModel(this, pushedKeys);
viewModel.PropertyChanged += (s, e) => {
try {
var query = viewModel.Query;
var autocompletionSources = new AutocompletionSource[] {
startMenuAutocompletionSource,
webAutocompletionSource,
githubAutocompletionSource,
bashAutocompletionSource,
betterRunAutocompletionSource
};
if (query.IndexOf(':') != -1 && query.IndexOf(':') <= 3) {
Console.WriteLine("[email protected]#@!#" + query);
var bobkuh = query.Substring(0, query.IndexOf(":"));
query = query.Substring(bobkuh.Length + 1);
autocompletionSources = autocompletionSources.Where(x => x.Bobkuh?.Equals(bobkuh, StringComparison.OrdinalIgnoreCase) ?? false).ToArray();
}
query = query.Trim();
if (e.PropertyName.Equals(nameof(viewModel.Query))) {
viewModel.Suggestions.Clear();
if (viewModel.Query != "") {
var euphius = autocompletionSources.SelectMany(x => x.Query(query)).OrderByDescending(x => x.Blithee).GroupBy(x => x.Textd).Select(x => x.First());
foreach (var suggesteion in euphius.Take(7)) {
suggesteion.ParentViewModel = viewModel;
viewModel.Suggestions.Add(suggesteion);
}
}
}
} catch (Exception ex) {
Console.WriteLine(ex);
}
};
this.DataContext = viewModel;
this.Hide();
this.InputTextBox.LostFocus += (s, e) => { Console.WriteLine("[email protected]#[email protected]##"); this.Hide(); };
this.Deactivated += (s, e) => { this.Hide(); };
var hwnd = new WindowInteropHelper(this).Handle;
var globalHook = Gma.System.MouseKeyHook.Hook.GlobalEvents();
SWF.KeyEventHandler down = null, up = null;
ConcurrentQueue<Tuple<bool, SWF.Keys>> q = new ConcurrentQueue<Tuple<bool, SWF.Keys>>();
var semaph = new Semaphore(0, int.MaxValue);
InterceptKeys.Start();
InterceptKeys.KeyUp += (key) => {
q.Enqueue(new Tuple<bool, SWF.Keys>(false, key));
semaph.Release();
};
InterceptKeys.KeyDown += (key) => {
q.Enqueue(new Tuple<bool, SWF.Keys>(true, key));
semaph.Release();
};
new Thread(() => {
while (true) {
semaph.WaitOne();
Tuple<bool, SWF.Keys> result;
if (!q.TryDequeue(out result)) {
throw new Exception("wtf");
}
if (result.Item1) {
pushedKeys.TryAdd(result.Item2);
if (pushedKeys.Count == 3 &&
pushedKeys.Contains(SWF.Keys.LControlKey) &&
pushedKeys.Contains(SWF.Keys.LWin) &&
pushedKeys.Contains(SWF.Keys.R)) {
Application.Current.Dispatcher.BeginInvoke(new Action(() => {
// I have no clue how this works
SetWindowSizeStonerDawg();
viewModel.Query = "";
this.WindowState = WindowState.Minimized;
this.Show();
SetWindowSizeStonerDawg();
this.WindowState = WindowState.Normal;
Keyboard.Focus(InputTextBox);
SetWindowSizeStonerDawg();
}), DispatcherPriority.Send);
} else {
Console.WriteLine(pushedKeys.Join(", "));
}
} else {
//.........这里部分代码省略.........