本文整理汇总了C#中Gtk.AppendText方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.AppendText方法的具体用法?C# Gtk.AppendText怎么用?C# Gtk.AppendText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.AppendText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillComboBoxEntry
/// <summary>
/// Fills the combo box entry.
/// </summary>
/// <param name='combo'>
/// Combo.
/// </param>
/// <param name='items'>
/// Items.
/// </param>
/// <param name='currentValue'>
/// Current value.
/// </param>
/// <param name='editable'>
/// Editable.
/// </param>
public static void FillComboBoxEntry(Gtk.ComboBoxEntry combo, List<string> items, string currentValue,bool isDecimal,bool editable)
{
combo.Model = new ListStore(typeof(string));
var resultItems = new List<string>();
if (editable)
{
// searching for value
var present = false;
foreach (var value in items)
{
if (
(isDecimal && (SupportMethods.ToDecimal(value) == SupportMethods.ToDecimal(currentValue)))
||
(!isDecimal && (value == currentValue))
)
{
present = true;
break;
}
}
// adding missing to first pos
if (!present)
{
resultItems.Add(currentValue);
}
foreach (var value in items)
resultItems.Add(value);
} else
{
resultItems.Add(currentValue);
}
var index = 0;
foreach (var value in resultItems)
{
combo.AppendText(value);
if (
(isDecimal && (SupportMethods.ToDecimal(value) == SupportMethods.ToDecimal(currentValue)))
||
(!isDecimal && (value == currentValue))
)
{
combo.Active = index;
}
index++;
}
}
示例2: FillComboBox
/// <summary>
/// Fills the combo box.
/// </summary>
/// <param name='combo'>
/// Combo.
/// </param>
/// <param name='items'>
/// Items.
/// </param>
/// <param name='editable'>
/// Editable.
/// </param>
/// <param name='currentValue'>
/// Current value.
/// </param>
public static void FillComboBox(Gtk.ComboBox combo, Type enumType, bool editable, int currentValue)
{
// clear combo
combo.Model = new ListStore(typeof(string));
// adding all items
var index=0;
foreach (var item in Enum.GetNames(enumType))
{
if (editable || (index == currentValue))
{
combo.AppendText(item);
if (!editable) combo.Active = 0;
else
if (index == currentValue) combo.Active = index;
}
index++;
}
}
示例3: FillComboboxWithStrings
private void FillComboboxWithStrings(Gtk.ComboBox box, string[] strings)
{
((Gtk.ListStore)(box.Model)).Clear();
for (int i=0;i<strings.Length;i++){
box.AppendText(strings[i]);
}
box.Active=0;
box.Sensitive=(strings.Length>1);
}
示例4: LoadHostList
protected void LoadHostList(Gtk.ComboBox HostList)
{
ClearList(HostList);
try
{
string[] hostsArr = System.IO.Directory.GetDirectories("/sys/class/scsi_host");
foreach(string hostName in hostsArr)
{
if(!System.IO.File.Exists(hostName + "/scan")) continue;
HostList.AppendText(System.IO.Path.GetFileName(hostName));
}
HostList.Active = 0;
}
catch { }
}
示例5: LoadDevList
protected void LoadDevList(Gtk.ComboBox DeviceList)
{
ClearList(DeviceList);
try
{
string[] devArr = System.IO.Directory.GetFiles("/dev");
foreach(string devPath in devArr)
{
string devName = System.IO.Path.GetFileName(devPath);
if(devName.Length < 3) continue;
if(devName.Substring(0,2) != "sd") continue;
DeviceList.AppendText(devName);
}
DeviceList.Active = 0;
}
catch { }
}