static ServiceFactoryBase() { Events = new EventAggregator(); ResourceService = new ResourceService(); DialogService = new RealDialogService(); MessageBoxService = new RealMessageBoxService(); }
public void AddResourceForSkill_MakeSureResourceIsSavedOnlyOnce() { var resource = CreateSampleResource(); RavenSession.Store(resource); RavenSession.SaveChanges(); var resources = RavenSession.Query<Resource>().ToList(); Assert.AreEqual(1 , resources.Count); var resourceService = new ResourceService(RavenSession); resourceService.AddSkillForAResource(resource , CreateSampleSkill() , 5); RavenSession.SaveChanges(); var resourcesAgain = RavenSession.Query<Resource>().ToList(); Assert.AreEqual(1, resourcesAgain.Count); Assert.AreEqual(1 , resourcesAgain.First().Skills.Count()); }
public MainStreamerModel(CoreData coreData, ScreenRendererModel screenRenderer, SourcesModel sources, ResourceService resourceService, IAppEnvironment appEnvironment, IWindowStateManager windowStateManager, AudioModel audioModel, IAppResources appResource) { _coreData = coreData; _sources = sources; _resourceService = resourceService; _appEnvironment = appEnvironment; _windowStateManager = windowStateManager; _audioModel = audioModel; _appResource = appResource; ScreenRenderer = screenRenderer; _healthCheck = new StreamerHealthCheck(coreData); Core.InitOnMain(); }
public override void Run() { reportStructure = new ReportStructure(); if (GlobalValues.IsValidPrinter() == true) { using (WizardDialog wizard = new WizardDialog("Report Wizard", reportStructure, WizardPath)) { if (wizard.ShowDialog() == DialogResult.OK) { reportModel = reportStructure.CreateAndFillReportModel(); CreateReportFromModel(reportModel, reportStructure); } else { this.canceled = true; } } } else { MessageService.ShowError(ResourceService.GetString("Sharpreport.Error.NoPrinter")); } }
public override void Setup(ViewData data) { base.Setup(data); GeneratorInfo generator = data.UserData as GeneratorInfo; if (generator == null || !generator.IsDependent) { return; } object currentNameStr = LocalizationObj.GetString(generator.LocalData.GetName(Planets.CurrentPlanetId.Id).name); var requiredGenerator = Services.GenerationService.GetGetenerator(generator.LocalData.required_id); object requiredNameStr = LocalizationObj.GetString(requiredGenerator.LocalData.GetName(Planets.CurrentPlanetId.Id).name); titleText.text = LocalizationObj.GetString("DEPEND.TITLE").Format(requiredNameStr); descriptionText.text = LocalizationObj.GetString("DEPEND.DESC").Format(currentNameStr, requiredNameStr); iconImage.overrideSprite = ResourceService.GetSpriteByKey(requiredGenerator.LocalData.GetIconData(Planets.CurrentPlanetId.Id).icon_id); closeButton.SetListener(() => { Sounds.PlayOneShot(SoundName.click); ViewService.Remove(ViewType.DependGeneratorView); }); }
public ContextMenuStrip GetContextMenu() { ContextMenuStrip menu = new ContextMenuStrip(); ToolStripMenuItem copyItem; copyItem = new ToolStripMenuItem(); copyItem.Text = ResourceService.GetString("MainWindow.Windows.Debug.LocalVariables.CopyToClipboard"); copyItem.Checked = false; copyItem.Click += delegate { ClipboardWrapper.SetText(fullText); }; ToolStripMenuItem hexView; hexView = new ToolStripMenuItem(); hexView.Text = ResourceService.GetString("MainWindow.Windows.Debug.LocalVariables.ShowInHexadecimal"); hexView.Checked = DebuggingOptions.Instance.ShowValuesInHexadecimal; hexView.Click += delegate { // refresh all pads that use ValueNode for display DebuggingOptions.Instance.ShowValuesInHexadecimal = !DebuggingOptions.Instance.ShowValuesInHexadecimal; // always check if instance is null, might be null if pad is not opened if (LocalVarPad.Instance != null) { LocalVarPad.Instance.RefreshPad(); } if (WatchPad.Instance != null) { WatchPad.Instance.RefreshPad(); } }; menu.Items.AddRange(new ToolStripItem[] { copyItem, hexView }); return(menu); }
public void GetResourcesByCulture_Should_Fetch_Correct_Resources() { Mock <IContextProvider> contextProvider = new Mock <IContextProvider>(); IResourceService service = new ResourceService(_fixture.DbContext); List <int> idList = new List <int>(); StringResource testSr; for (int i = 0; i < 10; i++) { testSr = new StringResource() { Name = "Test" + i.ToString(), Value = "Test" + i.ToString(), CultureCode = "en-US" }; service.Insert(testSr); idList.Add(testSr.Id); } for (int i = 0; i < 10; i++) { testSr = new StringResource() { Name = "Test" + i.ToString(), Value = "Test" + i.ToString(), CultureCode = "tr-TR" }; service.Insert(testSr); idList.Add(testSr.Id); } Assert.Equal(service.FetchAll().Count(s => s.CultureCode == "en-US"), 10); service.DeleteById(idList.First()); idList.RemoveAt(0); service.DeleteById(idList.First()); idList.RemoveAt(0); testSr = service.GetResourceById(idList.First()); testSr.CultureCode = "de-DE"; service.Update(testSr); Assert.Equal(service.FetchAll().Count(s => s.CultureCode == "en-US"), 7); }
private void SaveDebt() { if (Debt.Value == null || Debt.Value <= decimal.Zero) { UserDialogs.Instance.Alert(ResourceService.GetString("valueIsNotSet")); return; } else if (Debt.Currency == null) { UserDialogs.Instance.Alert(ResourceService.GetString("setCurrency")); return; } if (DatabaseService.InsertOrUpdateDebt(Debt)) { UserDialogs.Instance.ToastSucceed(ResourceService.GetString("saved")); } else { UserDialogs.Instance.ToastFailure(ResourceService.GetString("error")); } }
public void BindNewTask(int minValue, int defaultValue, Guid projectId, object newTaskOne, object newTaskTwo) { _minValue = minValue; NewTaskOneBindingSource.DataSource = newTaskOne; NewTaskTwoBindingSource.DataSource = newTaskTwo; hourTrackBarControl.Value = defaultValue; ProjectIterationSearchLookUpEdit.ReLoadData(new BinaryOperator("ProjectId", projectId), "ProjectIteration"); NewProjectIterationSearchLookUpEdit.ReLoadData(new BinaryOperator("ProjectId", projectId), "ProjectIteration"); TNewProjectIterationSearchLookUpEdit.ReLoadData(new BinaryOperator("ProjectId", projectId), "ProjectIteration"); string[] splitTypes = { "RemainderTime", "Rate", "Manual" }; splitTypeRadio.Properties.Items.Clear(); for (int i = 0; i < splitTypes.Count(); i++) { RadioGroupItem item = new RadioGroupItem(i, ResourceService.GetString(splitTypes[i])); splitTypeRadio.Properties.Items.Add(item); } splitTypeRadio.EditValue = 0; if (OnValueChanged != null) { OnValueChanged(null, new EventArgs <int, int>(hourTrackBarControl.Value, 0)); } }
public async Task SetResourceLogUnitTest_ShouldThrowEx() { var document = PlainText.Parse("LogUnitTest"); var logger = Substitute.For <ILogger>(); var client = BuildSenderSubstitute_ThrowsException(); var resourceService = new ResourceService(client); var exceptionThrown = false; try { await resourceService.SetAsync("LogUnitTest", document, logger : logger, cancellationToken : CancellationToken.None); } catch (Exception ex) { logger.Received(1).Error(ex, Arg.Any <string>(), Arg.Any <PlainText>(), Arg.Any <string>()); exceptionThrown = true; } finally { exceptionThrown.ShouldBe(true); } }
public DefaultWorkbench() { Text = "我的SD插件框架"; Icon = ResourceService.GetIcon("htc_sense_footprint_icon"); //Icon = ResourceService.GetIcon("Icons.SharpDevelopIcon"); StartPosition = FormStartPosition.Manual; _NormalBounds = PropertyService.Get <Rectangle>(_BoundProperty, new Rectangle(60, 80, 640, 480)); Bounds = _NormalBounds; bool bMax = PropertyService.Get <bool>(_WindowIsMaximized, false); if (bMax) { _WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized; } _FullScreen = PropertyService.Get <bool>(_WindowIsFullScreen, false); if (_FullScreen) { FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; } AllowDrop = true; PadDescriptor.BringPadToFrontEvent += delegate(PadDescriptor padDesc) { foreach (PadDescriptor pd in PadContentCollection) { if (pd.Equals(padDesc)) { layout.ShowPad(padDesc, true); return; } // ShowPad(padDesc);--2013.2.4调整位置 } ShowPad(padDesc); }; }
public InstallableAddIn(string fileName, bool isPackage) { this.fileName = fileName; this.isPackage = isPackage; if (isPackage) { ZipFile file = new ZipFile(fileName); try { LoadAddInFromZip(file); } finally { file.Close(); } } else { addIn = AddIn.Load(fileName); } if (addIn.Manifest.PrimaryIdentity == null) { throw new AddInLoadException(ResourceService.GetString("AddInManager.AddInMustHaveIdentity")); } }
/// <summary> /// Gets the assigned to where clause. /// </summary> /// <param name="sessionId">The session identifier.</param> /// <param name="fieldFilter">The field filter.</param> /// <returns> /// Assigned to WhereClause /// </returns> private static string GetAssignedToWhereClause(string sessionId, FieldFilter fieldFilter, BurnRetrievalOptions retrievalOptions) { string assignedToClause = " "; ResourceSummaryCollection reesourceSummaryCollection = null; if (fieldFilter.AssignedTo != null && !string.IsNullOrEmpty(fieldFilter.AssignedTo.Name)) { if (fieldFilter.AssignedTo.Name.Contains("Team")) { // Get Group Members ResourceService resourceService = new ResourceService(); ResourceIdentity groupresourceIdenity = new ResourceIdentity() { Id = fieldFilter.AssignedTo.Id, Name = fieldFilter.AssignedTo.Name }; reesourceSummaryCollection = resourceService.GetMembersOfGroup(sessionId, groupresourceIdenity, false); if (reesourceSummaryCollection != null && reesourceSummaryCollection.Count > 0) { assignedToClause = assignedToClause + string.Format("({0})", BuildResourceString(reesourceSummaryCollection)); } } else { // Individual resource we can use directly as below. assignedToClause = assignedToClause + string.Format("('{0}')", fieldFilter.AssignedTo.Name); reesourceSummaryCollection = new ResourceSummaryCollection(); ResourceSummary resourceSummary = new ResourceSummary(); resourceSummary.Identity = new ResourceIdentity(); resourceSummary.Identity.Name = fieldFilter.AssignedTo.Name; reesourceSummaryCollection.Add(resourceSummary); } PopulateTeamMembers(retrievalOptions, reesourceSummaryCollection); } return(assignedToClause); }
// private MagicMenus.PopupMenu menu = null; public FileList() { ResourceManager resources = new ResourceManager("ProjectComponentResources", this.GetType().Module.Assembly); Columns.Add(ResourceService.GetString("CompilerResultView.FileText"), 100, HorizontalAlignment.Left); Columns.Add(ResourceService.GetString("MainWindow.Windows.FileScout.Size"), -2, HorizontalAlignment.Right); Columns.Add(ResourceService.GetString("MainWindow.Windows.FileScout.LastModified"), -2, HorizontalAlignment.Left); // menu = new MagicMenus.PopupMenu(); // menu.MenuCommands.Add(new MagicMenus.MenuCommand("Delete file", new EventHandler(deleteFiles))); // menu.MenuCommands.Add(new MagicMenus.MenuCommand("Rename", new EventHandler(renameFile))); try { watcher = new FileSystemWatcher(); } catch { } if (watcher != null) { watcher.NotifyFilter = NotifyFilters.FileName; watcher.EnableRaisingEvents = false; watcher.Renamed += new RenamedEventHandler(fileRenamed); watcher.Deleted += new FileSystemEventHandler(fileDeleted); watcher.Created += new FileSystemEventHandler(fileCreated); watcher.Changed += new FileSystemEventHandler(fileChanged); } HideSelection = false; GridLines = true; LabelEdit = true; SmallImageList = IconManager.List; HeaderStyle = ColumnHeaderStyle.Nonclickable; View = View.Details; Alignment = ListViewAlignment.Left; }
public DefaultWorkbench() { Text = "MapToolkit"; Icon = ResourceService.GetIcon("Satellite"); StartPosition = FormStartPosition.Manual; _NormalBounds = PropertyService.Get <Rectangle>(_BoundProperty, new Rectangle(60, 80, 640, 480)); Bounds = _NormalBounds; bool bMax = PropertyService.Get <bool>(_WindowIsMaximized, false); if (bMax) { _WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized; } _FullScreen = PropertyService.Get <bool>(_WindowIsFullScreen, false); if (_FullScreen) { FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; } AllowDrop = true; PadDescriptor.BringPadToFrontEvent += delegate(PadDescriptor padDesc) { for (int i = 0; i < PadContentCollection.Count; i++) { PadDescriptor pd = PadContentCollection[i]; if (pd.Equals(padDesc)) { layout.ShowPad(padDesc, true); return; } ShowPad(padDesc); } }; }
private void InitLoginUser() { //set logined user full name var _fullNameItem = new BarStaticItem(); _fullNameItem.Caption = AuthorizationManager.FullName; _fullNameItem.Glyph = (Bitmap)WinFormsResourceService.GetBitmap("pnguserinfo"); Ribbon.Items.Add(_fullNameItem); _fullNameItem.ItemClick += (s, e) => { ActionParameters parameters = new ActionParameters("User", AuthorizationManager.CurrentUserId, ViewShowType.Show) { { "WorkingMode", EntityDetailWorkingMode.Edit } }; _application.Invoke("User", "Detail", parameters); }; // Notification var notificationItem = new BarStaticItem(); string notifcationName = ResourceService.GetString("Notification"); notificationItem.Caption = notifcationName; AuthorizationManager.NotificationList.DataSourceChanged += (s, e) => { notificationItem.Caption = notifcationName + "(" + ((List <NotificationDTO>)AuthorizationManager.NotificationList.List).Where(c => c.NotificationStatusName != "Readed").Count() + ") "; }; Ribbon.Items.Add(notificationItem); notificationItem.Glyph = (Bitmap)WinFormsResourceService.GetBitmap("notification"); notificationItem.ItemClick += (s, e) => { ActionParameters parameters = new ActionParameters("Notification", Guid.Empty, ViewShowType.Show); _application.Invoke("Notification", "List", parameters); }; Ribbon.PageHeaderItemLinks.AddRange(new BarItem[] { _fullNameItem, notificationItem }); }
private void UpdateManagerIcon() { if (manager != null) { int currentPlanetId = Services.PlanetService.CurrentPlanet.Id; bool isHired = Services.ManagerService.IsHired(manager.Id); Debug.Log($"update icon for manager => {manager.Id}"); var spriteData = Services.ResourceService.ManagerLocalDataRepository.GetIconData(manager.Id, currentPlanetId, isHired); var generatorIconData = Services.ResourceService.GeneratorLocalData.GetLocalData(manager.Id).GetIconData(Services.PlanetService.CurrentPlanet.Id); transportIconImage.overrideSprite = Services.ResourceService.GetSpriteByKey(generatorIconData.icon_id); if (spriteData != null) { Debug.Log($"set sprite from sprite data => {spriteData.ToString().Colored(ConsoleTextColor.yellow)}"); var img = Services.ResourceService.GetSprite(spriteData); if (img != null) { iconImage.overrideSprite = img; } } else { Debug.Log($"sprite data not found... set fallback"); spriteData = ResourceService.ManagerLocalDataRepository.GetIconData(manager.Id, 0, isHired); if (spriteData != null) { Debug.Log("set earth sprite data..."); iconImage.overrideSprite = ResourceService.GetSprite(spriteData); } else { Debug.Log("earth sprite is null..."); iconImage.overrideSprite = ResourceService.Sprites.FallbackSprite; } } } }
void OnLoaded(object sender, RoutedEventArgs e) { if (!WebProjectService.IsIISInstalled) { StatusLabel.Text = ResourceService.GetString("ICSharpCode.WepProjectOptionsPanel.IISNotFound"); return; } switch (CurrentProjectDebugData.WebServer) { case WebServer.IISExpress: if (WebProjectService.IISVersion == IISVersion.IISExpress) { UseIISExpress.IsChecked = true; PortTextBox.Text = CurrentProjectDebugData.Port ?? "8080"; SelectIISExpress(); } break; case WebServer.IIS: if (WebProjectService.IISVersion == IISVersion.IIS5 || WebProjectService.IISVersion == IISVersion.IIS6 || WebProjectService.IISVersion == IISVersion.IIS7 || WebProjectService.IISVersion == IISVersion.IIS_Future) { UseLocalIIS.IsChecked = true; ProjectUrl.Text = CurrentProjectDebugData.ProjectUrl ?? string.Empty; SelectLocalIIS(); } break; default: // do nothing break; } }
static string PriorityToString(System.Threading.ThreadPriority priority) { switch (priority) { case System.Threading.ThreadPriority.Highest: return(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Highest")); case System.Threading.ThreadPriority.AboveNormal: return(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.AboveNormal")); case System.Threading.ThreadPriority.Normal: return(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Normal")); case System.Threading.ThreadPriority.BelowNormal: return(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.BelowNormal")); case System.Threading.ThreadPriority.Lowest: return(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Lowest")); default: return(ResourceService.GetString("Global.NA")); } }
public MdiHomePageDesignForm(string homeId) { this._homeId = homeId; this.ShowIcon = true; this.Icon = Icon.FromHandle(ResourceService.GetResourceImage("tree.img.article2").GetHicon()); Label l1 = new Label(); l1.Text = "此页面为主页面,设计请在模板中完成!"; l1.Location = new Point(this.Width / 2, this.Height / 2); l1.Size = new Size(400, 300); l1.Font = new Font("黑体", 16); Button btnOpenTmplt = new Button(); btnOpenTmplt.Text = "打开关联模板"; btnOpenTmplt.Size = new Size(120, 24); btnOpenTmplt.Location = new Point(this.Width / 2, this.Height / 2 + 40); btnOpenTmplt.Click += new EventHandler(btnOpenTmplt_Click); this.Controls.Add(btnOpenTmplt); this.Controls.Add(l1); }
public ExceptionBox(Exception e, string message, bool mustTerminate) { this.exceptionThrown = e; this.message = message; InitializeComponent(); if (mustTerminate) { closeButton.Visible = false; continueButton.Text = closeButton.Text; continueButton.Left -= closeButton.Width - continueButton.Width; continueButton.Width = closeButton.Width; } try { Translate(this); } catch {} exceptionTextBox.Text = getClipboardString(); try { this.pictureBox.Image = ResourceService.GetBitmap("ErrorReport"); } catch {} }
void InitMy() { propertyToolStripButton = new ToolStripMenuItem("", ResourceService.GetResourceImage("MainMenu.view.property"), null, "ChildNodes"); refreshToolStripButton = new ToolStripMenuItem("", ResourceService.GetResourceImage("Tree.ToolStrip.Reflash"), null, "Refresh"); //showAllToolStripButton = new ToolStripMenuItem("所有文件", null, null, "ShowAll"); collapseAllToolStripButton = new ToolStripMenuItem("", ResourceService.GetResourceImage("Tree.ToolStrip.CollapseAll"), null, "CollapseAll"); expandAllToolStripButton = new ToolStripMenuItem("", ResourceService.GetResourceImage("Tree.ToolStrip.ExpandAll"), null, "ExpandAll"); ts1 = new ToolStripSeparator(); propertyToolStripButton.ToolTipText = "属性"; refreshToolStripButton.ToolTipText = "刷新"; //showAllToolStripButton.ToolTipText = "显示所有文件"; collapseAllToolStripButton.ToolTipText = "全折叠"; expandAllToolStripButton.ToolTipText = "全展开"; this.Items.AddRange(new ToolStripItem[] { propertyToolStripButton, refreshToolStripButton,//showAllToolStripButton, ts1, expandAllToolStripButton, collapseAllToolStripButton }); SetVisual(false); this.ItemClicked += new ToolStripItemClickedEventHandler(MyTreeToolStrip_ItemClicked); }
public void AddResource_AddSkills_FetchAndVerify() { //Setup var resource = Builder<Resource>.CreateNew().With(a=>a.Id ,"ResourceId1").Build(); var sampleSkills = Builder<Skill>.CreateListOfSize(5).Build(); var resourceService = new ResourceService(RavenSession); foreach (var resoureSkill in sampleSkills) { resourceService.AddSkillForAResource(resource , resoureSkill , 4); } //Act RavenSession.Store(resource); RavenSession.SaveChanges(); //Verify var fetchedResource = RavenSession.Query<Resource>().FirstOrDefault(a => a.Id == resource.Id); Assert.IsNotNull(fetchedResource); Assert.AreEqual(5, resource.Skills.Count()); Assert.AreEqual(4, resource.Skills.First().Strength); }
protected override void OnPaint(PaintEventArgs pe) { // base.OnPaint(pe); Graphics g = pe.Graphics; g.DrawString(ResourceService.GetString("SharpDevelop.Gui.Dialogs.WizardDialog.StepsLabel"), smallFont, SystemBrushes.WindowText, 10, 24 - smallFont.Height); g.DrawLine(SystemPens.WindowText, 10, 24, Width - 10, 24); int curNumber = 0; for (int i = 0; i < wizard.WizardPanels.Count; i = wizard.GetSuccessorNumber(i)) { Font curFont = wizard.ActivePanelNumber == i ? boldFont : normalFont; IDialogPanelDescriptor descriptor = ((IDialogPanelDescriptor)wizard.WizardPanels[i]); g.DrawString((1 + curNumber) + ". " + descriptor.Label, curFont, SystemBrushes.WindowText, 10, 40 + curNumber * curFont.Height); ++curNumber; } }
public ProjectReferencePanel(ISelectReferenceDialog selectDialog) { this.selectDialog = selectDialog; ColumnHeader nameHeader = new ColumnHeader(); nameHeader.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.ProjectReferencePanel.NameHeader"); nameHeader.Width = 170; Columns.Add(nameHeader); ColumnHeader directoryHeader = new ColumnHeader(); directoryHeader.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.ProjectReferencePanel.DirectoryHeader"); directoryHeader.Width = 290; Columns.Add(directoryHeader); View = View.Details; Dock = DockStyle.Fill; FullRowSelect = true; ItemActivate += delegate { AddReference(); }; PopulateListView(); }
/// <summary> /// edited by zhenghao at 2008-05-28 : 初始化 /// </summary> private void Init() { InitComboBox(); GetPosition(); textBoxSearchContent.Text = FindOptions.Singler.FindContent; textBoxReplaceContent.Text = FindOptions.Singler.ReplaceContent; //查找选项部分的初始化 checkBoxMatchCase.Checked = FindOptions.Singler.MatchCase; checkBoxMatchWholeWord.Checked = FindOptions.Singler.MatchWholeWord; checkBoxUpWard.Checked = FindOptions.Singler.UpWard; checkBoxUsing.Checked = FindOptions.Singler.IsUsingFindType; //填充现在的查找方式 comboBoxSearchType.Text = ResourceService.GetEnumResourceText(typeof(FindType), FindOptions.Singler.FindType.ToString()); //填充现在的查找目标类型 comboBoxSearchTarget.Text = ResourceService.GetEnumResourceText(typeof(FindTargetType), FindOptions.Singler.FindTargetType.ToString()); //填充现在的查找范围 comboBoxSearchScope.Text = ResourceService.GetEnumResourceText(typeof(FindScope), FindOptions.Singler.FindScope.ToString()); }
internal void ComboBoxDrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { ComboBox comboBox = (ComboBox)sender; e.DrawBackground(); Rectangle drawingRect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); Brush drawItemBrush = SystemBrushes.WindowText; if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { drawItemBrush = SystemBrushes.HighlightText; } if (comboBox.Enabled == false) { e.Graphics.DrawString(ResourceService.GetString("ICSharpCode.SharpDevelop.Gui.Pads.ClassScout.LoadingNode"), comboBox.Font, drawItemBrush, drawingRect, drawStringFormat); } else if (e.Index >= 0) { FontDescriptor fontDescriptor = (FontDescriptor)comboBox.Items[e.Index]; e.Graphics.DrawString(fontDescriptor.Name, fontDescriptor.IsMonospaced ? boldComboBoxFont : comboBox.Font, drawItemBrush, drawingRect, drawStringFormat); } e.DrawFocusRectangle(); }
private string ErrorCodeToString(KatushaMembershipCreateStatus createStatus) { // See http://go.microsoft.com/fwlink/?LinkID=177550 for // a full list of status codes. switch (createStatus) { case KatushaMembershipCreateStatus.DuplicateUserName: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); case KatushaMembershipCreateStatus.DuplicateEmail: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); case KatushaMembershipCreateStatus.InvalidPassword: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); case KatushaMembershipCreateStatus.InvalidEmail: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); case KatushaMembershipCreateStatus.InvalidAnswer: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); case KatushaMembershipCreateStatus.InvalidQuestion: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); case KatushaMembershipCreateStatus.InvalidUserName: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); case KatushaMembershipCreateStatus.ProviderError: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); case KatushaMembershipCreateStatus.UserRejected: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus." + createStatus)); default: return(ResourceService.ResourceValue("KatushaMembershipCreateStatus.Default")); } }
/// <summary> /// Creates the connection. /// </summary> /// <param name="provider">The provider.</param> /// <param name="connStr">The connection string.</param> /// <param name="configPath">The configuration path</param> /// <param name="name">The name that will be assigned to the connection.</param> /// <returns></returns> protected override FdoConnection CreateConnection(string provider, string connStr, string configPath, ref string name) { IFdoConnectionManager connMgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); //Try to find by name first FdoConnection conn = null; conn = connMgr.GetConnection(name); //Named connection matches all the details if (conn != null) { if (conn.Provider == provider && conn.ConnectionString == connStr) { return(conn); } } //Then to find matching open connection foreach (string connName in connMgr.GetConnectionNames()) { FdoConnection c = connMgr.GetConnection(connName); if (c.Provider == provider && c.ConnectionString == connStr) { name = connName; return(c); } } //Make a new connection LoggingService.Info(ResourceService.GetString("INFO_REFERENCED_CONNECTION_NOT_FOUND")); conn = new FdoConnection(provider, connStr); if (!string.IsNullOrEmpty(configPath) && System.IO.File.Exists(configPath)) { conn.SetConfiguration(configPath); } connMgr.AddConnection(name, conn); return(conn); }
public ProjectReferencePanel(ISelectReferenceDialog selectDialog) { this.selectDialog = selectDialog; ColumnHeader nameHeader = new ColumnHeader(); nameHeader.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.ProjectReferencePanel.NameHeader"); nameHeader.Width = 170; Columns.Add(nameHeader); ColumnHeader directoryHeader = new ColumnHeader(); directoryHeader.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.ProjectReferencePanel.DirectoryHeader"); directoryHeader.Width = 290; Columns.Add(directoryHeader); View = View.Details; Dock = DockStyle.Fill; FullRowSelect = true; ItemActivate += delegate { AddReference(); }; PopulateListView(); Panel upperPanel = new Panel { Dock = DockStyle.Top, Height = 20 }; filterTextBox = new TextBox { Width = 150, Dock = DockStyle.Right }; filterTextBox.TextChanged += delegate { Search(); }; upperPanel.Controls.Add(filterTextBox); this.Controls.Add(upperPanel); }
public TestController() { Log.Instance = new TestLogger(); // Create root services first. var systemInformationService = new SystemInformationService(); var apiService = new ApiService(); ApiService = new ApiService(); BackupService = new BackupService(); StorageService = new StorageService(); TimerService = new TestTimerService(); DaylightService = new TestDaylightService(); DateTimeService = new TestDateTimeService(); SettingsService = new SettingsService(BackupService, StorageService); ResourceService = new ResourceService(BackupService, StorageService, SettingsService); SchedulerService = new SchedulerService(TimerService, DateTimeService); NotificationService = new NotificationService(DateTimeService, ApiService, SchedulerService, SettingsService, StorageService, ResourceService); SystemEventsService = new SystemEventsService(this, NotificationService, ResourceService); AutomationService = new AutomationService(SystemEventsService, systemInformationService, apiService); ComponentService = new ComponentService(SystemEventsService, systemInformationService, apiService, SettingsService); AreaService = new AreaService(ComponentService, AutomationService, SystemEventsService, systemInformationService, apiService, SettingsService); }
public List <ListViewItem> CreateItems() { bool showExternalMethods = DebuggingOptions.Instance.ShowExternalMethods; bool lastItemIsExternalMethod = false; List <ListViewItem> items = new List <ListViewItem>(); foreach (StackFrame frame in debuggedProcess.SelectedThread.GetCallstack(100)) { ListViewItem item; if (frame.HasSymbols || showExternalMethods) { // Show the method in the list item = new ListViewItem(new string[] { GetFullName(frame), "" }); lastItemIsExternalMethod = false; } else { // Show [External methods] in the list if (lastItemIsExternalMethod) { continue; } item = new ListViewItem(new string[] { ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ExternalMethods"), "" }); lastItemIsExternalMethod = true; } item.Tag = frame; item.ForeColor = frame.HasSymbols ? Color.Black : Color.Gray; items.Add(item); Utils.DoEvents(debuggedProcess); } return(items); }
public void AddItem(string fileName) { string folderName = ResourceService.GetString("ICSharpCode.SharpDevelop.Commands.ProjectBrowser.SolutionItemsNodeText"); SolutionFolderNode node = null; foreach (TreeNode n in Nodes) { node = n as SolutionFolderNode; if (node != null && node.Folder.Name == folderName) { break; } node = null; } if (node == null) { ISolutionFolder newSolutionFolder = solution.CreateFolder(folderName); solution.Save(); node = new SolutionFolderNode(newSolutionFolder); node.InsertSorted(this); } node.AddItem(fileName); }
/// <summary> ///按关键字或编号,上传时间,有效期,分类,审核状态搜索资源, /// </summary> /// <returns></returns> public static DataSet Search(string keyword, string beginDate, string endDate, string Catalogid, string Userid, int PageSize, int PageNum, ref int pageCount, string resourceType, string groupid,int validateStatus) { /** 使用索引搜索开始 *****************************/ if (ResourceIndex.IsUsingIndex) { if (Catalogid.Equals(new Guid().ToString())) { Catalogid = ""; } else { Catalogid = " " + Catalogid; } if (!string.IsNullOrEmpty(groupid.Trim())) { groupid = " " + groupid; } else { groupid = ""; } PageNum++; return ResourceIndex.Search(keyword + Catalogid + groupid, beginDate, endDate, Userid, PageSize, PageNum, ref pageCount, resourceType); } /** 使用索引搜索结束 *******************************/ QJVRMS.Business.ResourceWS.ResourceService rs = new ResourceService(); return rs.SearchResource(keyword, beginDate, endDate, Catalogid, Userid, PageSize, PageNum, ref pageCount, resourceType, groupid,validateStatus); }
public void AddSkillsForAResources_AddTheSameSkillTwice_AnExceptionShouldBeThrown() { var resource = CreateSampleResource(); var skill = CreateSampleSkill(); var resourceService = new ResourceService(RavenSession); resourceService.AddSkillForAResource(resource, skill, 2); resourceService.AddSkillForAResource(resource, skill, 3); }
/// <summary> /// /// </summary> /// <param name="filaName"></param> /// <param name="fileType"></param> /// <param name="downusername"></param> /// <param name="usage"></param> /// <param name="enduser"></param> /// <param name="folder"></param> /// <param name="Errflag"></param> /// <param name="resourceType"></param> public static void Production_Hires_Down_Log(string filaName, string fileType, string downusername, string usage, string enduser, string folder, bool Errflag,string resourceType) { //ImageStorageService iss = new ImageStorageService(); ResourceService rs = new ResourceService(); rs.Production_Hires_Down_Log(filaName, fileType, downusername, usage, enduser, folder, Errflag,resourceType); }
/// <summary> /// 下载次数统计 /// </summary> /// <param name="resourceType">资源类型 image,video,document,other</param> /// <param name="startDate">起始日期</param> /// <param name="endDate">结束日期</param> /// <returns></returns> public DataTable GetDownloadStatic(string resourceType, DateTime startDate, DateTime endDate) { ResourceService rs = new ResourceService(); return rs.GetDownloadStatic(resourceType, startDate, endDate); }
public void RemoveSkillFromResource_TheResourceShouldRemainOneSkillLess() { var resource = CreateSampleResource(); var skill = CreateSampleSkill(); var skill2 = CreateSampleSkill(); var resourceService = new ResourceService(RavenSession); resourceService.AddSkillForAResource(resource, skill, 2); resourceService.AddSkillForAResource(resource, skill2, 3); RavenSession.SaveChanges(); var fetchedResource = RavenSession.Load<Resource>(resource.Id); Assert.AreEqual(2 , fetchedResource.Skills.Count); resourceService.RemoveSkillFromResource(resource, skill); RavenSession.SaveChanges(); var fetchedResource2 = RavenSession.Load<Resource>(resource.Id); Assert.AreEqual(1, fetchedResource2.Skills.Count); }
public void AddSkillsForAResource_MakeSureDuplicateAreHandled() { //Setup var resource = CreateSampleResource(); var skill = CreateSampleSkill(); //Act var resourceService = new ResourceService(RavenSession); resourceService.AddSkillForAResource(resource, skill, 4); var resource2 = CreateSampleResource(); resourceService.AddSkillForAResource(resource2, skill, 3); RavenSession.SaveChanges(); var skills = RavenSession.Query<Skill>().Where(a=>a.Name == skill.Name); //Assert Assert.AreEqual(1, skills.Count()); }
/// <summary> /// 返回某个订单所包含的资源列表 /// </summary> /// <param name="orderId">订单ID</param> /// <returns></returns> public static DataSet GetResourcesByOrderId(string orderId) { ResourceService rs = new ResourceService(); return rs.GetResourcesByOrderId(orderId); }
/// <summary> /// 添加附件 /// </summary> /// <param name="itemId"></param> /// <param name="fileName"></param> /// <param name="fileLength"></param> /// <returns></returns> public static bool AddAttach(string itemId, string fileName,long fileLength) { ResourceService rs = new ResourceService(); return rs.AddAttach( itemId,fileName,fileLength); }
/// <summary> ///获取某人上传的资源 /// </summary> /// <returns></returns> public DataSet GetResourceByUserID(string beginDate, string endDate, string Userid, int PageSize, int PageNum, ref int rowCount, string resourceType,int validateStatus) { ResourceService rs = new ResourceService(); return rs.GetResourceByUserID(beginDate, endDate, Userid, PageSize, PageNum, ref rowCount, resourceType,validateStatus); }
/// <summary> /// 返回某个资源的所有附件列表 /// </summary> /// <param name="itemId"></param> /// <returns></returns> public static DataTable GetAttachList(Guid itemId) { ResourceService rs = new ResourceService(); return rs.GetAttachList(itemId); }
public ResourceEntity GetResourceInfoBySN(string sn) { ResourceEntity r = new ResourceEntity(); ResourceService rs = new ResourceService(); DataSet ds = rs.GetResourceInfoBySN(sn); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; r.Caption = dr["caption"].ToString(); r.ItemSerialNum = dr["itemserialnumber"].ToString(); r.FileName = dr["clientfilename"].ToString(); r.FolderName = dr["ServerFolderName"].ToString(); r.ServerFileName = dr["serverfilename"].ToString(); //v.FlvFilename= dr["flvfilename"].ToString(); //v.FlvFilePath= dr["flvfilepath"].ToString(); r.StartDate = Convert.ToDateTime(dr["startdate"]); r.EndDate = Convert.ToDateTime(dr["EndDate"]); r.uploadDate = Convert.ToDateTime(dr["uploadDate"]); r.shotDate = Convert.ToDateTime(dr["shotDate"]); r.Keyword = dr["Keywords"].ToString(); r.Description = dr["Description"].ToString(); r.updateDate = Convert.ToDateTime(dr["updatedate"]); r.userId = new Guid(dr["userid"].ToString()); r.Status = Convert.ToInt32(dr["status"].ToString()); r.ItemId = new Guid(dr["id"].ToString()); r.ResourceType=dr["resourceType"].ToString(); r.FileSize = Convert.ToInt32(dr["filesize"].ToString()); r.Author = dr["author"].ToString(); } return r; }
/// <summary> /// 删除一个资源 /// </summary> /// <param name="itemId"></param> /// <returns></returns> public static bool DeleteResource(Guid itemId) { ResourceService rs = new ResourceService(); //同时更新索引 DataSet ds = rs.GetResourceInfoByItemId(itemId.ToString()); if (ds.Tables[0].Rows.Count > 0) { string[] SNs = new string[] { ds.Tables[0].Rows[0]["ItemSerialNumber"].ToString() }; ResourceIndex.deleteIndex(SNs); } return rs.DeleteResource(itemId); }
/// <summary> /// 更新资源的浏览次数 /// </summary> /// <param name="id">资源 ID</param> public void UpdateResourceViewCount(string id) { ResourceService rs = new ResourceService(); rs.UpdateResourceViewCount(id); }
/// <summary> /// 统计信息 /// </summary> /// <returns></returns> public static DataTable GetStatResources() { QJVRMS.Business.ResourceWS.ResourceService rs = new ResourceService(); return rs.GetResourceStatic(); }
/// <summary> /// 下载排行,100张,从数据库中直接取 /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="pageSize"></param> /// <param name="pageNum"></param> /// <param name="resourceType"></param> /// <returns></returns> public DataSet GetResourcesByDownloadCount(DateTime startDate, DateTime endDate, int pageSize, int pageNum, string resourceType) { ResourceService rs = new ResourceService(); return rs.GetResourcesByDownloadCount(startDate, endDate, pageSize, pageNum, resourceType); }
/// <summary> /// 删除下载记录 /// </summary> /// <param name="logId"></param> /// <returns></returns> public static bool DeleteDownLog(int logId) { //QJVRMS.Business.ImageStorageWS.ImageStorageService iss = new QJVRMS.Business.ImageStorageWS.ImageStorageService(); ResourceService rs = new ResourceService(); return rs.DeleteDownMessage(logId); }
/// <summary> /// 获取审核不通过的资源 /// </summary> /// <param name="userName"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="pageSize"></param> /// <param name="pageIndex"></param> /// <returns></returns> public DataSet GetNotPassResources(string userName, DateTime startDate, DateTime endDate, int pageSize, int pageIndex) { ResourceService rs = new ResourceService(); return rs.GetNotPassResources(userName, startDate, endDate, pageSize, pageIndex); }
/// <summary> /// 保存资源的额外属性, 针对图片和视频来的 /// </summary> /// <param name="serialNumber"></param> /// <param name="de"></param> public void insertResourceAttributes(string serialNumber, DictionaryEntry[] de) { ResourceService rs = new ResourceService(); rs.insertResourceAttributes(serialNumber, de); }
/// <summary> /// 获取特定用户日期的下载记录信息 /// </summary> /// <param name="username"></param> /// <param name="beginDate"></param> /// <param name="endDate"></param> /// <returns></returns> public static DataSet GetDownLoadMessage(string username, DateTime beginDate, DateTime endDate) { // return QJVRMS.DataAccess.ImageStorage.GetDownLoadMessage(username, beginDate, endDate); // QJVRMS.Business.ImageStorageWS.ImageStorageService iss = new QJVRMS.Business.ImageStorageWS.ImageStorageService(); ResourceService rs = new ResourceService(); return rs.GetDownLoadMessage(username, beginDate, endDate); }
/// <summary> /// 上传日志, 从资源表中直接取的 /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="pageSize"></param> /// <param name="pageNum"></param> /// <param name="userId"></param> /// <returns></returns> public DataSet GetResourcesUploadLog(DateTime startDate, DateTime endDate, int pageSize, int pageNum, string userId) { ResourceService rs = new ResourceService(); return rs.GetResourceUploadLog(startDate, endDate, pageSize, pageNum, userId); }
/// <summary> /// 返回某个资源所属的分类,1个资源可以属于多个分类 /// </summary> /// <param name="itemId"></param> /// <returns></returns> public DataSet GetResourceCatalogByItemId(string itemId) { ResourceService rs = new ResourceService(); return rs.GetResourceCatalogByItemId(itemId); }
public async Task ContextLoadExternalResources() { var delayRequester = new DelayRequester(100); var imageService = new ResourceService<IImageInfo>("image/jpeg", response => new MockImageInfo { Source = response.Address }); var config = new Configuration().WithDefaultLoader(m => m.IsResourceLoadingEnabled = true, new[] { delayRequester }).With(imageService); var context = BrowsingContext.New(config); var document = await context.OpenAsync(m => m.Content("<img src=whatever.jpg>")); var img = document.QuerySelector<IHtmlImageElement>("img"); Assert.AreEqual(1, delayRequester.RequestCount); Assert.IsTrue(img.IsCompleted); }
public ImageInfo GetImageInfoBySN(string sn) { ResourceService rs = new ResourceService(); ImageInfo o = null; DataSet ds = rs.GetResourceInfoBySN(sn); if (ds.Tables[0].Rows.Count > 0) { o = new ImageInfo(); DataRow dr = ds.Tables[0].Rows[0]; o.Width = 0; o.Height = 0; o.Hvsp = string.Empty; if (ds.Tables[0].Columns.Contains("Width")) { o.Width = Convert.ToInt32(dr["Width"].ToString()); } if (ds.Tables[0].Columns.Contains("Height")) { o.Height = Convert.ToInt32(dr["Height"].ToString()); } if (ds.Tables[0].Columns.Contains("Hvsp")) { o.Hvsp = dr["Hvsp"].ToString(); } } return o; }
public void ImageElementRetrievePictureFromPictureTypeSelectionSupportWebp() { var source = @"<picture> <source type=""image/svg+xml"" srcset=""logo.xml""> <source type=""image/webp"" srcset=""logo.webp""> <img src=""logo.png"" alt=""ACME Corp""> </picture>"; var service = new ResourceService<IImageInfo>("image/webp", resp => null); var config = Configuration.Default.With(service); var img = Construct(source, config); var candidate = img.GetImageCandidate(); Assert.AreEqual(BaseUrl + "/logo.webp", candidate.Href); }
/// <summary> /// 根据开始和结束日期及用户名查询管理记录 /// </summary> /// <param name="username"></param> /// <param name="beginDate"></param> /// <param name="endDate"></param> /// <returns></returns> public static DataSet SearchDownloadManagerByLoginName(string username) { //return QJVRMS.DataAccess.ImageStorage.SearchDownloadManagerByLoginNameAndDate(username); //QJVRMS.Business.ImageStorageWS.ImageStorageService iss = new QJVRMS.Business.ImageStorageWS.ImageStorageService(); ResourceService rs = new ResourceService(); return rs.GetDownloadMessageByLoginName(username); }
public static void DeleteAttach(Guid attId) { ResourceService rs = new ResourceService(); rs.DeleteAttach(attId); }
public VideoStorage GetVideoInfoBySN(string sn) { ResourceService rs = new ResourceService(); VideoStorage v = null; DataSet ds = rs.GetResourceInfoBySN(sn); if (ds.Tables[0].Rows.Count > 0) { v = new VideoStorage(); DataRow dr = ds.Tables[0].Rows[0]; v.Bitrate = string.Empty; v.ClipLength = string.Empty; v.ClipSize = string.Empty; if (ds.Tables[0].Columns.Contains("bitrate")) { v.Bitrate = dr["bitrate"].ToString(); } if (ds.Tables[0].Columns.Contains("ClipLength")) { v.ClipLength = dr["ClipLength"].ToString(); } if (ds.Tables[0].Columns.Contains("ClipSize")) { v.ClipSize = dr["ClipSize"].ToString(); } } return v; }