Exemplo n.º 1
0
        private void ImageButton_OnClick(object sender, RoutedEventArgs e)
        {
            var path = MainUtils.LoadImageFile();

            if (path == null)
            {
                return;
            }

            Avatar.Source = new BitmapImage(new Uri(path));
        }
Exemplo n.º 2
0
        private void ColorRectangle_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            var target = sender as Rectangle;

            if (target == null)
            {
                return;
            }

            var color = MainUtils.GetColor();

            if (color != null)
            {
                target.Fill = color;
            }
        }
Exemplo n.º 3
0
        private void AppOnPreLoad()
        {
            //初始化函数

            //初始化桥
            mainNativeBridge = new MainNativeBridge(this);
            mainNativeBridge.exitCallBack = AppExit;
            mainNativeBridge.terminateImporantWarnCallBack = TermintateImporantProcess;
            mainNativeBridge.coreWndProc = (WNDPROC)Marshal.GetDelegateForFunctionPointer(MAppSetCallBack(IntPtr.Zero, 0), typeof(WNDPROC));
            mainNativeBridge.InitCallbacks();

            _isNativeBridgeLoaded = true;

            MainSettings = new MainSettings(this);

            //加载设置和所有页的代码
            AppLoadPages();
            AppLoadSettings();
            AppLoadAllMenuStyles();

            //标题
            SetConfig("LastWindowTitle", "AppSetting", Text);
            Text = GetConfig("Title", "AppSetting", "任务管理器");
            if (Text == "")
            {
                Text = LanuageFBuffers.Str_AppTitle;
            }

            new System.Threading.Thread(mainPagePerf.PerfInitTray).Start();

            //系统位数
#if _X64_
            Log("64 Bit OS ");
            Is64OS = true;
#else
            Is64OS = MIs64BitOS();
            Log(Is64OS ? "64 Bit OS but 32 bit app " : "32 Bit OS");
#endif
            IsAdmin = MIsRunasAdmin();

            //判断是否支持通用应用(win8 以上)
            SysVer.Get();
            if (!SysVer.IsWin8Upper())
            {
                tabControlMain.TabPages.Remove(tabPageUWPCtl);
            }
            else
            {
                M_UWP_Init();
            }

            //提升权限
            if (!MGetPrivileges())
            {
                TaskDialog.Show(LanuageMgr.GetStr("FailedGetPrivileges"), LanuageFBuffers.Str_AppTitle, "", TaskDialogButton.OK, TaskDialogIcon.Warning);
            }

            //tab 头 的自定义
            TaskMgrTabHeader tabHeader = new TaskMgrTabHeader(tabControlMain);
            Controls.Add(tabHeader);
            tabHeader.Dock   = DockStyle.Top;
            tabHeader.Height = 27;
            tabHeader.BringToFront();
            tabHeader.Font = tabControlMain.Font;
            if (IsSimpleView)
            {
                tabHeader.Visible = false;
            }

            //Shell Icon
            IntPtr shellIconPtr   = MGetShieldIcon2();
            Icon   shellIcon      = Icon.FromHandle(shellIconPtr);
            Bitmap shellIcoBtimap = MainUtils.IconToBitmap(shellIcon, 16, 16);

            check_showAllProcess.Image     = shellIcoBtimap;
            linkRebootAsAdmin.Image        = shellIcoBtimap;
            linkRestartAsAdminDriver.Image = shellIcoBtimap;

            DestroyIcon(shellIconPtr);
        }
 private void ChooseAvatarButton_OnClick(object sender, RoutedEventArgs e)
 {
     _avatarImagePath = MainUtils.LoadImageFile();
 }