public FavoriteRenameCommand(IPersistence persistence, IRenameService service) { this.persistence = persistence; this.service = service; this.favorites = persistence.Favorites; this.validator = new FavoriteNameValidator(this.persistence); }
public void Save(IPersistence objectToSave) { BinaryFormatter formatter = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/" + objectToSave.FileName, FileMode.OpenOrCreate); formatter.Serialize(file, objectToSave); file.Close(); }
public NewTerminalForm(IPersistence persistence, IFavorite favorite) : this() { this.persistence = persistence; this.InitializeFavoritePropertiesControl(); this.Init(favorite, String.Empty); }
internal CredentialManager(IPersistence persistence) { InitializeComponent(); this.persistence = persistence; Credentials.CredentialsChanged += new EventHandler(this.CredentialsChanged); }
public static void RestoreWindowState(this Bootstrapper bootstrapper, IPersistence persistence) { if (!bootstrapper.Application.IsRunningOutOfBrowser) return; var mainWindow = bootstrapper.Application.MainWindow; var windowInfo = persistence.ReadTextFile(WindowSettingsFilename); if (string.IsNullOrWhiteSpace(windowInfo)) return; try { var posAndSize = XDocument.Parse(windowInfo).Descendants("MainWindow").FirstOrDefault(); if (posAndSize == null) return; if (bool.Parse(posAndSize.Attribute("IsMaximized").Value)) mainWindow.WindowState = WindowState.Maximized; else { mainWindow.Width = int.Parse(posAndSize.Attribute("Width").Value); mainWindow.Height = int.Parse(posAndSize.Attribute("Height").Value); mainWindow.Top = int.Parse(posAndSize.Attribute("Top").Value); mainWindow.Left = int.Parse(posAndSize.Attribute("Left").Value); } } catch (Exception ex) { log.Warn("Error setting window position from saved settings! {0}", ex); persistence.DeleteFile(WindowSettingsFilename); } }
public NewTerminalForm(IPersistence persistence, String serverName) : this() { this.persistence = persistence; this.InitializeFavoritePropertiesControl(); this.Init(null, serverName); }
private void InitializePersistence() { if (Settings.Instance.PersistenceType == FilePersistence.TYPE_ID) this.persistence = new FilePersistence(); else this.persistence = new SqlPersistence(); }
private void LoadFavorites(IPersistence persistence) { IFavorites favorites = persistence.Favorites; string[] favoriteNames = favorites.Select(f => f.Name).ToArray(); this.inputTextbox.AutoCompleteCustomSource = new AutoCompleteStringCollection(); this.inputTextbox.AutoCompleteCustomSource.AddRange(favoriteNames); }
internal static void AddFavoriteIntoGroups(IPersistence persistence, IFavorite toPerisist, IEnumerable<string> validGroupNames) { foreach (string groupName in validGroupNames) { IGroup group = FavoritesFactory.GetOrAddNewGroup(persistence, groupName); group.AddFavorite(toPerisist); } }
internal ManageCredentialForm(IPersistence persistence, ICredentialSet editedCredential) { InitializeComponent(); this.persistence = persistence; this.editedCredential = editedCredential; FillControlsFromCredential(); }
public FirstRunWizard(IPersistence persistence) { InitializeComponent(); rdp.OnDiscoveryCompleted += new AddExistingRDPConnections.DiscoveryCompleted(rdp_OnDiscoveryCompleted); miv = new MethodInvoker(DiscoComplete); this.persistence = persistence; this.mp.AssignPersistence(persistence); }
public Mqtt(string connString, string clientID, IPersistence store) { _store = store; qosManager = new QoSManager(_store); manager = new StreamManager(connString, qosManager); qosManager.MessageReceived += new QoSManager.MessageReceivedDelegate(qosManager_MessageReceived); _clientID = clientID; }
internal OrganizeGroupsForm(IPersistence persistence) { this.persistence = persistence; InitializeComponent(); this.gridGroups.AutoGenerateColumns = false; this.gridGroupFavorites.AutoGenerateColumns = false; LoadGroups(); }
public void AssignPersistence(IPersistence persistence) { if (persistence.Security.IsMasterPasswordDefined) { this.EnableMasterPassword.Checked = true; this.EnableMasterPassword.Enabled = false; this.panel1.Enabled = false; } }
/// <summary> /// Dont call from constructor to support designer /// </summary> internal void Load(IPersistence persistence) { this.persistence = persistence; var connectionHistory = this.persistence.ConnectionHistory; connectionHistory.HistoryRecorded += new HistoryRecorded(this.HistoryRecorded); connectionHistory.HistoryClear += new Action(this.ConnectionHistory_HistoryClear); // init groups before loading the history to prevent to run the callback earlier InitializeTimeLineTreeNodes(); }
internal OrganizeFavoritesForm(IPersistence persistence) { InitializeComponent(); this.persistence = persistence; InitializeDataGrid(); var integrations = Integrations.CreateImporters(this.persistence); ImportOpenFileDialog.Filter = integrations.GetProvidersDialogFilter(); UpdateCountLabels(); }
/// <summary> /// Shows this dialog to the user asking for group name. /// If user confirms, the entered value is returned; otherwiser returns empty string. /// </summary> internal static string AskFroGroupName(IPersistence persistence) { using (var frmNewGroup = new NewGroupForm()) { if (frmNewGroup.ShowDialog() == DialogResult.OK) return ValidateNewGroupName(persistence, frmNewGroup.txtGroupName.Text); return string.Empty; } }
public ExportForm(IPersistence persistence) { this.persistence = persistence; this.InitializeComponent(); this.treeLoader = new FavoriteTreeListLoader(this.favsTree, this.persistence); this.treeLoader.LoadRootNodes(); this.saveFileDialog.Filter = Integrations.Exporters.GetProvidersDialogFilter(); this.rootNodes = new TreeListNodes(this.favsTree.Nodes); }
internal FavoritesMenuLoader(MainForm mainForm, IPersistence persistence) { this.persistence = persistence; AssignMainFormFields(mainForm); this.favoritesToolStripMenuItem.DropDownItems.Add("-"); CreateUntaggedItem(); CreateTrayMenuItems(); UpdateMenuAndContextMenu(); RegisterEventHandlers(); }
private static string ValidateNewGroupName(IPersistence persistence, string newGroupName) { string message = new GroupNameValidator(persistence).ValidateNew(newGroupName); if (string.IsNullOrEmpty(message)) return newGroupName; MessageBox.Show(message, "New Group name is not valid", MessageBoxButtons.OK, MessageBoxIcon.Error); return string.Empty; }
public Mqtt(string connString, string clientID, string username, string password, IPersistence store) { _store = store; qosManager = new QoSManager(_store); manager = new StreamManager(connString, qosManager); qosManager.MessageReceived += new QoSManager.MessageReceivedDelegate(qosManager_MessageReceived); _clientID = clientID; _username = username; _password = password; }
internal FavoriteTreeListLoader(FavoritesTreeView treeListToFill, IPersistence persistence) { this.treeList = treeListToFill; this.treeList.AfterExpand += new TreeViewEventHandler(this.OnTreeViewExpand); this.persistedGroups = persistence.Groups; this.favorites = persistence.Favorites; this.dispatcher = persistence.Dispatcher; this.dispatcher.GroupsChanged += new GroupsChangedEventHandler(this.OnGroupsCollectionChanged); this.dispatcher.FavoritesChanged += new FavoritesChangedEventHandler(this.OnFavoritesCollectionChanged); }
/// <summary> /// Initialize new instance of the upgrade providing fresh not initialized persistence and password prompt. /// </summary> /// <param name="persistence">Not null,not authenticated, not initialized persistence</param> /// <param name="knowsUserPassword">Not null password prompt to obtain current master password from user</param> internal FilesV2ContentUpgrade(IPersistence persistence, Func<bool, AuthenticationPrompt> knowsUserPassword) { this.persistence = persistence; // prevents ask for password two times this.passwordsUpdate = new PasswordsV2Update(retry => { this.prompt = knowsUserPassword(retry); return this.prompt; }); }
public void SetUp() { _mockery = new MockRepository(); _instancePlugin = _mockery.DynamicMock<IPersistence>(); ThreadContext.Create("EasyArchitecture.Tests"); ThreadContext.GetCurrent().SetInstance(new EasyArchitecture.Instances.Persistence.Persistence(_instancePlugin)); ThreadContext.GetCurrent().SetInstance(new EasyArchitecture.Instances.Log.Logger(MockRepository.GenerateStub<ILogger>())); _dog = new Dog { Age = 15, Name = "Old Dog" }; }
internal CopyFavoriteCommand(IPersistence persistence, Func<InputBoxResult> copyPrompt = null) { this.favorites = persistence.Favorites; var renameService = new RenameCopyService(persistence.Favorites); renameService.RenameAction = this.AddIfValid; // property injection this.renameCommand = new FavoriteRenameCommand(persistence, renameService); if (copyPrompt != null) this.copyPrompt = copyPrompt; else this.copyPrompt = () => InputBox.Show("Enter new name:", "Duplicate selected favorite as ..."); }
internal NetworkScanner(IPersistence persistence) { InitializeComponent(); this.persistence = persistence; this.server = new Server(persistence); FillTextBoxesFromLocalIp(); InitScanManager(); this.gridScanResults.AutoGenerateColumns = false; Client.OnServerConnection += new ServerConnectionHandler(Client_OnServerConnection); this.bsScanResults.DataSource = new SortableList<NetworkScanResult>(); }
internal TreeViewDragDrop(IPersistence persistence, DragEventArgs dragArguments, IKeyModifiers keyModifiers, IGroup targetGroup, IFavorite targetFavorite) { this.Effect = DragDropEffects.None; this.data = dragArguments.Data; this.persistence = persistence; this.CopyCommnad = new CopyFavoriteCommand(this.persistence); this.keyModifiers = keyModifiers; this.targetGroup = targetGroup; this.targetFavorite = targetFavorite; this.Configure(dragArguments.Effect); }
public MainForm(IPersistence persistence) { try { this.persistence = persistence; settings.StartDelayedUpdate(); // Set default font type by Windows theme to use for all controls on form this.Font = SystemFonts.IconTitleFont; InitializeComponent(); // main designer procedure this.formSettings = new FormSettings(this); this.terminalsControler = new TerminalTabsSelectionControler(this.tcTerminals, this.persistence); this.connectionsUiFactory = new ConnectionsUiFactory(this, this.terminalsControler, this.persistence); this.terminalsControler.AssingUiFactory(this.connectionsUiFactory); // Initialize FavsList outside of InitializeComponent // Inside InitializeComponent it sometimes caused the design view in VS to return errors this.InitializeFavsListControl(); // Set notifyicon icon from embedded png image this.MainWindowNotifyIcon.Icon = Icon.FromHandle(Properties.Resources.terminalsicon.GetHicon()); this.menuLoader = new FavoritesMenuLoader(this, this.persistence); this.favoriteToolBar.Visible = this.toolStripMenuItemShowHideFavoriteToolbar.Checked; this.fullScreenSwitch = new MainFormFullScreenSwitch(this); this.tabControlRemover = new TabControlRemover(this.settings, this, this.tcTerminals); this.favsList1.Persistence = this.persistence; this.AssignToolStripsToContainer(); this.ApplyControlsEnableAndVisibleState(); this.menuLoader.LoadGroups(); this.UpdateControls(); this.LoadWindowState(); this.CheckForMultiMonitorUse(); this.tcTerminals.TabControlItemDetach += new TabControlItemChangedHandler(this.TcTerminals_TabDetach); this.tcTerminals.MouseClick += new MouseEventHandler(this.TcTerminals_MouseClick); this.QuickContextMenu.ItemClicked += new ToolStripItemClickedEventHandler(QuickContextMenu_ItemClicked); this.LoadSpecialCommands(); ProtocolHandler.Register(); this.persistence.AssignSynchronizationObject(this); } catch (Exception exc) { Logging.Error("Error loading the Main Form", exc); throw; } }
public OrganizeFavoritesToolbarForm(IPersistence persistence) { InitializeComponent(); IFavorites persistedFavorites = persistence.Favorites; ListViewItem[] listViewItems = settings.FavoritesToolbarButtons .Select(id => persistedFavorites[id]) .Where(candidate => candidate != null) .Select(favorite => new ListViewItem(favorite.Name) { Tag = favorite.Id }) .ToArray(); lvFavoriteButtons.Items.AddRange(listViewItems); }
public ConstructionYard(IDeployerFactory factory, string rootDir) { _factory = factory; _rootDir = rootDir; _garbage = _factory.CreateGarbage(); _logger = _factory.CreateLogger(); _persist = _factory.CreatePersistence(); var smallIo = _factory.CreateSmallTextIo(_persist); var jsonPersist = new JsonPersistence(smallIo); var slugCreator = new SlugCreator(); _configService = new RealConfigurationService(_rootDir, jsonPersist, slugCreator); }
protected virtual bool Retrieve(IPersistence persistence, ref ePersistence phase) { switch (phase) { case ePersistence.Initial: Reference = persistence.GetFieldValue(Constants.BaseNode_Reference, new Guid().ToString()); count = persistence.GetFieldValue(Constants.BaseNode_NodeCount, 0); if (NodeType == eNodeType.unknown) { NodeType = (eNodeType)Enum.Parse(typeof(eNodeType), persistence.GetFieldValue(Constants.BaseNode_Type, eNodeType.unknown.ToString()), true); } _Name = persistence.GetFieldValue(Constants.BaseNode_Name, ""); _Description = persistence.GetFieldValue(Constants.BaseNode_Description, ""); break; case ePersistence.Final: if (!IsReadOnly()) { for (int i = 0; i < count; i++) { if (persistence.NextRecord()) { string type = persistence.GetFieldValue(Constants.BaseNode_ClassType, Constants.BaseNode_ClassType); IBaseNode node = Tree.CreateNewNode(type); node.NodeLoaded += NodeLoaded; node.Parent = this; Nodes.Add(node); node.Retrieve(persistence); } } OnNodeLoaded(); } break; } return(true); }
public static void RestoreWindowState(this Bootstrapper bootstrapper, IPersistence persistence) { if (!bootstrapper.Application.IsRunningOutOfBrowser) { return; } var mainWindow = bootstrapper.Application.MainWindow; var windowInfo = persistence.ReadTextFile(WindowSettingsFilename); if (string.IsNullOrWhiteSpace(windowInfo)) { return; } try { var posAndSize = XDocument.Parse(windowInfo).Descendants("MainWindow").FirstOrDefault(); if (posAndSize == null) { return; } if (bool.Parse(posAndSize.Attribute("IsMaximized").Value)) { mainWindow.WindowState = WindowState.Maximized; } else { mainWindow.Width = int.Parse(posAndSize.Attribute("Width").Value); mainWindow.Height = int.Parse(posAndSize.Attribute("Height").Value); mainWindow.Top = int.Parse(posAndSize.Attribute("Top").Value); mainWindow.Left = int.Parse(posAndSize.Attribute("Left").Value); } } catch (Exception ex) { log.Warn("Error setting window position from saved settings! {0}", ex); persistence.DeleteFile(WindowSettingsFilename); } }
public void IterationSetup() { if (useLargeData) { largePersistence = new SqlitePersistence <LargeData>(PersistenceFilename); PersistedQueueConfiguration config = new PersistedQueueConfiguration { MaxItemsInMemory = itemsToKeepInMemory, PersistAllItems = true }; largeQueue = new PersistedQueue <LargeData>(largePersistence); } else { smallPersistence = new SqlitePersistence <int>(PersistenceFilename); PersistedQueueConfiguration config = new PersistedQueueConfiguration { MaxItemsInMemory = itemsToKeepInMemory }; smallQueue = new PersistedQueue <int>(smallPersistence, config); } }
public AtomicProjectionEngine( IPersistence persistence, ICommitEnhancer commitEnhancer, AtomicProjectionCheckpointManager atomicProjectionCheckpointManager, IAtomicReadmodelProjectorHelperFactory atomicReadmodelProjectorHelperFactory, INStoreLoggerFactory nStoreLoggerFactory) { Logger = NullLogger.Instance; _atomicProjectionCheckpointManager = atomicProjectionCheckpointManager; _persistence = persistence; _commitEnhancer = commitEnhancer; _atomicReadmodelProjectorHelperFactory = atomicReadmodelProjectorHelperFactory; _lastPositionDispatched = _atomicProjectionCheckpointManager.GetLastPositionDispatched(); _nStoreLoggerFactory = nStoreLoggerFactory; FlushTimeSpan = TimeSpan.FromSeconds(30); //flush checkpoint on db each 10 seconds. Logger.Info("Created Atomic Projection Engine"); MaximumDifferenceForCatchupPoller = 20000; Metrics.HealthChecks.RegisterHealthCheck("AtomicProjectionEngine", (Func <Metrics.HealthCheckResult>)GetHealthCheck); }
public static void SaveWindowState(this Bootstrapper bootstrapper, IPersistence persistence) { if (!bootstrapper.Application.IsRunningOutOfBrowser) { return; } var mainWindow = bootstrapper.Application.MainWindow; var xml = new XDocument( new XElement("WindowInfo", new XElement("MainWindow", new XAttribute("IsMaximized", mainWindow.WindowState == WindowState.Maximized), new XAttribute("Width", mainWindow.Width), new XAttribute("Height", mainWindow.Height), new XAttribute("Top", mainWindow.Top), new XAttribute("Left", mainWindow.Left) ) ) ); persistence.WriteTextFile(WindowSettingsFilename, xml.ToString(SaveOptions.DisableFormatting)); }
protected IPersistence getSubModel(int index) { IDomainObjectImpl domainObject = SubModels.Keys.ElementAt(index) as IDomainObjectImpl; IPersistence persistence = Persistence.Clone(SubModels[domainObject]); if (persistence == null && LinkSubtreeError != null) { LinkSubTree subTree = new LinkSubTree(SubModels[domainObject]); LinkSubtreeError.Invoke(subTree); if (subTree.Action == LinkSubTree.eLinkAction.Update) { domainObject.FullModelName = subTree.Link; SubModels[domainObject] = subTree.Link; return(getSubModel(index)); } } return(persistence); }
public DLLFunctions( EngineFuncs engineFuncs, IGlobalVars globals, EntityDictionary entityDictionary, IServerInterface serverInterface, IEntities entities, IGameClients gameClients, INetworking networking, IPersistence persistence, IPlayerPhysics playerPhysics) { EngineFuncs = engineFuncs ?? throw new ArgumentNullException(nameof(engineFuncs)); Globals = globals ?? throw new ArgumentNullException(nameof(globals)); EntityDictionary = entityDictionary ?? throw new ArgumentNullException(nameof(entityDictionary)); ServerInterface = serverInterface ?? throw new ArgumentNullException(nameof(serverInterface)); Entities = entities ?? throw new ArgumentNullException(nameof(entities)); GameClients = gameClients ?? throw new ArgumentNullException(nameof(gameClients)); Networking = networking ?? throw new ArgumentNullException(nameof(networking)); Persistence = persistence ?? throw new ArgumentNullException(nameof(persistence)); PlayerPhysics = playerPhysics ?? throw new ArgumentNullException(nameof(playerPhysics)); }
protected override bool Persist(IPersistence persistence, ref ePersistence phase) { base.Persist(persistence, ref phase); switch (phase) { case ePersistence.Initial: //Persist lVal if (lVal.Domain != null) { persistence.UpsertField(Constants.Domain_Reference, lVal.Domain.Reference); } if (lVal.Variable != null) { persistence.UpsertField(Constants.Variable_Reference, lVal.Variable.Reference); } persistence.UpsertField(Constants.Value, lVal.Value); //Persist rVal if (rVal.Domain != null) { persistence.UpsertField(Constants.Domain_Reference + "-r", rVal.Domain.Reference); } if (rVal.Variable != null) { persistence.UpsertField(Constants.Variable_Reference + "-r", rVal.Variable.Reference); } persistence.UpsertField(Constants.Value + "-r", rVal.Value); persistence.UpsertField(Constants.Branch_Evaluation, _BranchEvaluation.ToString()); persistence.UpsertField(Constants.Expression, _Expression); break; } return(true); }
public Task SetupAsync(CancellationToken ct = default) { if (ct.IsCancellationRequested) { return(Task.CompletedTask); } if (context.GrainIdentity.PrimaryKeyString != null) { var store = context.ActivationServices.GetRequiredService <IStore <string> >(); persistence = store.WithSnapshots <T>(GetType(), context.GrainIdentity.PrimaryKeyString, ApplyState); } else { var store = context.ActivationServices.GetRequiredService <IStore <Guid> >(); persistence = store.WithSnapshots <T>(GetType(), context.GrainIdentity.PrimaryKey, ApplyState); } return(persistence.ReadAsync()); }
protected void Init() { var identityConverter = new IdentityManager(new InMemoryCounterService()); MongoFlatIdSerializerHelper.IdentityConverter = identityConverter; identityConverter.RegisterIdentitiesFromAssembly(typeof(SampleId).Assembly); var url = new MongoUrl(ConfigurationManager.ConnectionStrings["readmodel"].ConnectionString); var client = new MongoClient(url); _db = client.GetDatabase(url.DatabaseName); _collection = GetCollection <SimpleTestAtomicReadModel>(); _collectionForAtomicAggregate = GetCollection <SimpleAtomicAggregateReadModel>(); _persistence = CreatePersistence(); _db.Drop(); _identityManager = new IdentityManager(new CounterService(_db)); GenerateContainer(); SimpleTestAtomicReadModel.TouchMax = Int32.MaxValue; }
protected override bool Retrieve(IPersistence persistence, ref ePersistence phase) { base.Retrieve(persistence, ref phase); switch (phase) { case ePersistence.Initial: List <string> data = new List <string>(); data.AddRange(persistence.GetFieldValues(Constants.DataDefinitionExport, "")); foreach (string json in data) { if (json != "") { IDataDefinitionExportImpl export = JsonConvert.DeserializeObject <IDataDefinitionExportImpl>(json); Exports.Add(export); } } break; } return(true); }
public DomainRuntime( IPersistence persistence, IAggregateFactory aggregateFactory, ISnapshotStore snapshots, ChunkProcessor processor) { _persistence = persistence; _aggregateFactory = aggregateFactory; _snapshots = snapshots; _streamsFactory = new StreamsFactory(persistence); if (processor != null) { _pollingClient = new PollingClient( persistence, 0, // <----- TODO: read from state? new LambdaSubscription(processor), NStoreNullLoggerFactory.Instance ); _pollingClient.Start(); } }
public ProcessManagerDispatcher( ProcessManagerConfiguration configuration, IMongoDatabase supportDatabase, ICommitPollingClientFactory pollingClientFactory, IPersistence persistence, ICommandBus commandBus, IMessageBus messageBus) { _configuration = configuration; _commandBus = commandBus; _checkpointCollection = supportDatabase.GetCollection <ProcessManagerCheckpoint>("sysPmCheckpoints"); _currentCheckpoint = _checkpointCollection.FindOneById(ProcessManagerId) ?? new ProcessManagerCheckpoint() { Id = ProcessManagerId, LastDispatchedPosition = 0 }; Logger = NullLogger.Instance; _client = pollingClientFactory.Create(persistence, "ProcessManager"); _client.AddConsumer("ProcessManager", Dispatch); _messageBus = messageBus; }
public PersistenceBatchAppendDecorator(IPersistence persistence, int batchSize, int flushTimeout) { _cts = new CancellationTokenSource(); var batcher = (IEnhancedPersistence)persistence; _batch = new BatchBlock <AsyncWriteJob>(batchSize, new GroupingDataflowBlockOptions() { // BoundedCapacity = 1024, CancellationToken = _cts.Token }); Task.Run(async() => { while (!_cts.IsCancellationRequested) { await Task.Delay(flushTimeout).ConfigureAwait(false); _batch.TriggerBatch(); } }); var processor = new ActionBlock <AsyncWriteJob[]> ( queue => batcher.AppendBatchAsync(queue, CancellationToken.None), new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount, BoundedCapacity = 1024, CancellationToken = _cts.Token } ); _batch.LinkTo(processor, new DataflowLinkOptions() { PropagateCompletion = true, }); _persistence = persistence; }
public Persistence(MetaObject owner, XmlNode node) : this(owner) { if (owner is IPersistent && (owner as IPersistent).Persistence != null) { IPersistence p = (owner as IPersistent).Persistence; this.schema = p.Schema; this.name = p.Name; } else { this.schema = owner.Model.DefaultPersistentSchema; this.name = owner.Name; } Init(Utils.Xml.GetAttrValue(node, "persisted", this.persisted), Utils.Xml.IsAttrExists(node, "persistentSchema"), Utils.Xml.GetAttrValue(node, "persistentSchema", this.schema), Utils.Xml.IsAttrExists(node, "persistentName"), Utils.Xml.GetAttrValue(node, "persistentName", owner.Name), Utils.Xml.IsAttrExists(node, "persistentType"), Utils.Xml.GetAttrValue(node, "persistentType", Const.EmptyName) ); }
private void RootNode_NodeLoaded(object sender, EventArgs e) { IBaseNode node = sender as IBaseNode; if (node != null && node.NodeType == eNodeType.VariableDefinitions) { if (Persistence != null) { int i = 0; while (i < SubModels.Keys.Count) { IPersistence persistence = getSubModel(i); if (persistence != null) { IDecisionTree subTree = IDecisionTreeInterface.Clone(); IBaseNode variables = subTree.LoadVariables(persistence); foreach (IBaseNode subModel in subTree.SubModels.Keys) { IDecisionTreeInterface.AddSubModel(subModel as IDomainObject); } IBaseNode baseNode = SubModels.Keys.ElementAt(i); List <IBaseNode> linkedVariables = LinkVariables(node, variables); foreach (IBaseNode linkedNode in linkedVariables) { baseNode.AddNode(linkedNode); } } i++; } } } }
internal static SharedFavorite ConvertFromFavorite(IPersistence persistence, FavoriteConfigurationElement Favorite) { var favoriteSecurity = new FavoriteConfigurationSecurity(persistence, Favorite); var fav = new SharedFavorite(); fav.Colors = Favorite.Colors; fav.ConnectToConsole = Favorite.ConnectToConsole; fav.DesktopShare = Favorite.DesktopShare; fav.DesktopSize = Favorite.DesktopSize; fav.DomainName = favoriteSecurity.ResolveDomainName(); fav.Name = Favorite.Name; fav.Port = Favorite.Port; fav.Protocol = Favorite.Protocol; fav.RedirectClipboard = Favorite.RedirectClipboard; fav.RedirectDevices = Favorite.RedirectDevices; fav.RedirectedDrives = Favorite.RedirectedDrives; fav.RedirectPorts = Favorite.RedirectPorts; fav.RedirectPrinters = Favorite.RedirectPrinters; fav.RedirectSmartCards = Favorite.RedirectSmartCards; fav.ServerName = Favorite.ServerName; fav.DisableWallPaper = Favorite.DisableWallPaper; fav.Sounds = Favorite.Sounds; var tagsConverter = new TagsConverter(); fav.Tags = tagsConverter.ResolveTags(Favorite); fav.ConsoleBackColor = Favorite.ConsoleBackColor; fav.ConsoleCols = Favorite.ConsoleCols; fav.ConsoleCursorColor = Favorite.ConsoleCursorColor; fav.ConsoleFont = Favorite.ConsoleFont; fav.ConsoleRows = Favorite.ConsoleRows; fav.ConsoleTextColor = Favorite.ConsoleTextColor; fav.VMRCAdministratorMode = Favorite.VMRCAdministratorMode; fav.VMRCReducedColorsMode = Favorite.VMRCReducedColorsMode; return(fav); }
public void CreateAndReadTopicTest() { // Arrange persistenceFactory = AssemblyFactory.LoadInstance <IPersistence>(Environment.CurrentDirectory, "EADN.Semester.QuizGame.Persistence.EF.dll"); Common.Topic readTopic; // Act using (DAL = persistenceFactory.GetDataAccesLayer()) { topicRepo = DAL.GetTopicRepository(); topicRepo.Create(testTopic); DAL.Save(); } using (DAL = persistenceFactory.GetDataAccesLayer()) { topicRepo = DAL.GetTopicRepository(); readTopic = topicRepo.Read(testTopic.Id); } // Assert Assert.AreEqual(testTopic.Id, readTopic.Id); Assert.AreEqual(testTopic.Name, readTopic.Name); Assert.AreEqual(testTopic.Text, readTopic.Text); }
public virtual void Read(IPersistence persistence) { if (IsPersistent) { string data = persistence.ReadFile(SavePath + FILE_EXT); if (!string.IsNullOrEmpty(data)) { JsonObject serializer = null; try { JsonParser parser = new JsonParser(); parser.Parse(data); serializer = parser.Flush(); } finally { if (serializer != null) { Deserialize(serializer); } } } } }
public void SetUp() { computerPersistence = Substitute.For <IPersistence <Computer> >(); laptopPersistence = Substitute.For <IPersistence <Laptop> >(); computerPersistence.Load().Returns(new System.Collections.Generic.List <Computer> { new Computer { Id = 1, ComputerType = "Desktop PC" } }); laptopPersistence.Load().Returns(new System.Collections.Generic.List <Laptop> { new Laptop { Id = 3, ComputerType = "Laptop" } }); sut = new InventoryController(computerPersistence, laptopPersistence); }
public void CreateAndReadQuizTest() { // Arrange persistenceFactory = AssemblyFactory.LoadInstance <IPersistence>(Environment.CurrentDirectory, "EADN.Semester.QuizGame.Persistence.EF.dll"); Common.Quiz readQuiz; // Act using (DAL = persistenceFactory.GetDataAccesLayer()) { quizRepo = DAL.GetQuizRepository(); quizRepo.Create(testQuiz); DAL.Save(); } using (DAL = persistenceFactory.GetDataAccesLayer()) { quizRepo = DAL.GetQuizRepository(); readQuiz = quizRepo.Read(testQuiz.Id); } // Assert Assert.AreEqual(testQuiz.Id, readQuiz.Id); Assert.AreEqual(testQuiz.Name, readQuiz.Name); Assert.AreEqual(testQuiz.QuizType, readQuiz.QuizType); }
public MedicineService(IPersistence persistence) { _persistence = persistence; }
public BaseRepository(ISourceInjectedQueryable <TModel> source, IPersistence <TSource> persistence) { Source = source; Persistence = persistence; }
internal UntagedMenuItem(IPersistence persistence) : base(UNTAGGED_NODENAME, true) { this.persistence = persistence; }
public SaveSystem(IPersistence persistence) { this.persistence = persistence; }
public MasterGolonganService(IPersistence persistence) { golongan = persistence.MasterGolongan; }
protected override void OnSetup() { persistence = store.WithSnapshotsAndEventSourcing(GetType(), Id, new HandleSnapshot <T>(ApplySnapshot), x => ApplyEvent(x, true)); }
public SmallTextFileIo(IPersistence persistence) { _persistence = persistence; }
public LogDecorator(IPersistence persistence, INStoreLoggerFactory inStoreLoggerFactory) { _persistence = persistence; _logger = inStoreLoggerFactory.CreateLogger("Persistence"); }