Beispiel #1
0
        private void Install()
        {
            if (!CheckBeforeInstall())
            {
                return;
            }

            string package, extTarget, desktopPath, startupPath;

            // -- 1. 拷贝目录 --
            package = UtilFile.Combine(ProjectConst.SourcePath, "package");
            UtilFile.CopyDiretory(package, TargetPath);

            // -- 2. 创建快捷方式到桌面和启动组 --
            extTarget = UtilFile.Combine(TargetPath, ProjectConst.APP_EXE);

            desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            CreateShortcut(TargetPath, extTarget, ProjectConst.APP_SHORTCUT, ProjectConst.APP_SHORTCUT_DESC, desktopPath);

            if (ProjectConst.FLAG_SHORTCUT_ON_STARTUP)
            {
                startupPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup);
                CreateShortcut(TargetPath, extTarget, ProjectConst.APP_SHORTCUT, ProjectConst.APP_SHORTCUT_DESC, startupPath);
            }

            // -- 4. 立即运行 --
            if (UtilMessage.ShowConfirm(ProjectConst.APP_SHORTCUT_DESC + " 安装成功,是否立即运行?") == DialogResult.Yes)
            {
                Environment.CurrentDirectory = TargetPath;      // -- 确保exeTarget运行时,当前目录是exeTarget所在目录,否则是SmartInstaller.exe所在目录 --
                Process.Start(extTarget);
            }
            else
            {
                UtilMessage.ShowMessage(ProjectConst.APP_SHORTCUT_DESC + " 安装成功,已创建桌面快捷方式。");
            }

            // -- 9. end --
            this.Close();
        }
Beispiel #2
0
        private async void GetTimeAsync()
        {
            loading.IsActive = true;
            Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Wait, 10);

            try
            {
                ReturnDTO <RealTime> realTime = null;

                realTime = await UtilWebService.GetTimeAsync(this, UtilWebService.UrlPath);

                App.RealTime = realTime.Value;

                if (!realTime.Return)
                {
                    UtilMessage.ShowMessage <RealTime>(realTime);
                    pvtTime.Title = realTime.ReturnMessage;
                }
                else
                {
                    pvtTime.Title = "Last refresh: " + realTime.Value.timeList.lastRefresh;
                    CleanAllGrids();

                    FillGrids();
                }
            }
            catch (Exception)
            {
                UtilMessage.PopUpMessage("Error", "Error");
            }
            finally
            {
                loading.IsActive = false;
                Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 10);
            }
        }