本文整理汇总了C#中MSG类的典型用法代码示例。如果您正苦于以下问题:C# MSG类的具体用法?C# MSG怎么用?C# MSG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MSG类属于命名空间,在下文中一共展示了MSG类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ShowStudentInfo
public static void ShowStudentInfo(int id, string ip, int port)
{
Student student = null;
TcpClient eClient = new TcpClient();
try
{
eClient = new TcpClient(ip, port);
using (NetworkStream writerStream = eClient.GetStream())
{
MSG message = new MSG();
message.stat = STATUS.GET_ACCOUNT_BY_ID;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(writerStream, message);
formatter.Serialize(writerStream, id);
student = (Student)formatter.Deserialize(writerStream);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
eClient.Close();
}
if (student == null)
{
throw new ArgumentException(string.Format("Студента з id = {0} не iснує", id));
}
StudentInfoWindow sw = new StudentInfoWindow(string.Format("{0} {1} {2}", student.Lastname, student.Firstname, student.Patronymic),
student.Group, student.Faculty, student.PhoneNumber, student.Email, student.Address, student.AverageMark);
sw.ShowDialog();
}
开发者ID:senioroman4uk,项目名称:courseWork,代码行数:35,代码来源:StudentInfo.cs
示例2: UpdateSpecialities
private void UpdateSpecialities()
{
SpecialityGrid.Items.Clear();
try
{
Configuration config = (App.Current as App).config;
using (TcpClient eClient = new TcpClient(config.IP.ToString(), config.Port))
{
using (NetworkStream writerStream = eClient.GetStream())
{
MSG message = new MSG();
message.stat = STATUS.GET_SPECIALITIES;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(writerStream, message);
if ((bool)formatter.Deserialize(writerStream))
{
_specialityCollection = (List<Speciality>)formatter.Deserialize(writerStream);
}
}
}
}
catch (Exception)
{
throw;
}
foreach (var speciality in _specialityCollection)
{
SpecialityGrid.Items.Add(speciality);
}
}
开发者ID:senioroman4uk,项目名称:courseWork,代码行数:30,代码来源:SpecialityControlPage.xaml.cs
示例3: CheckMessage
void CheckMessage(MSG msg)
{
if (msg.message == ".fire")
{
KeyValuePair<int, int> stat = new KeyValuePair<int, int>(0, 0);
if (!stats.TryGetValue(msg.from, out stat))
{
}
if (bullet == position)
{
stats[msg.from] = new KeyValuePair<int, int>(stat.Key + 1, stat.Value);
irc.SendMessage(msg.to, msg.from + "'s brains are all over the walls!");
irc.KickUser(msg.to, msg.from, "You dead foo...");
Reload();
irc.SendMessage(msg.to, "Reloading");
return;
}
else
{
stats[msg.from] = new KeyValuePair<int, int>(stat.Key, stat.Value + 1);
irc.SendMessage(msg.to, msg.from + " is lucky...this time.");
position++;
}
}
else if (msg.message == ".reload")
{
Reload();
irc.SendMessage(msg.to, "Reloading");
}
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:31,代码来源:Roulette.cs
示例4: InitStudentTable
public List<Student> InitStudentTable()
{
try
{
Configuration config = (App.Current as App).config;
using (TcpClient eClient = new TcpClient(config.IP.ToString(), config.Port))
{
using (NetworkStream writerStream = eClient.GetStream())
{
MSG message = new MSG();
message.stat = STATUS.GET_STUDENTS;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(writerStream, message);
formatter.Serialize(writerStream, (App.Current as App).instr.InstructorId);
bool fl = (bool)formatter.Deserialize(writerStream);
if (fl)
{
_studentsCollection = (List<Student>)formatter.Deserialize(writerStream);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Помилка", MessageBoxButton.OK, MessageBoxImage.Error);
}
return _studentsCollection;
}
开发者ID:senioroman4uk,项目名称:courseWork,代码行数:28,代码来源:StudentControlPage.xaml.cs
示例5: AuthedCommand
public override void AuthedCommand(MSG msg, int operLevel)
{
try
{
if (operLevel == 0)
{
msg.message = msg.message.Substring(msg.message.IndexOf(' ') + 1);
if (msg.message.ToLower().StartsWith("register"))
{
lastOper = msg.from;
irc.SendMessage("nickserv", msg.message);
if (msg.message.Split(' ').Length > 1)
logins[msg.to] = msg.message.Split(' ')[1];
}
else if (msg.message.ToLower().StartsWith("identify"))
{
lastOper = msg.from;
irc.SendMessage("nickserv", msg.message);
if (msg.message.Split(' ').Length > 1)
logins[msg.to] = msg.message.Split(' ')[1];
}
}
}
catch { }
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:25,代码来源:NickServLogin.cs
示例6: RegisterButton_Click
private void RegisterButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (PasswordBox.Password != PasswordRepeatBox.Password)
throw new Exception("Паролі не співпадають");
Instructor instructor = new Instructor(LoginBox.Text, PasswordBox.Password, FirstNameBox.Text, LastNameBox.Text,
SecondNameBox.Text);
Configuration config = (App.Current as App).config;
using (TcpClient eClient = new TcpClient(config.IP.ToString(), config.Port))
{
using (NetworkStream writerStream = eClient.GetStream())
{
MSG message = new MSG();
message.stat = STATUS.ADD_INSTRUCTOR;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(writerStream, message);
formatter.Serialize(writerStream, instructor);
bool fl = (bool)formatter.Deserialize(writerStream);
if (!fl)
MessageBox.Show("Помилка додавання облікового запису");
else
{
NavigationService nav = NavigationService.GetNavigationService(this);
nav.Navigate(new System.Uri("StartPage.xaml", UriKind.RelativeOrAbsolute));
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
开发者ID:senioroman4uk,项目名称:courseWork,代码行数:35,代码来源:RegisterPage.xaml.cs
示例7: Main
static void Main ()
{
InstructionsForm instructionsForm = new InstructionsForm ();
instructionsForm.Show ();
NativeWindow nw = new NativeWindow ();
CreateParams cp = new CreateParams ();
cp.Caption = "bug #80817";
cp.X = 100;
cp.Y = 100;
cp.Width = 400;
cp.Height = 600;
cp.ClassStyle = (int) (ClassStyle.CS_VREDRAW | ClassStyle.CS_HREDRAW);
cp.Style = (int) WindowStyles.WS_OVERLAPPEDWINDOW;
// create the window.
nw.CreateHandle (cp);
ShowWindow (nw.Handle, WindowPlacementFlags.SW_SHOWNORMAL);
UpdateWindow (nw.Handle);
MSG msg = new MSG ();
while (GetMessage (ref msg, 0, 0, 0) > 0) {
TranslateMessage (ref msg);
DispatchMessage (ref msg);
}
}
开发者ID:mono,项目名称:gert,代码行数:29,代码来源:MainForm.cs
示例8: InitGroupTable
public Dictionary<GroupRow, int> InitGroupTable()
{
_groupsCollection.Clear();
foreach (var faculty in EnumDecoder.StringToFaculties)
{
try
{
Configuration config = (App.Current as App).config;
using (TcpClient eClient = new TcpClient(config.IP.ToString(), config.Port))
{
using (NetworkStream writerStream = eClient.GetStream())
{
MSG message = new MSG();
message.stat = STATUS.GET_GROUP_BY_FACULTY;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(writerStream, message);
formatter.Serialize(writerStream, faculty.Value);
bool fl = (bool)formatter.Deserialize(writerStream);
if (fl)
{
foreach (var group in (Dictionary<string, int>)formatter.Deserialize(writerStream))
{
_groupsCollection.Add(new GroupRow(group.Key, faculty.Key), group.Value);
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Помилка", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
return _groupsCollection;
}
开发者ID:senioroman4uk,项目名称:courseWork,代码行数:35,代码来源:GroupControlPage.xaml.cs
示例9: YoutubeSearch
void YoutubeSearch(object o)
{
try
{
MSG msg = new MSG(((MSG)o).ToString());
WebClient wc = new WebClient();
string str = wc.DownloadString("http://gdata.youtube.com/feeds/api/videos?fields-language=r2&q=" + Uri.EscapeUriString(msg.message.Substring(".youtube ".Length)) + "&fields=entry(media:group(media:title,media:content[@type='application/x-shockwave-flash'](@url)))&max-results=3");
XmlDocument doc = new XmlDocument();
str = str.Substring(str.IndexOf('>') + 1).Replace("media:", "");
str = "<feed>" + str.Substring(str.IndexOf('>') + 1);
doc.LoadXml(str);
XmlNodeList nodeList = doc.DocumentElement.SelectNodes("//group");
foreach (XmlNode node in nodeList)
{
if (node.ChildNodes[0].Attributes["url"] != null && !string.IsNullOrEmpty(node.ChildNodes[1].InnerText))
{
string url = node.ChildNodes[0].Attributes["url"].Value;
url = url.Substring(0, url.IndexOf('?'));
url = url.Substring(url.Length - (11));
irc.SendMessage(msg.to, "(" + msg.message.Substring(".youtube ".Length) + ") * http://www.youtube.com/watch?v=" + url + " * - " + node.ChildNodes[1].InnerText);
}
}
}
catch { }
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:25,代码来源:Search.cs
示例10: CheckMessage
void CheckMessage(MSG msg)
{
if (msg.message.StartsWith(".udict") && msg.message.Split(' ').Length > 1)
{
Thread t = new Thread(new ParameterizedThreadStart(GetUDef));
t.Start(msg);
}
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:8,代码来源:UDict.cs
示例11: AuthedCommand
public override void AuthedCommand(MSG msg, int operLevel)
{
msg.message = msg.message.Substring(msg.message.IndexOf(' ') + 1);
if (msg.message.StartsWith("add ") && msg.message.Split(' ').Length == 3)
{
oplist.Add(msg.message.Split(' ')[1], msg.message.Split(' ')[2]);
EncFile.AppendText(server.Data + Path.DirectorySeparatorChar + "autoop.db", msg.message.Split(' ')[1] + " " + msg.message.Split(' ')[2] + "\n");
}
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:9,代码来源:Class1.cs
示例12: irc_OnMSGRecvd
void irc_OnMSGRecvd(MSG msg)
{
if (msg.message.ToLower().StartsWith(".decode "))
{
lastMeme[msg.fromUser + '@' + msg.fromHost] = DateTime.Now;
Thread t = new Thread(new ParameterizedThreadStart(GenerateImage));
t.Start(msg);
}
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:9,代码来源:BrakMeme.cs
示例13: AuthedCommand
public virtual void AuthedCommand(MSG msg, int operLevel)
{
msg.message = msg.message.Substring(msg.message.IndexOf(' ') + 1);
if (msg.message.StartsWith("value "))
{
string s = GetPrivateValue(msg.message.Substring(msg.message.IndexOf(' ') + 1));
if (!string.IsNullOrEmpty(s))
irc.SendMessage(msg.from, msg.message.Substring(msg.message.IndexOf(' ') + 1) + " = " + s);
}
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:10,代码来源:Module.cs
示例14: irc_OnPMRecvd
void irc_OnPMRecvd(MSG msg)
{
//op channel pass
if (msg.message.StartsWith("op ") && msg.message.Split(' ').Length == 3)
{
if (oplist.ContainsKey(msg.from) && oplist[msg.from] == msg.message.Split(' ')[2])
{
irc.SetChannelModes(msg.message.Split(' ')[1], "+o", msg.from);
}
}
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:11,代码来源:Class1.cs
示例15: messageEnabled
static bool messageEnabled(MSG msg)
{
// WITHDRAWAL: INVALID_FROM_ACCT MAX_DAILY_WITHDRAWAL INVALID_ACCT_BALANCE
// TRANSFER: INVALID_FROM_ACCT INVALID_TO_ACCT SAME_ACCOUNT INVALID_ACCT_BALANCE
return
msg != MSG.MAX_DAILY_WITHDRAWAL && msg != MSG.INVALID_FROM_ACCT && msg != MSG.INVALID_TO_ACCT && msg != MSG.SAME_ACCOUNT && msg != MSG.INVALID_ACCT_BALANCE ||
msg == MSG.INVALID_FROM_ACCT ||
msg == MSG.MAX_DAILY_WITHDRAWAL && !Session.hasMessage(MSG.INVALID_FROM_ACCT) ||
msg == MSG.INVALID_TO_ACCT && !Session.hasMessage(MSG.INVALID_FROM_ACCT) ||
msg == MSG.SAME_ACCOUNT && !Session.hasMessage(MSG.INVALID_FROM_ACCT) && !Session.hasMessage(MSG.INVALID_TO_ACCT) ||
msg == MSG.INVALID_ACCT_BALANCE && !Session.hasMessage(MSG.MAX_DAILY_WITHDRAWAL) && !Session.hasMessage(MSG.INVALID_TO_ACCT) && !Session.hasMessage(MSG.SAME_ACCOUNT);
}
开发者ID:BackupTheBerlios,项目名称:nmodelrs-svn,代码行数:12,代码来源:Test.cs
示例16: Login_Click
private void Login_Click(object sender, RoutedEventArgs e)
{
Configuration config = (App.Current as App).config;
TcpClient eClient = new TcpClient();
try
{
eClient = new TcpClient(config.IP.ToString(), config.Port);
using (NetworkStream writerStream = eClient.GetStream())
{
MSG message = new MSG();
message.stat = STATUS.LOGIN;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(writerStream, message);
formatter.Serialize(writerStream, LoginBox.Text);
formatter.Serialize(writerStream, PasswordBox.Password);
bool fl = (bool)formatter.Deserialize(writerStream);
if (fl)
{
Account ac = (Account)formatter.Deserialize(writerStream);
if (ac != null)
{
Instructor st;
if (ac is Instructor)
{
st = (Instructor)ac;
config.Login = LoginBox.Text;
config.Password = PasswordBox.Password;
(App.Current as App).SaveConfig();
(App.Current as App).instr = st;
NavigationService nav = NavigationService.GetNavigationService(this);
nav.Navigate(new System.Uri("MainWindow.xaml", UriKind.RelativeOrAbsolute));
}
else
{
MessageBox.Show("Невірний тип облікового запису");
}
}
}
else
{
MessageBox.Show("Невірна комбінація");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
eClient.Close();
}
}
开发者ID:senioroman4uk,项目名称:courseWork,代码行数:53,代码来源:StartPage.xaml.cs
示例17: ThreadPreprocessMessageMethod
private void ThreadPreprocessMessageMethod(ref MSG msg, ref bool handled)
{
if (!handled)
{
if (msg.message == HotKeyWinApi.WmHotKey
&& (int)(msg.wParam) == id)
{
OnHotKeyPressed();
handled = true;
}
}
}
开发者ID:mok-aster,项目名称:NasneCapture,代码行数:12,代码来源:Hotkey.cs
示例18: irc_OnMSGRecvd
void irc_OnMSGRecvd(MSG msg)
{
if (msg.message.StartsWith(".youtube "))
{
Thread t = new Thread(new ParameterizedThreadStart(YoutubeSearch));
t.Start(msg);
}
else if (msg.message.StartsWith(".google ") || msg.message.StartsWith(".g "))
{
//Thread t = new Thread(new ParameterizedThreadStart(GoogleSearch));
//t.Start(msg);
}
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:13,代码来源:Search.cs
示例19: OKButton_Click
private void OKButton_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(SubjectNameBox.Text))
MessageBox.Show("Потрібно вказати назву предмета");
else
{
if (_cw == CurrentWindow.EditSubject && _oldSubjectName == SubjectNameBox.Text)
{
this.Close();
}
else
{
Configuration config = (App.Current as App).config;
TcpClient eClient = new TcpClient();
try
{
eClient = new TcpClient(config.IP.ToString(), config.Port);
using (NetworkStream writerStream = eClient.GetStream())
{
MSG message = new MSG();
message.stat = _cw == CurrentWindow.AddSubject ? STATUS.ADD_SUBJECT : STATUS.EDIT_SUBJECT;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(writerStream, message);
formatter.Serialize(writerStream, SubjectNameBox.Text);
if (_cw == CurrentWindow.EditSubject)
formatter.Serialize(writerStream, _subjectId);
bool fl = (bool)formatter.Deserialize(writerStream);
if (!fl)
{
MessageBox.Show("Предмет вже існує", string.Concat("Помилка ",
_cw == CurrentWindow.AddSubject ? "додавання" : "редагування", " предмета"), MessageBoxButton.OK,
MessageBoxImage.Error);
}
else
{
this.Close();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
eClient.Close();
}
}
}
}
开发者ID:senioroman4uk,项目名称:courseWork,代码行数:51,代码来源:AddSubjectWindow.xaml.cs
示例20: ProcessEvent
public bool ProcessEvent (IntPtr callref, IntPtr eventref, IntPtr handle, uint kind, ref MSG msg) {
switch (kind) {
case kEventHIObjectConstruct:
IntPtr v = IntPtr.Zero;
GetEventParameter (eventref, (uint)1751740265, (uint)1751740258, IntPtr.Zero, 4, IntPtr.Zero, ref v);
return false;
case kEventHIObjectInitialize:
CallNextEventHandler (callref, eventref);
return false;
case kEventHIObjectDestruct:
return false;
}
return false;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:14,代码来源:HIObjectHandler.cs
注:本文中的MSG类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论