本文整理汇总了C#中OpenTween.InputTabName类的典型用法代码示例。如果您正苦于以下问题:C# InputTabName类的具体用法?C# InputTabName怎么用?C# InputTabName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputTabName类属于OpenTween命名空间,在下文中一共展示了InputTabName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TabRename
public bool TabRename(ref string tabName)
{
//タブ名変更
string newTabText = null;
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = tabName;
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return false;
newTabText = inputName.TabName;
}
this.TopMost = SettingDialog.AlwaysTop;
if (!string.IsNullOrEmpty(newTabText))
{
//新タブ名存在チェック
for (int i = 0; i < ListTab.TabCount; i++)
{
if (ListTab.TabPages[i].Text == newTabText)
{
string tmp = string.Format(Properties.Resources.Tabs_DoubleClickText1, newTabText);
MessageBox.Show(tmp, Properties.Resources.Tabs_DoubleClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
}
//タブ名のリスト作り直し(デフォルトタブ以外は再作成)
for (int i = 0; i < ListTab.TabCount; i++)
{
if (_statuses.IsDistributableTab(ListTab.TabPages[i].Text))
{
TabDialog.RemoveTab(ListTab.TabPages[i].Text);
}
if (ListTab.TabPages[i].Text == tabName)
{
ListTab.TabPages[i].Text = newTabText;
}
}
_statuses.RenameTab(tabName, newTabText);
for (int i = 0; i < ListTab.TabCount; i++)
{
if (_statuses.IsDistributableTab(ListTab.TabPages[i].Text))
{
if (ListTab.TabPages[i].Text == tabName)
{
ListTab.TabPages[i].Text = newTabText;
}
TabDialog.AddTab(ListTab.TabPages[i].Text);
}
}
SaveConfigsCommon();
SaveConfigsTabs();
_rclickTabName = newTabText;
tabName = newTabText;
return true;
}
else
{
return false;
}
}
示例2: SelectTab
private bool SelectTab(ref string tabName)
{
do
{
//振り分け先タブ選択
if (TabDialog.ShowDialog() == DialogResult.Cancel)
{
this.TopMost = SettingDialog.AlwaysTop;
return false;
}
this.TopMost = SettingDialog.AlwaysTop;
tabName = TabDialog.SelectedTabName;
ListTab.SelectedTab.Focus();
//新規タブを選択→タブ作成
if (tabName == Properties.Resources.IDRuleMenuItem_ClickText1)
{
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = _statuses.GetUniqueTabName();
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return false;
tabName = inputName.TabName;
}
this.TopMost = SettingDialog.AlwaysTop;
if (!string.IsNullOrEmpty(tabName))
{
if (!_statuses.AddTab(tabName, MyCommon.TabUsageType.UserDefined, null) || !AddNewTab(tabName, false, MyCommon.TabUsageType.UserDefined))
{
string tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText2, tabName);
MessageBox.Show(tmp, Properties.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
//もう一度タブ名入力
}
else
{
return true;
}
}
}
else
{
//既存タブを選択
return true;
}
}
while (true);
}
示例3: ButtonAddTab_Click
private void ButtonAddTab_Click(object sender, EventArgs e)
{
string tabName = null;
MyCommon.TabUsageType tabType;
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = _sts.MakeTabName("MyTab");
inputName.IsShowUsage = true;
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return;
tabName = inputName.TabName;
tabType = inputName.Usage;
}
if (!string.IsNullOrEmpty(tabName))
{
//List対応
ListElement list = null;
if (tabType == MyCommon.TabUsageType.Lists)
{
try
{
((TweenMain)this.Owner).TwitterInstance.GetListsApi();
}
catch (WebApiException ex)
{
MessageBox.Show("Failed to get lists. (" + ex.Message + ")");
}
using (ListAvailable listAvail = new ListAvailable())
{
if (listAvail.ShowDialog(this) == DialogResult.Cancel) return;
if (listAvail.SelectedList == null) return;
list = listAvail.SelectedList;
}
}
if (!_sts.AddTab(tabName, tabType, list) || !((TweenMain)this.Owner).AddNewTab(tabName, false, tabType, list))
{
string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName);
MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
else
{
// タブ作成成功
// 末尾のタブを取得する
var lastIdx = this.ListTabs.Items.Count - 1;
var lastTab = lastIdx != -1
? this._sts.Tabs[(string)this.ListTabs.Items[lastIdx]]
: null;
// 末尾がミュートタブであればその手前に追加する
if (lastTab != null && lastTab.TabType == MyCommon.TabUsageType.Mute)
this.ListTabs.Items.Insert(lastIdx, tabName);
else
this.ListTabs.Items.Add(tabName);
}
}
}
示例4: ButtonAddTab_Click
private void ButtonAddTab_Click(object sender, EventArgs e)
{
string tabName = null;
MyCommon.TabUsageType tabType;
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = _sts.GetUniqueTabName();
inputName.IsShowUsage = true;
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return;
tabName = inputName.TabName;
tabType = inputName.Usage;
}
if (!string.IsNullOrEmpty(tabName))
{
//List対応
ListElement list = null;
if (tabType == MyCommon.TabUsageType.Lists)
{
string rslt = ((TweenMain)this.Owner).TwitterInstance.GetListsApi();
if (!string.IsNullOrEmpty(rslt))
{
MessageBox.Show("Failed to get lists. (" + rslt + ")");
}
using (ListAvailable listAvail = new ListAvailable())
{
if (listAvail.ShowDialog(this) == DialogResult.Cancel) return;
if (listAvail.SelectedList == null) return;
list = listAvail.SelectedList;
}
}
if (!_sts.AddTab(tabName, tabType, list) || !((TweenMain)this.Owner).AddNewTab(tabName, false, tabType, list))
{
string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName);
MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
else
{
//成功
ListTabs.Items.Add(tabName);
SetTabnamesToDialog();
}
}
}
示例5: GetUserIdFromCurPostOrInput
private string GetUserIdFromCurPostOrInput(string caption)
{
string id = "";
if (_curPost != null)
{
id = _curPost.ScreenName;
}
using (InputTabName inputName = new InputTabName())
{
inputName.FormTitle = caption;
inputName.FormDescription = Properties.Resources.FRMessage1;
inputName.TabName = id;
if (inputName.ShowDialog() == DialogResult.OK &&
!string.IsNullOrEmpty(inputName.TabName.Trim()))
{
id = inputName.TabName.Trim();
}
else
{
id = "";
}
}
return id;
}
示例6: RemoveCommand
internal async Task RemoveCommand(string id, bool skipInput)
{
if (!skipInput)
{
using (var inputName = new InputTabName())
{
inputName.FormTitle = "Unfollow";
inputName.FormDescription = Properties.Resources.FRMessage1;
inputName.TabName = id;
if (inputName.ShowDialog(this) != DialogResult.OK)
return;
if (string.IsNullOrWhiteSpace(inputName.TabName))
return;
id = inputName.TabName.Trim();
}
}
using (var dialog = new WaitingDialog(Properties.Resources.RemoveCommandText1))
{
try
{
var task = this.twitterApi.FriendshipsDestroy(id);
await dialog.WaitForAsync(this, task);
}
catch (WebApiException ex)
{
MessageBox.Show(Properties.Resources.FRMessage2 + ex.Message);
return;
}
}
MessageBox.Show(Properties.Resources.FRMessage3);
}
示例7: RemoveCommand
private async Task RemoveCommand(string id, bool skipInput)
{
if (!skipInput)
{
using (var inputName = new InputTabName())
{
inputName.FormTitle = "Unfollow";
inputName.FormDescription = Properties.Resources.FRMessage1;
inputName.TabName = id;
if (inputName.ShowDialog(this) != DialogResult.OK)
return;
if (string.IsNullOrWhiteSpace(inputName.TabName))
return;
id = inputName.TabName.Trim();
}
}
using (var dialog = new WaitingDialog(Properties.Resources.RemoveCommandText1))
{
var task = Task.Run(() => this.tw.PostRemoveCommand(id));
var err = await dialog.WaitForAsync(this, task);
if (!string.IsNullOrEmpty(err))
{
MessageBox.Show(Properties.Resources.FRMessage2 + err);
return;
}
}
MessageBox.Show(Properties.Resources.FRMessage3);
}
示例8: AddTabMenuItem_Click
private void AddTabMenuItem_Click(object sender, EventArgs e)
{
string tabName = null;
MyCommon.TabUsageType tabUsage;
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = _statuses.GetUniqueTabName();
inputName.IsShowUsage = true;
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return;
tabName = inputName.TabName;
tabUsage = inputName.Usage;
}
this.TopMost = SettingDialog.AlwaysTop;
if (!string.IsNullOrEmpty(tabName))
{
//List対応
ListElement list = null;
if (tabUsage == MyCommon.TabUsageType.Lists)
{
using (ListAvailable listAvail = new ListAvailable())
{
if (listAvail.ShowDialog(this) == DialogResult.Cancel) return;
if (listAvail.SelectedList == null) return;
list = listAvail.SelectedList;
}
}
if (!_statuses.AddTab(tabName, tabUsage, list) || !AddNewTab(tabName, false, tabUsage, list))
{
string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName);
MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
//成功
SaveConfigsTabs();
if (tabUsage == MyCommon.TabUsageType.PublicSearch)
{
ListTab.SelectedIndex = ListTab.TabPages.Count - 1;
ListTabSelect(ListTab.TabPages[ListTab.TabPages.Count - 1]);
ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus();
}
if (tabUsage == MyCommon.TabUsageType.Lists)
{
ListTab.SelectedIndex = ListTab.TabPages.Count - 1;
ListTabSelect(ListTab.TabPages[ListTab.TabPages.Count - 1]);
GetTimeline(MyCommon.WORKERTYPE.List, 1, 0, tabName);
}
}
}
}
示例9: AddTabMenuItem_Click
private void AddTabMenuItem_Click(object sender, EventArgs e)
{
string tabName = null;
MyCommon.TabUsageType tabUsage;
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = _statuses.MakeTabName("MyTab");
inputName.IsShowUsage = true;
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return;
tabName = inputName.TabName;
tabUsage = inputName.Usage;
}
this.TopMost = this._cfgCommon.AlwaysTop;
if (!string.IsNullOrEmpty(tabName))
{
//List対応
ListElement list = null;
if (tabUsage == MyCommon.TabUsageType.Lists)
{
using (ListAvailable listAvail = new ListAvailable())
{
if (listAvail.ShowDialog(this) == DialogResult.Cancel) return;
if (listAvail.SelectedList == null) return;
list = listAvail.SelectedList;
}
}
TabModel tab;
switch (tabUsage)
{
case MyCommon.TabUsageType.UserDefined:
tab = new FilterTabModel(tabName);
break;
case MyCommon.TabUsageType.PublicSearch:
tab = new PublicSearchTabModel(tabName);
break;
case MyCommon.TabUsageType.Lists:
tab = new ListTimelineTabModel(tabName, list);
break;
default:
return;
}
if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false))
{
string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName);
MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
//成功
SaveConfigsTabs();
if (tabUsage == MyCommon.TabUsageType.PublicSearch)
{
ListTab.SelectedIndex = ListTab.TabPages.Count - 1;
ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus();
}
if (tabUsage == MyCommon.TabUsageType.Lists)
{
ListTab.SelectedIndex = ListTab.TabPages.Count - 1;
var listTab = (ListTimelineTabModel)this._statuses.Tabs[this._curTab.Text];
this.GetListTimelineAsync(listTab);
}
}
}
}
示例10: SelectTab
private bool SelectTab(out string tabName)
{
do
{
tabName = null;
//振り分け先タブ選択
using (var dialog = new TabsDialog(_statuses))
{
if (dialog.ShowDialog(this) == DialogResult.Cancel) return false;
var selectedTab = dialog.SelectedTab;
tabName = selectedTab == null ? null : selectedTab.TabName;
}
ListTab.SelectedTab.Focus();
//新規タブを選択→タブ作成
if (tabName == null)
{
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = _statuses.MakeTabName("MyTab");
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return false;
tabName = inputName.TabName;
}
this.TopMost = this._cfgCommon.AlwaysTop;
if (!string.IsNullOrEmpty(tabName))
{
var tab = new FilterTabModel(tabName);
if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false))
{
string tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText2, tabName);
MessageBox.Show(tmp, Properties.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
//もう一度タブ名入力
}
else
{
return true;
}
}
}
else
{
//既存タブを選択
return true;
}
}
while (true);
}
示例11: TabRename
public bool TabRename(string origTabName, out string newTabName)
{
//タブ名変更
newTabName = null;
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = origTabName;
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return false;
newTabName = inputName.TabName;
}
this.TopMost = this._cfgCommon.AlwaysTop;
if (!string.IsNullOrEmpty(newTabName))
{
//新タブ名存在チェック
for (int i = 0; i < ListTab.TabCount; i++)
{
if (ListTab.TabPages[i].Text == newTabName)
{
string tmp = string.Format(Properties.Resources.Tabs_DoubleClickText1, newTabName);
MessageBox.Show(tmp, Properties.Resources.Tabs_DoubleClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
}
var tabPage = this.ListTab.TabPages.Cast<TabPage>()
.FirstOrDefault(x => x.Text == origTabName);
// タブ名を変更
if (tabPage != null)
tabPage.Text = newTabName;
_statuses.RenameTab(origTabName, newTabName);
SaveConfigsCommon();
SaveConfigsTabs();
_rclickTabName = newTabName;
return true;
}
else
{
return false;
}
}
示例12: doShowUserStatus
private async Task doShowUserStatus(string id, bool ShowInputDialog)
{
TwitterUser user = null;
if (ShowInputDialog)
{
using (var inputName = new InputTabName())
{
inputName.FormTitle = "Show UserStatus";
inputName.FormDescription = Properties.Resources.FRMessage1;
inputName.TabName = id;
if (inputName.ShowDialog(this) != DialogResult.OK)
return;
if (string.IsNullOrWhiteSpace(inputName.TabName))
return;
id = inputName.TabName.Trim();
}
}
using (var dialog = new WaitingDialog(Properties.Resources.doShowUserStatusText1))
{
var cancellationToken = dialog.EnableCancellation();
try
{
var task = this.twitterApi.UsersShow(id);
user = await dialog.WaitForAsync(this, task);
}
catch (WebApiException ex)
{
if (!cancellationToken.IsCancellationRequested)
MessageBox.Show($"Err:{ex.Message}(UsersShow)");
return;
}
if (cancellationToken.IsCancellationRequested)
return;
}
await this.doShowUserStatus(user);
}
示例13: ShowFriendship
internal async Task ShowFriendship(string id)
{
using (var inputName = new InputTabName())
{
inputName.FormTitle = "Show Friendships";
inputName.FormDescription = Properties.Resources.FRMessage1;
inputName.TabName = id;
if (inputName.ShowDialog(this) != DialogResult.OK)
return;
if (string.IsNullOrWhiteSpace(inputName.TabName))
return;
id = inputName.TabName.Trim();
}
bool isFollowing, isFollowed;
using (var dialog = new WaitingDialog(Properties.Resources.ShowFriendshipText1))
{
var cancellationToken = dialog.EnableCancellation();
try
{
var task = this.twitterApi.FriendshipsShow(this.twitterApi.CurrentScreenName, id);
var friendship = await dialog.WaitForAsync(this, task);
isFollowing = friendship.Relationship.Source.Following;
isFollowed = friendship.Relationship.Source.FollowedBy;
}
catch (WebApiException ex)
{
if (!cancellationToken.IsCancellationRequested)
MessageBox.Show($"Err:{ex.Message}(FriendshipsShow)");
return;
}
if (cancellationToken.IsCancellationRequested)
return;
}
string result = "";
if (isFollowing)
{
result = Properties.Resources.GetFriendshipInfo1 + System.Environment.NewLine;
}
else
{
result = Properties.Resources.GetFriendshipInfo2 + System.Environment.NewLine;
}
if (isFollowed)
{
result += Properties.Resources.GetFriendshipInfo3;
}
else
{
result += Properties.Resources.GetFriendshipInfo4;
}
result = id + Properties.Resources.GetFriendshipInfo5 + System.Environment.NewLine + result;
MessageBox.Show(result);
}
示例14: ShowFriendship
private void ShowFriendship(string id)
{
ShowFriendshipArgs args = new ShowFriendshipArgs();
args.tw = tw;
using (InputTabName inputName = new InputTabName())
{
inputName.FormTitle = "Show Friendships";
inputName.FormDescription = Properties.Resources.FRMessage1;
inputName.TabName = id;
if (inputName.ShowDialog() == DialogResult.OK &&
!string.IsNullOrEmpty(inputName.TabName.Trim()))
{
string ret = "";
args.ids.Add(new ShowFriendshipArgs.FriendshipInfo(inputName.TabName.Trim()));
using (FormInfo _info = new FormInfo(this, Properties.Resources.ShowFriendshipText1,
ShowFriendship_DoWork,
null,
args))
{
_info.ShowDialog();
ret = (string)_info.Result;
}
string result = "";
if (string.IsNullOrEmpty(ret))
{
if (args.ids[0].isFollowing)
{
result = Properties.Resources.GetFriendshipInfo1 + System.Environment.NewLine;
}
else
{
result = Properties.Resources.GetFriendshipInfo2 + System.Environment.NewLine;
}
if (args.ids[0].isFollowed)
{
result += Properties.Resources.GetFriendshipInfo3;
}
else
{
result += Properties.Resources.GetFriendshipInfo4;
}
result = args.ids[0].id + Properties.Resources.GetFriendshipInfo5 + System.Environment.NewLine + result;
}
else
{
result = ret;
}
MessageBox.Show(result);
}
}
}
示例15: ShowFriendship
private async Task ShowFriendship(string id)
{
using (var inputName = new InputTabName())
{
inputName.FormTitle = "Show Friendships";
inputName.FormDescription = Properties.Resources.FRMessage1;
inputName.TabName = id;
if (inputName.ShowDialog(this) != DialogResult.OK)
return;
if (string.IsNullOrWhiteSpace(inputName.TabName))
return;
id = inputName.TabName.Trim();
}
var isFollowing = false;
var isFollowed = false;
using (var dialog = new WaitingDialog(Properties.Resources.ShowFriendshipText1))
{
var cancellationToken = dialog.EnableCancellation();
var task = Task.Run(() => this.tw.GetFriendshipInfo(id, ref isFollowing, ref isFollowed));
var err = await dialog.WaitForAsync(this, task);
if (cancellationToken.IsCancellationRequested)
return;
if (!string.IsNullOrEmpty(err))
{
MessageBox.Show(err);
return;
}
}
string result = "";
if (isFollowing)
{
result = Properties.Resources.GetFriendshipInfo1 + System.Environment.NewLine;
}
else
{
result = Properties.Resources.GetFriendshipInfo2 + System.Environment.NewLine;
}
if (isFollowed)
{
result += Properties.Resources.GetFriendshipInfo3;
}
else
{
result += Properties.Resources.GetFriendshipInfo4;
}
result = id + Properties.Resources.GetFriendshipInfo5 + System.Environment.NewLine + result;
MessageBox.Show(result);
}