コード例 #1
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
 /// <summary>
 /// 点击事件:退出
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void picBox_exit_Click(object sender, EventArgs e)
 {
     if (MyMessageBox.Show(ResourceCulture.GetString("sure_to_quit"), ResourceCulture.GetString("quit"),
                           MyMessageBox.MyMessageBoxButtons.YesNo)
         == System.Windows.Forms.DialogResult.Yes)
     {
         Application.Exit();
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
 private void MyIMClient_Connecting(ConnectingEventArgs e)
 {
     if (lbl_imStatus.InvokeRequired)
     {
         this.Invoke(new FlushConnectingClient(MyIMClient_Connecting), e);
     }
     else
     {
         lbl_imStatus.Text = ResourceCulture.GetConnectingString(e.CurTime);
     }
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
 private void MyIMClient_ConnectionClosed()
 {
     if (lbl_imStatus.InvokeRequired)
     {
         this.Invoke(new FlushClient(MyIMClient_ConnectionClosed));
     }
     else
     {
         lbl_imStatus.Text = ResourceCulture.GetString("im_offline");
     }
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
 private void ChangeIPLabel()
 {
     if (this.InvokeRequired)
     {
         FlushClient client = new FlushClient(ChangeIPLabel);
         this.Invoke(client);
     }
     else
     {
         lbl_loc.Text = ResourceCulture.GetLocationString(LoginStatus.UserIP);
     }
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
        private void LogoutSafe()
        {
            if (this.InvokeRequired)
            {
                LogoutSafeHandler handler = new LogoutSafeHandler(LogoutSafe);
                this.Invoke(handler);
            }
            else
            {
                //状态栏显示
                lbl_status.Text = ResourceCulture.GetString("please_login");

                //左侧按钮禁用
                panel_selfCheck.Enabled = false;
                panel_contacts.Enabled  = false;
                panel_selfInfo.Enabled  = false;
                panel_logout.Enabled    = false;
                picBox_login.Enabled    = true;

                PanelNotClicked();

                //picBox_check.Enabled = false;
                //picBox_message.Enabled = false;
                //picBox_selfInfo.Enabled = false;
                //picBox_logout.Enabled = false;
                //picBox_login.Enabled = true;

                //picBox_check.Image = Resources.查看自检_灰_;
                //picBox_message.Image = Resources.联系人_灰_;
                ////LoginStatus.UserInfo = new Model.DoctorModel() { Name = "tony" };
                //picBox_selfInfo.Image = Resources.个人信息_灰_;
                //picBox_logout.Image = Resources.注销_灰_;
                //picBox_login.Image = Resources.登录;

                //右侧Panel清除所有
                panel.Controls.Clear();

                if (selfInfoForm != null)
                {
                    selfCheckForm.Close();
                    selfInfoForm.Close();
                    contactsForm.Close();
                }

                MyIMClient.ConnectionEstablished -= MyIMClient_ConnectionEstablished;
                MyIMClient.ConnectionSuspended   -= MyIMClient_ConnectionSuspended;
                MyIMClient.Connecting            -= MyIMClient_Connecting;
            }
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
        /// <summary>
        /// 点击事件:注销
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void picBox_logout_Click(object sender, EventArgs e)
        {
            if (MyMessageBox.Show(ResourceCulture.GetString("sure_to_logout"), ResourceCulture.GetString("logout"),
                                  MyMessageBox.MyMessageBoxButtons.YesNo)
                == System.Windows.Forms.DialogResult.Yes)
            {
                //清除保存的登录状态
                LoginStatus.Clear();

                //关闭即时通讯
                MyIMClient.Close();

                //清除panel中的内容
                panel.Controls.Clear();
            }
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
 private void MyIMClient_ConnectionSuspended(ConnectionSuspendedEventArgs e)
 {
     if (lbl_imStatus.InvokeRequired)
     {
         this.Invoke(new FlushConnectionSuspendedClient(MyIMClient_ConnectionSuspended), e);
     }
     else
     {
         lbl_imStatus.Text = ResourceCulture.GetString("im_connection_failed");
         if (e.IsPushedAside)
         {
             if (MyMessageBox.Show(ResourceCulture.GetString("pushed_aside"), ResourceCulture.GetString("login_again"),
                                   MyMessageBox.MyMessageBoxButtons.YesNo)
                 == DialogResult.Yes)
             {
                 //尝试重连
                 MyIMClient.ConnectAsync();
             }
         }
     }
 }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
        /// <summary>
        /// 切换文字
        /// </summary>
        private void InitLanguage()
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new FlushClient(InitLanguage));
            }
            else
            {
                //字号
                Font font = ResourceCulture.GetMainFormLabelFont();
                lbl_logout.Font   = font;
                lbl_register.Font = font;
                lbl_settings.Font = font;
                lbl_quit.Font     = font;

                //“登录”的Label的位置
                lbl_status.SizeChanged    += lbl_status_SizeChanged;
                lbl_selfCheck.SizeChanged += lbl_selfCheck_SizeChanged;
                lbl_selfInfo.SizeChanged  += lbl_selfInfo_SizeChanged;
                lbl_contacts.SizeChanged  += lbl_contacts_SizeChanged;

                lbl_about.Text     = ResourceCulture.GetString("about");
                lbl_contacts.Text  = ResourceCulture.GetString("contacts");
                lbl_selfCheck.Text = ResourceCulture.GetString("self_check");
                lbl_selfInfo.Text  = ResourceCulture.GetString("self_info");

                lbl_settings.Text = ResourceCulture.GetString("settings");
                lbl_logout.Text   = ResourceCulture.GetString("logout");
                lbl_register.Text = ResourceCulture.GetString("register");
                lbl_quit.Text     = ResourceCulture.GetString("quit");

                lbl_imStatus.Text = ResourceCulture.GetString("im_offline");
                lbl_loc.Text      = ResourceCulture.GetLocationString(LoginStatus.UserIP);

                if (!LoginStatus.Login)
                {
                    lbl_status.Text = ResourceCulture.GetString("please_login");
                }
            }
        }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: TonyPod/MyIC
        /// <summary>
        /// 窗口载入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            //设置语言环境
            ResourceCulture.SetCurrentCulture(Settings.Default.Language);

            //初始化窗口语言
            InitLanguage();

            //窗口标题栏
            this.Text = ResourceCulture.GetString("MainForm_text");

            //载入时为用户登出状态
            LogoutSafe();

            //注册登录信息改变时事件
            LoginStatus.LoginStatusChanged += LoginStatus_LoginStatusChanged;

            //地理信息改变事件
            LoginStatus.IPLocationChanged += LoginStatus_IPLocationChanged;

            MyIMClient.ConnectionClosed += MyIMClient_ConnectionClosed;

            //语言改变事件
            ResourceCulture.LanguageChanged += ResourceCulture_LanguageChanged;

            //每5分钟更新一下IP位置信息
            LoginStatus.RefreshIP();
            Timer timer = new Timer();

            timer.Enabled = true;
            //timer.Interval = 5 * 60 * 1000;
            timer.Interval = 5 * 1000;
            timer.Tick    += (a, b) => { LoginStatus.RefreshIP(); };
            timer.Start();

            lbl_loc.Text = ResourceCulture.GetString("unable_to_locate");
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: TonyPod/MyIC
 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     MyMessageBox.Show(ResourceCulture.GetString("unhandled_exception"));
     WriteToLog(e.ToString());
 }