📄 mainform.cs
字号:
{
try
{
HotKey key = new HotKey(this.CurrentUser.Configuration.UserSetting.MainWindowSetting.HotKeyShowMainwindowFinal);
this._hotKey = key.LParam;
if (key.IsValid)
{
ClientLogger.WriteGeneral("注册显示主窗口热键");
key.Register(base.Handle, 0);
}
}
catch
{
}
}
private void TryLoadSkin()
{
string currentSkinName = (string) this.CurrentUser.Configuration.UserSetting.SkinSetting.CurrentSkinName;
if (!string.IsNullOrEmpty(currentSkinName))
{
for (int i = 0; i < ThemeManager.AvaibleThemes.Length; i++)
{
if (currentSkinName == ThemeManager.AvaibleThemes[i])
{
ThemeManager.ApplyTheme(currentSkinName);
return;
}
}
}
if (ThemeManager.AvaibleThemes.Length > 0)
{
ThemeManager.ApplyTheme(ThemeManager.AvaibleThemes[0]);
}
}
private void TryLoadWindowsSetting()
{
try
{
Imps.Client.Utils.Win32.RECT rect2;
Imps.Client.Core.MainWindowSetting mainWindowSetting = this.CurrentUser.Configuration.UserSetting.MainWindowSetting;
int lastPostionX = 0;
int lastPostionY = 0;
int lastHeight = mainWindowSetting.LastHeight;
int lastWidth = mainWindowSetting.LastWidth;
if ((lastWidth < this.MinimumSize.Width) || (lastHeight < this.MaximumSize.Height))
{
lastWidth = 360;
lastHeight = 0x267;
IntPtr desktopWindow = Imps.Client.Utils.Win32.NativeMethods.GetDesktopWindow();
if (desktopWindow != IntPtr.Zero)
{
Imps.Client.Utils.Win32.RECT rect;
Imps.Client.Utils.Win32.NativeMethods.GetWindowRect(desktopWindow, out rect);
lastPostionX = rect.Width - lastWidth;
lastPostionY = (rect.Height - lastHeight) / 4;
}
}
else
{
lastPostionX = mainWindowSetting.LastPostionX;
lastPostionY = mainWindowSetting.LastPostionY;
}
base.StartPosition = FormStartPosition.Manual;
rect2.Left = lastPostionX;
rect2.Top = lastPostionY;
rect2.Right = lastPostionX + lastWidth;
rect2.Bottom = lastPostionY + lastHeight;
ControlHelper.MakeWindowRectValid(ref rect2);
base.SetBounds(rect2.Left, rect2.Top, rect2.Width, rect2.Height, BoundsSpecified.All);
}
catch
{
}
}
private static void TryParseLoggerArgs(IImpsLogger logger, string argsStr)
{
try
{
if (string.IsNullOrEmpty(argsStr))
{
argsStr = @"Folder=%AppData%\Fetion\Log;Type=1;HisLen=9;Threshold=10;Category=11001";
}
Trace.WriteLine("[shensr] LoggerArgs: " + argsStr);
foreach (string str in argsStr.Split(new char[] { ';' }))
{
string str3;
int num2;
int num3;
int index = str.IndexOf('=');
if (index > 0)
{
string str2 = str.Substring(0, index).Trim().ToUpper();
str3 = str.Substring(++index).Trim();
num2 = 0;
string str4 = str2;
if (str4 != null)
{
if (!(str4 == "FOLDER"))
{
if (str4 == "TYPE")
{
goto Label_00F2;
}
if (str4 == "HISLEN")
{
goto Label_0113;
}
if (str4 == "THRESHOLD")
{
goto Label_012E;
}
if (str4 == "CATEGORY")
{
goto Label_0149;
}
}
else if (str3.Length > 0)
{
logger.LogFolder = FilePathHelper.GetPathWithEnvVar(str3);
}
}
}
goto Label_01D2;
Label_00F2:
if (int.TryParse(str3, out num2))
{
logger.LogType = EnumHelper.Int32ToEnum<LogType>(num2, LogType.None);
}
goto Label_01D2;
Label_0113:
if (int.TryParse(str3, out num2))
{
logger.MaxLogNo = num2;
}
goto Label_01D2;
Label_012E:
if (int.TryParse(str3, out num2))
{
logger.ThresholdLevel = num2;
}
goto Label_01D2;
Label_0149:
num3 = 0;
while (num3 < str3.Length)
{
char ch = str3[num3];
switch (num3)
{
case 0:
logger.IsLogConnection = ch == '1';
break;
case 1:
logger.IsLogLogin = ch == '1';
break;
case 2:
logger.IsLogSipc = ch == '1';
break;
case 3:
logger.IsLogBiz = ch == '1';
break;
case 4:
logger.IsLogLiveUpdate = ch == '1';
break;
}
num3++;
}
Label_01D2:;
}
}
catch
{
TryParseLoggerArgs(logger, @"Folder=%AppData%\Fetion\Log;Type=1;HisLen=9;Threshold=10;Category=11001");
}
}
private void TryReplaceContactList()
{
try
{
if ((base.WindowState == FormWindowState.Normal) && this.tcMain.Visible)
{
int height = base.ClientSize.Height;
this.AdBar.Bar.Visible = height > 400;
this.AccountManager.UserInfoControl.Visible = height > 300;
}
}
catch
{
}
}
private void TryWaitSingletonSingal()
{
try
{
if ((this._evSingleton != null) && this._evSingleton.WaitOne(1, false))
{
this.ActiveMainWindow();
}
}
catch
{
}
}
private void UnRegWndMsg()
{
try
{
JNativeMethods.WTSUnRegisterSessionNotification(this.CurHandleRef);
}
catch (Exception)
{
}
}
protected override void WndProc(ref System.Windows.Forms.Message m)
{
try
{
if (m.Msg == this.WM_TASKBARCREATED)
{
this.trayIcon.Visible = true;
m.Result = (IntPtr) 1;
return;
}
switch (m.Msg)
{
case 0x11:
this.CurrentUser.AsyncLogout();
m.Result = (IntPtr) 1;
goto Label_0115;
case 0x48:
case 0x218:
if (!this.ProcessPowerWinMessage(ref m))
{
goto Label_0115;
}
return;
case 0x7e:
ControlHelper.RepositionFormOnScreenSizeChanged(this);
return;
case 0x112:
if (m.WParam.ToInt32() != 0xf060)
{
goto Label_0115;
}
base.Visible = false;
EnvHelper.StressMemory();
return;
case 0x2b1:
try
{
SysLockSensor instance = SysLockSensor.GetInstance(this);
instance.ProccessWndMsg(m, new Imps.Client.Utils.sensmon.sensmon.sens_simple_notify_proc_type(instance.on_event_simple));
}
catch (Exception)
{
}
break;
case 0x312:
if (((int) m.LParam) == this._hotKey)
{
this.ActiveMainWindow();
}
goto Label_0115;
}
Label_0115:
base.WndProc(ref m);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
public IUserAccountManager AccountManager
{
get
{
return this._mgrAccount;
}
}
public IAdBar AdBar
{
get
{
if (this._adBar == null)
{
this._adBar = new AdBarImp(this);
this._adBar.Bar.Dock = DockStyle.Bottom;
}
return this._adBar;
}
}
public IContainer ComponentContainer
{
get
{
return this.components;
}
}
public IContactManager ContactManager
{
get
{
return this._mgrContact;
}
}
public IConversationManage
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -