本文整理汇总了C#中Window.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Dispose方法的具体用法?C# Window.Dispose怎么用?C# Window.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Window
的用法示例。
在下文中一共展示了Window.Dispose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowMessage
public static void ShowMessage(String messageString)
{
Window parentWindow = new Window ("提示");
MessageDialog messageDialog = new MessageDialog (parentWindow,
DialogFlags.Modal,
MessageType.Info,
ButtonsType.Close, messageString);
messageDialog.Run ();
messageDialog.Destroy ();
parentWindow.Dispose ();
}
示例2: CreateUser
/// <summary>
/// Creates a user using OAuth
/// </summary>
private void CreateUser()
{
OAuthAccessToken userKey = new OAuthAccessToken();
Profile defaultProfile = new Profile();
TwitterService service = new TwitterService(appKey.Token, appKey.TokenSecret);
OAuthRequestToken requestToken = service.GetRequestToken();
Uri uri = service.GetAuthorizationUri(requestToken);
Process.Start(uri.ToString());
service.AuthenticateWith(appKey.Token, appKey.TokenSecret);
Window auth = new Window(1, ScreenInfo.WindowWidth, 0, 0);
Curses.Echo = true;
auth.Add("Please input the authentication number: ");
auth.Refresh();
string verifier = auth.GetString(7);
userKey = service.GetAccessToken(requestToken, verifier);
defaultProfile.Active = true;
defaultProfile.Default = true;
defaultProfile.UserKey = userKey.Token;
defaultProfile.UserSecret = userKey.TokenSecret;
defaultProfile.Name = userKey.ScreenName;
profiles.Add(defaultProfile);
Curses.Echo = false;
auth.Dispose();
WriteFile();
}
示例3: AddProfile
public void AddProfile()
{
ScreenDraw.Tweets.Clear();
ScreenDraw.Tweets.Refresh();
OAuthAccessToken userKey = new OAuthAccessToken();
OAuthRequestToken requestToken = User.Account.GetRequestToken();
Window auth = new Window(1, ScreenInfo.WindowWidth, 3, 0);
Uri uri = User.Account.GetAuthorizationUri(requestToken);
Process.Start(uri.ToString());
Curses.Echo = true;
auth.Add("Please input the authentication number: ");
auth.Refresh();
string verifier = auth.GetString(7);
userKey = User.Account.GetAccessToken(requestToken, verifier);
Profile newProfile = new Profile();
newProfile.Name = userKey.ScreenName;
newProfile.UserKey = userKey.Token;
newProfile.UserSecret = userKey.TokenSecret;
if (ProfileExists(newProfile))
{
ScreenDraw.ShowMessage("User already exists in the list");
}
else
{
profiles.Add(newProfile);
WriteFile();
ScreenDraw.ShowMessage("User added");
}
Curses.Echo = false;
auth.Dispose();
ScreenDraw draw = new ScreenDraw();
draw.ShowTimeline();
}
示例4: IsMissingArgs
public static bool IsMissingArgs(string command)
{
try
{
bool checker = command.Split(' ')[1].Length != 2;
}
catch (IndexOutOfRangeException)
{
Window argsMiss = new Window(1, ScreenInfo.WindowWidth, 0, 0);
argsMiss.Add(" Error: input was not complete.\n");
argsMiss.Add(" You probaby didn't use enough args");
argsMiss.Refresh();
argsMiss.GetChar();
argsMiss.Dispose();
return true;
}
return false;
}
示例5: watershedExample
//.........这里部分代码省略.........
var key = Cv2.WaitKey(0);
if ((char)key == 27) // ESC
{
break;
}
if ((char)key == 'r') // Reset
{
markerMask = new Mat(markerMask.Size(), markerMask.Type(), s: Scalar.All(0));
src.CopyTo(srcCopy);
sourceWindow.Image = srcCopy;
}
if ((char)key == 'w' || (char)key == ' ') // Apply watershed
{
Point[][] contours; //vector<vector<Point>> contours;
HiearchyIndex[] hierarchyIndexes; //vector<Vec4i> hierarchy;
Cv2.FindContours(
markerMask,
out contours,
out hierarchyIndexes,
mode: ContourRetrieval.CComp,
method: ContourChain.ApproxSimple);
if (contours.Length == 0)
{
continue;
}
var markers = new Mat(markerMask.Size(), MatType.CV_32S, s: Scalar.All(0));
var componentCount = 0;
var contourIndex = 0;
while ((contourIndex >= 0))
{
Cv2.DrawContours(
markers,
contours,
contourIndex,
color: Scalar.All(componentCount+1),
thickness: -1,
lineType: LineType.Link8,
hierarchy: hierarchyIndexes,
maxLevel: int.MaxValue);
componentCount++;
contourIndex = hierarchyIndexes[contourIndex].Next;
}
if (componentCount == 0)
{
continue;
}
var colorTable = new List<Vec3b>();
for (var i = 0; i < componentCount; i++)
{
var b = rnd.Next(0, 255); //Cv2.TheRNG().Uniform(0, 255);
var g = rnd.Next(0, 255); //Cv2.TheRNG().Uniform(0, 255);
var r = rnd.Next(0, 255); //Cv2.TheRNG().Uniform(0, 255);
colorTable.Add(new Vec3b((byte)b, (byte)g, (byte)r));
}
Cv2.Watershed(src, markers);
var watershedImage = new Mat(markers.Size(), MatType.CV_8UC3);
// paint the watershed image
for (var i = 0; i < markers.Rows; i++)
{
for (var j = 0; j < markers.Cols; j++)
{
var idx = markers.At<int>(i, j);
if (idx == -1)
{
watershedImage.Set(i, j, new Vec3b(255, 255, 255));
}
else if (idx <= 0 || idx > componentCount)
{
watershedImage.Set(i, j, new Vec3b(0, 0, 0));
}
else
{
watershedImage.Set(i, j, colorTable[idx - 1]);
}
}
}
watershedImage = watershedImage * 0.5 + imgGray * 0.5;
Cv2.ImShow("Watershed Transform", watershedImage);
Cv2.WaitKey(1); //do events
}
}
sourceWindow.Dispose();
Cv2.DestroyAllWindows();
src.Dispose();
}