/// <summary> /// 解决界面大小变化时闪烁的问题 /// </summary> //protected override CreateParams CreateParams //{ // get // { // CreateParams cp = base.CreateParams; // cp.ExStyle |= 0x02000000;////用双缓冲从下到上绘制窗口的所有子孙 // return cp; // } //} protected override void InitUIOnLoad() { base.InitUIOnLoad(); if (!UtilityTool.IsDesignMode()) { //仅执行一次,设置程序默认字体 WindowsFormsSettings.DefaultFont = new Font(ControlUtilityTool.PubFontFamily, 10.5F, FontStyle.Regular); //设置皮肤 UserLookAndFeel.Default.SetSkinStyle(ControlUtilityTool.DEFAULT_SKIN_NAME); //解决滚轮无法控制滚动条的问题 WindowsFormsSettings.SmartMouseWheelProcessing = false; //设置背景图 this.LoadBackgroundImg(); //加载dll this.LoadDllFiles(); //加载楼层表文件 this.CreateFloorTableFiles(); } if (!this.ShowInputPsdForm()) { this.Close(); return; } }
public static GameObject Find(string name) { if (string.IsNullOrEmpty(name)) { return(null); } Transform obj = null; GameObject root = FindUIRoot(); if (root != null) { //在新版Unity中,Find函数会将Name中的/当作分隔符 //obj = root.transform.FindChild(name); obj = UtilityTool.GetChild(root, name, true).transform; //Transform t = root.transform; //for (int i = 0; i < t.childCount; i++) //{ // Transform c = t.GetChild(i); // if (c.name == name) // { // obj = c; // break; // } //} } if (obj != null) { return(obj.gameObject); } return(null); }
private async void MessageControl_OnImageMessageClick(WtMessage.Message message) { var data = new ImageViewerData { SelectedItem = UtilityTool.GetS3FileUrl(message.Body.Attachment.Id), ItemSource = ViewModel.Messages .Where(m => m.Type == WtMessage.MessageType.Image) .Select(m => UtilityTool.GetS3FileUrl(m.Body.Attachment.Id)) .ToList() }; CoreApplicationView newView = CoreApplication.CreateNewView(); int newViewId = 0; await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Frame frame = new Frame(); frame.Navigate(typeof(ImageViewerPage), data); Window.Current.Content = frame; Window.Current.Activate(); newViewId = ApplicationView.GetForCurrentView().Id; }); await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); }
private void Language_SelectionChanged(object sender, SelectionChangedEventArgs e) { ViewModel.SelectedLanguage = e.AddedItems[0] as Models.Language; ApplicationLanguages.PrimaryLanguageOverride = ViewModel.SelectedLanguage.Value; ResourceContext.GetForCurrentView().Reset(); ResourceContext.GetForViewIndependentUse().Reset(); UtilityTool.ReloadMainPage(); }
/// <summary> /// 加载dll依赖 /// </summary> private void LoadDllFiles() { string strPath = Path.Combine(Application.StartupPath, @"DependentFiles\Delphi"); if (!Directory.Exists(strPath)) { string strMsg = string.Format("{0} not exists!", strPath); RunLog.Log(strMsg, LogType.ltError); HintProvider.ShowConfirmDialog(null, strMsg, buttons: ConfirmFormButtons.OK); return; } UtilityTool.LoadDllFile(strPath, TripleDESIntf.TRIDES_DLL); }
private async void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) { e.Handled = true; string exTitle = UtilityTool.GetStringFromResources("Exception"); string close = UtilityTool.GetStringFromResources("Close"); var dialog = new ContentDialog { PrimaryButtonText = close, DefaultButton = ContentDialogButton.Primary, Title = exTitle, Content = e.Exception.Message }; await dialog.ShowAsync(); }
public MainViewModel() { Apps = new ObservableCollection <WtApp> { new WtApp { Name = "message", DisplayName = UtilityTool.GetStringFromResources("WtAppMessageDisplayName"), Icon = WtIconHelper.GetAppIcon("message") } }; SelectedApp = Apps.First(); Members = new ObservableCollection <User>(); Sessions = new ObservableCollection <Session>(); Services = new ObservableCollection <WtService>(); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IConfiguration configuration) { ////if (IsInDesignMode) ////{ //// // Code runs in Blend --> create design time data. ////} ////else ////{ //// // Code runs "for real" ////} /// ChooseWzqGameRelayCommnad = new RelayCommand(OpenChooseGameWindow); baseConfiguration = configuration as BaseConfiguration; baseConfiguration.Load(); WzqGameProcess = UtilityTool.GetWzqGameProcess(baseConfiguration.GameUiTitle); baseConfiguration.GameProcessId = WzqGameProcess.Id; baseConfiguration.Save(); chessRecognize = new ChessRecognize(configuration); chessRecognize.ChessRecognized += ChessRecognize_ChessRecognized; //检测WzqGameProcess new Thread(() => { Process lastProcess = null; while (true) { if (WzqGameProcess == null || WzqGameProcess.HasExited) { WzqGameProcess = UtilityTool.GetWzqGameProcess(baseConfiguration.GameUiTitle); if (lastProcess != WzqGameProcess) { lastProcess = WzqGameProcess; baseConfiguration.GameProcessId = WzqGameProcess.Id; baseConfiguration.Save(); chessRecognize.UpdateConfig(); } } Thread.Sleep(200); } }).Start(); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IConfiguration configuration) { ////if (IsInDesignMode) ////{ //// // Code runs in Blend --> create design time data. ////} ////else ////{ //// // Code runs "for real" ////} /// var config = configuration as BaseConfiguration; this.configuration = configuration; config.Load(); WzqGameProcess = UtilityTool.GetWzqGameProcess(config.GameUiTitle); ChooseWzqGameRelayCommnad = new RelayCommand(OpenChooseGameWindow); }
/// <summary> /// 设置显示 /// </summary> public void SetHighlight() { var mesh = UtilityTool.GetChild(modelPoint.gameObject, "baseItem", true); var renderer = mesh.GetComponent <Renderer>(); if (!renderer) { renderer = mesh.gameObject.AddComponent <Renderer>(); } Material highlightMaterial = new Material(Shader.Find("Custom/RimLighting2")); if (highlightMaterial != null) { renderer.material = highlightMaterial; //highlightMaterial.SetTexture("_MainTex", modelTexture); //highlightMaterial.SetColor("_MainColor", mainColor); } CreateLandFeature(); m_isShow = true; }
/// <summary> /// 调整NavBarControl宽度 /// </summary> /// <param name="nbControl"></param> /// <param name="minWidth"></param> public static int AdjustNavBarControlWidth(NavBarControl nbControl, int minWidth, bool shouldAdjustW = true) { //调整Navigation宽度 int nvWidth = minWidth; foreach (NavBarGroup nvGrp in nbControl.Groups) { if (!nvGrp.Visible) { continue; } var size = UtilityTool.GetStrPixelSize(nvGrp.Caption, nbControl.Font); int width = size.Width + nvGrp.GetImageSize().Width + 20; nvWidth = width > nvWidth ? width : nvWidth; } if (shouldAdjustW) { nbControl.Width = nvWidth; } return(nvWidth); }
private async void Download_Click(object sender, RoutedEventArgs e) { var allDownloads = await BackgroundDownloader.GetCurrentDownloadsAsync(); foreach (var item in FilesListView.SelectedItems) { var entity = item as Entity; Uri uri = new Uri(UtilityTool.GetS3FileUrl(entity.Id)); if (!allDownloads.Any(d => d.RequestedUri.ToString() == uri.ToString())) { var file = await DownloadsFolder.CreateFileAsync(entity.Addition.Title, CreationCollisionOption.GenerateUniqueName); var downloader = new BackgroundDownloader(); await Task.Run(async() => await DispatcherHelper.ExecuteOnUIThreadAsync(async() => { var download = downloader.CreateDownload(uri, file); await download.StartAsync(); })); } } }
/// <summary> /// 动态加载窗体到pnlReportContainer /// </summary> /// <typeparam name="T"></typeparam> /// <param name="ucName"></param> private void ShowUserControl <T>(string ucName) where T : GeneralDeviceUserControl { foreach (GeneralDeviceUserControl userControl in f_UserControls.Values) { userControl.Visible = false; } if (f_UserControls.ContainsKey(ucName)) { GeneralUserControl uc = f_UserControls[ucName]; uc.Visible = true; uc.BringToFront(); return; } HintProvider.StartWaiting(null, "正在加载", "", Application.ProductName, showDelay: 0, showCloseButtonDelay: int.MaxValue); T t = UtilityTool.ShowUserControl <T>(this.pnlReportContainer); //绑定udp监听器到pnlReportContainer t.UdpListener = f_UdpListener; //绑定接收数据的函数 t.UdpListener.RecvCallback += t.RecvCallBack; f_UserControls.Add(ucName, t); }
static void Main() { bool createNew = false; ////系统能够识别有名称的互斥,因此可以使用它禁止应用程序启动两次 ////第二个参数可以设置为产品的名称:Application.ProductName ////每次启动应用程序,都会验证程序名称的互斥是否存在 Mutex mutex = new Mutex(true, "ParamsSettingTool", out createNew); try { if (!createNew) { UtilityTool.BringProcessToFrontByPath(Application.ExecutablePath); //若程序已启动,则激活程序并置前 Application.Exit(); return; } Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DevExpress.Skins.SkinManager.EnableFormSkins(); DevExpress.UserSkins.BonusSkins.Register(); // HintProvider.StartWaiting(null, "正在启动参数设置工具", "", Application.ProductName, showDelay: 0, showCloseButtonDelay: int.MaxValue); var main = new MainForm(); Application.Run(main); //var Login = new InputPsdForm(); //Application.Run(Login); } finally { if (createNew) { mutex.ReleaseMutex(); } } }
private void Theme_SelectionChanged(object sender, SelectionChangedEventArgs e) { var theme = e.AddedItems[0] as Models.Theme; UtilityTool.ReloadPageTheme(theme.Value, UtilityTool.MainPage); }
public HtmlToPdf_HtmlRenderer() { UtilityTool.CreateFolder(outputPath); }