m_icon = new Gtk.StatusIcon();
m_icon.File = "./your_icon.png";
m_icon.PopupMenu += new PopupMenuHandler( delegate( object o, PopupMenuArgs args ) {
Console.WriteLine( "click" );
} );
這樣就可以動了。
當在 Icon 按下右鍵時,就會觸發 PopupMenu 事件。
m_icon = new Gtk.StatusIcon();
m_icon.File = "./your_icon.png";
m_icon.PopupMenu += new PopupMenuHandler( delegate( object o, PopupMenuArgs args ) {
Console.WriteLine( "click" );
} );
That's probably because you do not trust the site you are connecting to. Note that a default installation of Mono doesn't trust anyone!
Unhandled Exception: System.EntryPointNotFoundException: HideCaret
at (wrapper managed-to-native) ICSharpCode.TextEditor.Caret:HideCaret (intptr)
at ICSharpCode.TextEditor.Caret.DisposeCaret () [0x00000]
at ICSharpCode.TextEditor.Caret.RecreateCaret () [0x00000]
at ICSharpCode.TextEditor.TextArea.OptionsChanged () [0x00000]
at ICSharpCode.TextEditor.TextArea..ctor (ICSharpCode.TextEditor.TextEditorControl motherTextEditorControl, ICSharpCode.TextEditor.TextAreaControl motherTextAreaControl) [0x00000]
at (wrapper remoting-invoke-with-check) ICSharpCode.TextEditor.TextArea:.ctor (ICSharpCode.TextEditor.TextEditorControl,ICSharpCode.TextEditor.TextAreaControl)
at ICSharpCode.TextEditor.TextAreaControl..ctor (ICSharpCode.TextEditor.TextEditorControl motherTextEditorControl) [0x00000]
at (wrapper remoting-invoke-with-check) ICSharpCode.TextEditor.TextAreaControl:.ctor (ICSharpCode.TextEditor.TextEditorControl)
at ICSharpCode.TextEditor.TextEditorControl..ctor () [0x00000]
at (wrapper remoting-invoke-with-check) ICSharpCode.TextEditor.TextEditorControl:.ctor ()
at MiniCSharpLab.Form1.InitializeComponent () [0x00000]
at MiniCSharpLab.Form1..ctor () [0x00000]
at (wrapper remoting-invoke-with-check) MiniCSharpLab.Form1:.ctor ()
at MiniCSharpLab.Program.Main (System.String[] args) [0x00000]
class FileSystemWalker
{
private string _path = "";
public FileSystemWalker(string path)
{
_path = path;
}
public IEnumerable<FileSystemInfo> Walk()
{
foreach( string d in Directory.GetDirectories( _path ) )
{
DirectoryInfo di = new DirectoryInfo( d );
yield return di;
FileSystemWalker walker = new FileSystemWalker(Path.Combine(_path, d));
foreach (FileSystemInfo fsi in walker.Walk())
yield return fsi;
}
foreach (string f in Directory.GetFiles( _path ) )
{
FileInfo fi = new FileInfo(f);
yield return fi;
}
}
}
class Program
{
static void Main(string[] args)
{
foreach(FileSystemInfo fsi in new FileSystemWalker(@"f:\").Walk())
{
if( fsi.Attributes == FileAttributes.Directory )
Console.WriteLine( "[D]{0}", fsi.FullName );
else
Console.WriteLine("[F]{0}", fsi.FullName);
}
Console.ReadLine();
}
}