本文整理汇总了C#中GetWorkerArg类的典型用法代码示例。如果您正苦于以下问题:C# GetWorkerArg类的具体用法?C# GetWorkerArg怎么用?C# GetWorkerArg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GetWorkerArg类属于命名空间,在下文中一共展示了GetWorkerArg类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostButton_Click
private void PostButton_Click(object sender, EventArgs e)
{
if (StatusText.Text.Trim().Length == 0)
{
if (!ImageSelectionPanel.Enabled)
{
DoRefresh();
return;
}
}
if (this.ExistCurrentPost && StatusText.Text.Trim() == string.Format("RT @{0}: {1}", _curPost.ScreenName, _curPost.TextFromApi))
{
DialogResult rtResult = MessageBox.Show(string.Format(Properties.Resources.PostButton_Click1, Environment.NewLine),
"Retweet",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question);
switch (rtResult)
{
case DialogResult.Yes:
doReTweetOfficial(false);
StatusText.Text = "";
return;
case DialogResult.Cancel:
return;
}
}
_history[_history.Count - 1] = new PostingStatus(StatusText.Text.Trim(), _reply_to_id, _reply_to_name);
if (SettingDialog.Nicoms)
{
StatusText.SelectionStart = StatusText.Text.Length;
UrlConvert(MyCommon.UrlConverter.Nicoms);
}
//if (SettingDialog.UrlConvertAuto)
//{
// StatusText.SelectionStart = StatusText.Text.Length;
// UrlConvertAutoToolStripMenuItem_Click(null, null);
//}
//else if (SettingDialog.Nicoms)
//{
// StatusText.SelectionStart = StatusText.Text.Length;
// UrlConvert(UrlConverter.Nicoms);
//}
StatusText.SelectionStart = StatusText.Text.Length;
GetWorkerArg args = new GetWorkerArg();
args.page = 0;
args.endPage = 0;
args.type = MyCommon.WORKERTYPE.PostMessage;
CheckReplyTo(StatusText.Text);
//整形によって増加する文字数を取得
int adjustCount = 0;
string tmpStatus = StatusText.Text.Trim();
if (ToolStripMenuItemApiCommandEvasion.Checked)
{
// APIコマンド回避
if (Regex.IsMatch(tmpStatus,
@"^[+\-\[\]\s\\.,*/(){}^~|='&%$#""<>?]*(get|g|fav|follow|f|on|off|stop|quit|leave|l|whois|w|nudge|n|stats|invite|track|untrack|tracks|tracking|\*)([+\-\[\]\s\\.,*/(){}^~|='&%$#""<>?]+|$)",
RegexOptions.IgnoreCase)
&& tmpStatus.EndsWith(" .") == false) adjustCount += 2;
}
if (ToolStripMenuItemUrlMultibyteSplit.Checked)
{
// URLと全角文字の切り離し
adjustCount += Regex.Matches(tmpStatus, @"https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#^]+").Count;
}
bool isCutOff = false;
bool isRemoveFooter = MyCommon.IsKeyDown(Keys.Shift);
if (StatusText.Multiline && !SettingDialog.PostCtrlEnter)
{
//複数行でEnter投稿の場合、Ctrlも押されていたらフッタ付加しない
isRemoveFooter = MyCommon.IsKeyDown(Keys.Control);
}
if (SettingDialog.PostShiftEnter)
{
isRemoveFooter = MyCommon.IsKeyDown(Keys.Control);
}
if (!isRemoveFooter && (StatusText.Text.Contains("RT @") || StatusText.Text.Contains("QT @")))
{
isRemoveFooter = true;
}
if (GetRestStatusCount(false, !isRemoveFooter) - adjustCount < 0)
{
if (MessageBox.Show(Properties.Resources.PostLengthOverMessage1, Properties.Resources.PostLengthOverMessage2, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
{
isCutOff = true;
//if (!SettingDialog.UrlConvertAuto) UrlConvertAutoToolStripMenuItem_Click(null, null);
if (GetRestStatusCount(false, !isRemoveFooter) - adjustCount < 0)
{
isRemoveFooter = true;
}
}
else
{
return;
}
//.........这里部分代码省略.........
示例2: MakeStatusMessage
private string MakeStatusMessage(GetWorkerArg AsyncArg, bool Finish)
{
string smsg = "";
if (!Finish)
{
//継続中メッセージ
switch (AsyncArg.type)
{
case MyCommon.WORKERTYPE.Timeline:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText5 + AsyncArg.page.ToString() + Properties.Resources.GetTimelineWorker_RunWorkerCompletedText6;
break;
case MyCommon.WORKERTYPE.Reply:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText4 + AsyncArg.page.ToString() + Properties.Resources.GetTimelineWorker_RunWorkerCompletedText6;
break;
case MyCommon.WORKERTYPE.DirectMessegeRcv:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText8 + AsyncArg.page.ToString() + Properties.Resources.GetTimelineWorker_RunWorkerCompletedText6;
break;
case MyCommon.WORKERTYPE.FavAdd:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText15 + AsyncArg.page.ToString() + "/" + AsyncArg.ids.Count.ToString() +
Properties.Resources.GetTimelineWorker_RunWorkerCompletedText16 + (AsyncArg.page - AsyncArg.sIds.Count - 1).ToString();
break;
case MyCommon.WORKERTYPE.FavRemove:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText17 + AsyncArg.page.ToString() + "/" + AsyncArg.ids.Count.ToString() +
Properties.Resources.GetTimelineWorker_RunWorkerCompletedText18 + (AsyncArg.page - AsyncArg.sIds.Count - 1).ToString();
break;
case MyCommon.WORKERTYPE.Favorites:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText19;
break;
case MyCommon.WORKERTYPE.PublicSearch:
smsg = "Search refreshing...";
break;
case MyCommon.WORKERTYPE.List:
smsg = "List refreshing...";
break;
case MyCommon.WORKERTYPE.Related:
smsg = "Related refreshing...";
break;
case MyCommon.WORKERTYPE.UserTimeline:
smsg = "UserTimeline refreshing...";
break;
}
}
else
{
//完了メッセージ
switch (AsyncArg.type)
{
case MyCommon.WORKERTYPE.Timeline:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText1;
break;
case MyCommon.WORKERTYPE.Reply:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText9;
break;
case MyCommon.WORKERTYPE.DirectMessegeRcv:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText11;
break;
case MyCommon.WORKERTYPE.DirectMessegeSnt:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText13;
break;
case MyCommon.WORKERTYPE.FavAdd:
//進捗メッセージ残す
break;
case MyCommon.WORKERTYPE.FavRemove:
//進捗メッセージ残す
break;
case MyCommon.WORKERTYPE.Favorites:
smsg = Properties.Resources.GetTimelineWorker_RunWorkerCompletedText20;
break;
case MyCommon.WORKERTYPE.Follower:
smsg = Properties.Resources.UpdateFollowersMenuItem1_ClickText3;
break;
case MyCommon.WORKERTYPE.Configuration:
//進捗メッセージ残す
break;
case MyCommon.WORKERTYPE.PublicSearch:
smsg = "Search refreshed";
break;
case MyCommon.WORKERTYPE.List:
smsg = "List refreshed";
break;
case MyCommon.WORKERTYPE.Related:
smsg = "Related refreshed";
break;
case MyCommon.WORKERTYPE.UserTimeline:
smsg = "UserTimeline refreshed";
break;
case MyCommon.WORKERTYPE.BlockIds:
smsg = Properties.Resources.UpdateBlockUserText3;
break;
}
}
return smsg;
}
示例3: OpenUriAsync
public void OpenUriAsync(string UriString)
{
GetWorkerArg args = new GetWorkerArg();
args.type = MyCommon.WORKERTYPE.OpenUri;
args.url = UriString;
RunAsync(args);
}
示例4: GetTimeline
private void GetTimeline(MyCommon.WORKERTYPE WkType, int fromPage, int toPage, string tabName)
{
if (!this.IsNetworkAvailable()) return;
//非同期実行引数設定
GetWorkerArg args = new GetWorkerArg();
args.page = fromPage;
args.endPage = toPage;
args.type = WkType;
args.tName = tabName;
if (!lastTime.ContainsKey(WkType)) lastTime.Add(WkType, new DateTime());
double period = DateTime.Now.Subtract(lastTime[WkType]).TotalSeconds;
if (period > 1 || period < -1)
{
lastTime[WkType] = DateTime.Now;
RunAsync(args);
}
//Timeline取得モードの場合はReplyも同時に取得
//if (!SettingDialog.UseAPI &&
// !_initial &&
// WkType == MyCommon.WORKERTYPE.Timeline &&
// SettingDialog.CheckReply)
//{
// //TimerReply.Enabled = false;
// _mentionCounter = SettingDialog.ReplyPeriodInt;
// GetWorkerArg _args = new GetWorkerArg();
// _args.page = fromPage;
// _args.endPage = toPage;
// _args.type = MyCommon.WORKERTYPE.Reply;
// RunAsync(_args);
//}
}
示例5: GetTimelineWorker_RunWorkerCompleted
//.........这里部分代码省略.........
{
_postTimestamps.RemoveAt(i);
}
}
if (!HashMgr.IsPermanent && !string.IsNullOrEmpty(HashMgr.UseHash))
{
HashMgr.ClearHashtag();
this.HashStripSplitButton.Text = "#[-]";
this.HashToggleMenuItem.Checked = false;
this.HashToggleToolStripMenuItem.Checked = false;
}
SetMainWindowTitle();
rslt.retMsg = "";
}
else
{
DialogResult retry;
try
{
retry = MessageBox.Show(string.Format("{0} ---> [ " + rslt.retMsg + " ]" + Environment.NewLine + "\"" + rslt.status.status + "\"" + Environment.NewLine + "{1}",
Properties.Resources.StatusUpdateFailed1,
Properties.Resources.StatusUpdateFailed2),
"Failed to update status",
MessageBoxButtons.RetryCancel,
MessageBoxIcon.Question);
}
catch (Exception)
{
retry = DialogResult.Abort;
}
if (retry == DialogResult.Retry)
{
GetWorkerArg args = new GetWorkerArg();
args.page = 0;
args.endPage = 0;
args.type = MyCommon.WORKERTYPE.PostMessage;
args.status = rslt.status;
RunAsync(args);
}
else
{
if (ToolStripFocusLockMenuItem.Checked)
{
//連投モードのときだけEnterイベントが起きないので強制的に背景色を戻す
StatusText_Enter(StatusText, new EventArgs());
}
}
}
if (rslt.retMsg.Length == 0 && SettingDialog.PostAndGet)
{
if (_isActiveUserstream)
{
RefreshTimeline(true);
}
else
{
GetTimeline(MyCommon.WORKERTYPE.Timeline, 1, 0, "");
}
}
break;
case MyCommon.WORKERTYPE.Retweet:
if (rslt.retMsg.Length == 0)
{
_postTimestamps.Add(DateTime.Now);
DateTime oneHour = DateTime.Now.Subtract(new TimeSpan(1, 0, 0));
示例6: FavoriteChange
private void FavoriteChange(bool FavAdd , bool multiFavoriteChangeDialogEnable = true)
{
//trueでFavAdd,falseでFavRemove
if (_statuses.Tabs[_curTab.Text].TabType == MyCommon.TabUsageType.DirectMessage || _curList.SelectedIndices.Count == 0
|| !this.ExistCurrentPost) return;
//複数fav確認msg
if (_curList.SelectedIndices.Count > 250 && FavAdd)
{
MessageBox.Show(Properties.Resources.FavoriteLimitCountText);
_DoFavRetweetFlags = false;
return;
}
else if (multiFavoriteChangeDialogEnable && _curList.SelectedIndices.Count > 1)
{
if (FavAdd)
{
string QuestionText = Properties.Resources.FavAddToolStripMenuItem_ClickText1;
if (_DoFavRetweetFlags) QuestionText = Properties.Resources.FavoriteRetweetQuestionText3;
if (MessageBox.Show(QuestionText, Properties.Resources.FavAddToolStripMenuItem_ClickText2,
MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
{
_DoFavRetweetFlags = false;
return;
}
}
else
{
if (MessageBox.Show(Properties.Resources.FavRemoveToolStripMenuItem_ClickText1, Properties.Resources.FavRemoveToolStripMenuItem_ClickText2,
MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
{
return;
}
}
}
GetWorkerArg args = new GetWorkerArg();
args.ids = new List<long>();
args.sIds = new List<long>();
args.tName = _curTab.Text;
if (FavAdd)
{
args.type = MyCommon.WORKERTYPE.FavAdd;
}
else
{
args.type = MyCommon.WORKERTYPE.FavRemove;
}
foreach (int idx in _curList.SelectedIndices)
{
PostClass post = GetCurTabPost(idx);
if (FavAdd)
{
if (!post.IsFav) args.ids.Add(post.StatusId);
}
else
{
if (post.IsFav) args.ids.Add(post.StatusId);
}
}
if (args.ids.Count == 0)
{
if (FavAdd)
StatusLabel.Text = Properties.Resources.FavAddToolStripMenuItem_ClickText4;
else
StatusLabel.Text = Properties.Resources.FavRemoveToolStripMenuItem_ClickText4;
return;
}
RunAsync(args);
}
示例7: doReTweetOfficial
private void doReTweetOfficial(bool isConfirm)
{
//公式RT
if (this.ExistCurrentPost)
{
if (_curPost.IsProtect)
{
MessageBox.Show("Protected.");
_DoFavRetweetFlags = false;
return;
}
if (_curList.SelectedIndices.Count > 15)
{
MessageBox.Show(Properties.Resources.RetweetLimitText);
_DoFavRetweetFlags = false;
return;
}
else if (_curList.SelectedIndices.Count > 1)
{
string QuestionText = Properties.Resources.RetweetQuestion2;
if (_DoFavRetweetFlags) QuestionText = Properties.Resources.FavoriteRetweetQuestionText1;
switch (MessageBox.Show(QuestionText, "Retweet", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
{
case DialogResult.Cancel:
case DialogResult.No:
_DoFavRetweetFlags = false;
return;
}
}
else
{
if (_curPost.IsDm || _curPost.IsMe)
{
_DoFavRetweetFlags = false;
return;
}
if (!SettingDialog.RetweetNoConfirm)
{
string Questiontext = Properties.Resources.RetweetQuestion1;
if (_DoFavRetweetFlags) Questiontext = Properties.Resources.FavoritesRetweetQuestionText2;
if (isConfirm && MessageBox.Show(Questiontext, "Retweet", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
{
_DoFavRetweetFlags = false;
return;
}
}
}
GetWorkerArg args = new GetWorkerArg();
args.ids = new List<long>();
args.sIds = new List<long>();
args.tName = _curTab.Text;
args.type = MyCommon.WORKERTYPE.Retweet;
foreach (int idx in _curList.SelectedIndices)
{
PostClass post = GetCurTabPost(idx);
if (!post.IsMe && !post.IsProtect && !post.IsDm) args.ids.Add(post.StatusId);
}
RunAsync(args);
}
}
示例8: RunAsync
private void RunAsync(GetWorkerArg args)
{
BackgroundWorker bw = null;
if (args.type != MyCommon.WORKERTYPE.Follower)
{
for (int i = 0; i < _bw.Length; i++)
{
if (_bw[i] != null && !_bw[i].IsBusy)
{
bw = _bw[i];
break;
}
}
if (bw == null)
{
for (int i = 0; i < _bw.Length; i++)
{
if (_bw[i] == null)
{
_bw[i] = new BackgroundWorker();
bw = _bw[i];
bw.WorkerReportsProgress = true;
bw.WorkerSupportsCancellation = true;
bw.DoWork += GetTimelineWorker_DoWork;
bw.ProgressChanged += GetTimelineWorker_ProgressChanged;
bw.RunWorkerCompleted += GetTimelineWorker_RunWorkerCompleted;
break;
}
}
}
}
else
{
if (_bwFollower == null)
{
_bwFollower = new BackgroundWorker();
bw = _bwFollower;
bw.WorkerReportsProgress = true;
bw.WorkerSupportsCancellation = true;
bw.DoWork += GetTimelineWorker_DoWork;
bw.ProgressChanged += GetTimelineWorker_ProgressChanged;
bw.RunWorkerCompleted += GetTimelineWorker_RunWorkerCompleted;
}
else
{
if (_bwFollower.IsBusy == false)
bw = _bwFollower;
}
}
if (bw == null) return;
bw.RunWorkerAsync(args);
}
示例9: RunAsync
private void RunAsync(GetWorkerArg args)
{
BackgroundWorker bw = null;
if (args.WorkerType == WorkerType.Follower)
{
if (_followerFetchWorker == null)
{
bw = _followerFetchWorker = CreateTimelineWorker();
}
else
{
if (!_followerFetchWorker.IsBusy)
{
bw = _followerFetchWorker;
}
}
}
else
{
foreach (var t in _bworkers)
{
if (t != null && !t.IsBusy)
{
bw = t;
break;
}
}
if (bw == null)
{
for (int i = 0; i < _bworkers.Length; i++)
{
if (_bworkers[i] == null)
{
_bworkers[i] = CreateTimelineWorker();
bw = _bworkers[i];
break;
}
}
}
}
if (bw == null)
{
return;
}
bw.RunWorkerAsync(args);
}
示例10: MakeStatusMessage
private string MakeStatusMessage(GetWorkerArg asyncArg, bool isFinish)
{
string smsg = string.Empty;
switch (asyncArg.WorkerType)
{
case WorkerType.Timeline:
smsg = isFinish ?
R.GetTimelineWorker_RunWorkerCompletedText1 :
string.Format("{0}{1}{2}", R.GetTimelineWorker_RunWorkerCompletedText5, asyncArg.Page, R.GetTimelineWorker_RunWorkerCompletedText6);
break;
case WorkerType.Reply:
smsg = isFinish ?
R.GetTimelineWorker_RunWorkerCompletedText9 :
string.Format("{0}{1}{2}", R.GetTimelineWorker_RunWorkerCompletedText4, asyncArg.Page, R.GetTimelineWorker_RunWorkerCompletedText6);
break;
case WorkerType.DirectMessegeRcv:
smsg = isFinish ?
R.GetTimelineWorker_RunWorkerCompletedText11 :
string.Format("{0}{1}{2}", R.GetTimelineWorker_RunWorkerCompletedText8, asyncArg.Page, R.GetTimelineWorker_RunWorkerCompletedText6);
break;
case WorkerType.FavAdd:
// 進捗メッセージ残す
smsg = isFinish ?
string.Empty :
string.Format("{0}{1}/{2}{3}{4}", R.GetTimelineWorker_RunWorkerCompletedText15, asyncArg.Page, asyncArg.Ids.Count, R.GetTimelineWorker_RunWorkerCompletedText16, asyncArg.Page - asyncArg.SIds.Count - 1);
break;
case WorkerType.FavRemove:
// 進捗メッセージ残す
smsg = isFinish ?
string.Empty :
string.Format("{0}{1}/{2}{3}{4}", R.GetTimelineWorker_RunWorkerCompletedText17, asyncArg.Page, asyncArg.Ids.Count, R.GetTimelineWorker_RunWorkerCompletedText18, asyncArg.Page - asyncArg.SIds.Count - 1);
break;
case WorkerType.Favorites:
smsg = isFinish ?
R.GetTimelineWorker_RunWorkerCompletedText20 :
R.GetTimelineWorker_RunWorkerCompletedText19;
break;
case WorkerType.PublicSearch:
smsg = isFinish ?
"Search refreshed" :
"Search refreshing...";
break;
case WorkerType.List:
smsg = isFinish ?
"List refreshed" :
"List refreshing...";
break;
case WorkerType.Related:
smsg = isFinish ?
"Related refreshed" :
"Related refreshing...";
break;
case WorkerType.UserTimeline:
smsg = isFinish ?
"UserTimeline refreshed" :
"UserTimeline refreshing...";
break;
case WorkerType.Follower:
smsg = isFinish ?
R.UpdateFollowersMenuItem1_ClickText3 :
string.Empty;
break;
case WorkerType.Configuration:
// 進捗メッセージ残す
break;
case WorkerType.BlockIds:
smsg = isFinish ?
R.UpdateBlockUserText3 :
string.Empty;
break;
}
return smsg;
}