public TCPManager(string _ServerIPAddress, int _ServerPORT) { this.ip = _ServerIPAddress; this.port = _ServerPORT.ToString(); this._collection = new ObservableCollection <UserInfo>(); _itemsLock = new object(); BindingOperations.EnableCollectionSynchronization(this._collection, _itemsLock); try { _tcpClient = new TcpClient(_ServerIPAddress, _ServerPORT); _stream = _tcpClient.GetStream(); connected = true; } catch (ArgumentNullException e) { Console.WriteLine("ArgumentNullException: {0}", e); } catch (SocketException e) { Console.WriteLine("SocketException: {0}", e); } }
public SMSEngine() { miscDAL = new DAL.MiscDAL(); Modems = new List <Modem>(); ApplicationLogsList = new ObservableCollection <ApplicationLog>(); //Enable the cross acces to this collection elsewhere BindingOperations.EnableCollectionSynchronization(ApplicationLogsList, _syncLock); message = "Starting SMS Engine"; AddLog(EventLevel.Information.ToString(), DateTime.Now, EventSource.Initilization.ToString(), message); try { ConLocal = miscDAL.OpenLocalDatabaseConnection(); ConLocalSync = miscDAL.OpenLocalDatabaseConnection(); m_SmsNos = miscDAL.GetSMSQueue(ConLocal); StartDataTimer(); StartSMSEngine(); try { OpenOnlineConnectionAsync(); //ConOnline = miscDAL.OpenOnlineDatabaseConnection(); //m_IsOnlineConnectionOpen = true; } catch (Exception ex) { m_IsOnlineConnectionOpen = false; message = "Online Server Exception: " + ex.Message; AddLog(EventLevel.Information.ToString(), DateTime.Now, EventSource.Initilization.ToString(), message); //MessageBox.Show(ex.Message); } } catch (Exception ex) { message = "Exception: " + ex.Message; AddLog(EventLevel.Information.ToString(), DateTime.Now, EventSource.Initilization.ToString(), message); MessageBox.Show(ex.Message); } }
/// <summary> /// Конструктор. Полностью инициализирует закрытые <see cref="Cells"/> ячейки и выполняет /// пре-инициализацю для <see cref="UserCells"/> /// </summary> public SudokuViewModel() { m_lock = new object(); Cells = new ObservableCollection <Cell>(); UserCells = new ObservableCollection <Cell>(); PreInitCells(Cells); PreInitCells(UserCells); InitCellsCollections(Cells); FillCells(); /// <summary> /// Необходимо для возможности доступа к являющимся предметом Binding <see cref="UserCells"/> /// из другого потока (в данном случае для инициализации и нежелания блокировать UI) /// </summary> BindingOperations.EnableCollectionSynchronization(UserCells, m_lock); timer = new System.Timers.Timer(1000); timer.Elapsed += Timer_Elapsed; userData = new UserDataWorker(); UserStatistics = userData.LoadStatistics(); Game = new Game(); }
protected virtual void SetViewModelData() { IEnumerable <T> data = repository.ViewModelData; //ColView = CollectionViewSource.GetDefaultView(data); if (data != null) { VmData = new ObservableCollection <T>(repository.ViewModelData); BindingOperations.EnableCollectionSynchronization(VmData, _shippingMethodLock); //EditEventHandler(); // VmData.CollectionChanged += VmData_CollectionChanged; } else { VmData = null; } }
public WindowExplorerApplicationRibbon( IWriteToOutput iWriteToOutput , IOrganizationServiceExtented service , CommonConfiguration commonConfig ) { this.IncreaseInit(); InputLanguageManager.SetInputLanguage(this, CultureInfo.CreateSpecificCulture("en-US")); this._iWriteToOutput = iWriteToOutput; this._commonConfig = commonConfig; _connectionCache[service.ConnectionData.ConnectionId] = service; BindingOperations.EnableCollectionSynchronization(service.ConnectionData.ConnectionConfiguration.Connections, sysObjectConnections); InitializeComponent(); var child = new ExportXmlOptionsControl(_commonConfig, _xmlOptions); child.CloseClicked += Child_CloseClicked; this._optionsPopup = new Popup { Child = child, PlacementTarget = toolBarHeader, Placement = PlacementMode.Bottom, StaysOpen = false, Focusable = true, }; LoadFromConfig(); cmBCurrentConnection.ItemsSource = service.ConnectionData.ConnectionConfiguration.Connections; cmBCurrentConnection.SelectedItem = service.ConnectionData; this.DecreaseInit(); }
public BankModel() { Cells = new ObservableRangeCollection <CellModel>(); BindingOperations.EnableCollectionSynchronization(Cells, cellsLock); Modules = new ObservableRangeCollection <ModuleModel>(); BindingOperations.EnableCollectionSynchronization(Modules, modulesLock); Led = new ObservableRangeCollection <bool?>(); DryContact = new ObservableRangeCollection <bool?>(); InputSignal = new ObservableRangeCollection <bool?>(); for (int i = 0; i < 8; i++) { Led.Add(null); DryContact.Add(null); InputSignal.Add(null); } for (int i = 0; i < 8; i++) { DryContact.Add(null); } }
/// <summary> /// Check if the suffix is a number or not /// </summary> /// <param name="cmddata_p"></param> public MainForm(ExternalCommandData cmddata_p) { this.DataContext = this; this.p_commanddata = cmddata_p; InitializeComponent(); _changedElements = new ObservableCollection <ElementId>(); BindingOperations.EnableCollectionSynchronization(_changedElements, _changedElementsLock); _receivedElements = new ObservableCollection <ElementId>(); BindingOperations.EnableCollectionSynchronization(_receivedElements, _receviedElementslock); cleanVariables(); this._doc = cmddata_p.Application.ActiveUIDocument.Document; bool connected = ConnectToDB(); FireBaseConnection.ReceiveChangesFromDB(); this.Closed += ClosingWindow; this.SendChangesList.ItemsSource = _changedElements; this.ReceiveChangesList.ItemsSource = _receivedElements; }
protected AttributeDockpaneViewModel() { // By default, WPF data bound collections must be modified on the thread where the bound WPF control was created. // This limitation becomes a problem when you want to fill the collection from a worker thread to produce a nice experience. // For example, a search result list should be gradually filled as more matches are found, without forcing the user to wait until the // whole search is complete. // To get around this limitation, WPF provides a static BindingOperations class that lets you establish an // association between a lock and a collection (e.g., ObservableCollection\<T>). // This association allows bound collections to be updated from threads outside the main GUI thread, // in a coordinated manner without generating the usual exception. BindingOperations.EnableCollectionSynchronization(_featureLayers, _lockFeaturelayers); // subscribe to the map view changed event... that's when we update the list of feature layers ActiveMapViewChangedEvent.Subscribe(OnActiveViewChanged); ActivePaneChangedEvent.Subscribe(OnActivePaneChanged); // subscribe to the selection changed event ... that's when we refresh our features MapSelectionChangedEvent.Subscribe(OnMapSelectionChanged); // hook ArcGIS Pro Button var toolWrapper = FrameworkApplication.GetPlugInWrapper(DAML.Tool.esri_mapping_selectByRectangleTool); var toolCmd = toolWrapper as ICommand; // tool and command(Button) supports this if (toolCmd != null) { SelectionTool = new RelayCommand(param => toolCmd.Execute(null), param => toolCmd.CanExecute(null)); } var closeWrapper = FrameworkApplication.GetPlugInWrapper(DAML.Button.esri_core_exitApplicationButton); var closeCmd = closeWrapper as ICommand; // tool and command(Button) supports this if (closeCmd != null) { CloseCommand = new RelayCommand(param => closeCmd.Execute(null), param => closeCmd.CanExecute(null)); } }
private void FillMessages(List <Message> messages) { ObservableCollection <DisplayedMessage> displayedMessages = new ObservableCollection <DisplayedMessage>(); if (messages.Count > 0) { foreach (Message message in messages) { DisplayedMessage displayedMessage = new DisplayedMessage(message, message.Subject.Replace("\n", "").Replace("\r", "").Trim(' '), message.From.DisplayName == "" ? message.From.Address : message.From.DisplayName, message.Date.Value, message.Seen); displayedMessages.Add(displayedMessage); } BindingOperations.EnableCollectionSynchronization(displayedMessages, new object()); MessagesGrid.ItemsSource = displayedMessages; MessagesGrid.Items.Refresh(); MessagesGrid.Columns.Where(column => column.Header.ToString() == "Message").ToList <DataGridColumn>()[0].Visibility = Visibility.Collapsed; MessagesGrid.Columns.Where(column => column.Header.ToString() == "Seen").ToList <DataGridColumn>()[0].Visibility = Visibility.Collapsed; MessagesGrid.Columns.Where(column => column.Header.ToString() == "Subject").ToList <DataGridColumn>()[0].Width = new DataGridLength(3, DataGridLengthUnitType.Star); MessagesGrid.Columns.Where(column => column.Header.ToString() == "From").ToList <DataGridColumn>()[0].Width = new DataGridLength(1, DataGridLengthUnitType.Star); MessagesGrid.Columns.Where(column => column.Header.ToString() == "Date").ToList <DataGridColumn>()[0].Width = new DataGridLength(1, DataGridLengthUnitType.Star); MessagesGrid.Columns.Where(column => column.Header.ToString() == "Subject").ToList <DataGridColumn>()[0].Header = "Temat"; MessagesGrid.Columns.Where(column => column.Header.ToString() == "From").ToList <DataGridColumn>()[0].Header = "Od"; MessagesGrid.Columns.Where(column => column.Header.ToString() == "Date").ToList <DataGridColumn>()[0].Header = "Data"; MessagesGrid.Visibility = Visibility.Visible; NoMessagesLabel.Visibility = Visibility.Collapsed; } else { MessagesGrid.Visibility = Visibility.Collapsed; NoMessagesLabel.Visibility = Visibility.Visible; } }
private ICollection <DigimonItemViewModel> LoadDigimonList(Tamer tamer) { string typeName; DigimonType dtype; ICollection <DigimonItemViewModel> items = null; if (ItemsCache.TryGetValue(tamer, out items)) { return(items); } items = new List <DigimonItemViewModel>(); BindingOperations.EnableCollectionSynchronization(items, _stocksLock); IconHolder IconHolder = App.Kernel.Get <IconHolder>(); using (IDatabaseContext context = App.Kernel.Get <IDatabaseManager>().CreateContext()) { foreach (Digimon item in tamer.Digimons) { dtype = context.FindDigimonTypeByCode(item.Type.Code); typeName = dtype.Name; if (dtype.NameAlt != null) { typeName += " (" + dtype.NameAlt + ")"; } items.Add(new DigimonItemViewModel() { DName = item.Name, DType = typeName, Image = IconHolder.GetImage(item.Type.Code), TName = tamer.Name, Level = item.Level, SizePC = item.SizePc, Size = string.Format(SIZE_FORMAT, item.SizeCm, item.SizePc), Rank = item.Rank, }); } } ItemsCache.TryAdd(tamer, items); return(items); }
public DebugWindow() { Class13.lOBHd9Nzn7x2T(); this.< Filtered > k__BackingField = new ObservableCollection <TreeNode>(); this.< All > k__BackingField = new List <TreeHeaderNode>(); this.< JumpToLast > k__BackingField = true; this._lock = new object(); this.PropertyChanged = new PropertyChangedEventHandler(DebugWindow.< > c.< > 9.method_3); this._attached = new List <GInterface5>(); base..ctor(); this.InitializeComponent(); base.DataContext = this; base.Closing += this.DebugWindow_Closing; this.Commands = GClass86.dictionary_0.Select(new Func <KeyValuePair <int, Type>, CommandViewModel>(DebugWindow.< > c.< > 9.method_0)).ToList <CommandViewModel>(); foreach (CommandViewModel commandViewModel in this.Commands) { commandViewModel.PropertyChanged += this.method_0; } this.CommandById = this.Commands.ToDictionary(new Func <CommandViewModel, int>(DebugWindow.< > c.< > 9.method_1), new Func <CommandViewModel, CommandViewModel>(DebugWindow.< > c.< > 9.method_2)); BindingOperations.EnableCollectionSynchronization(this.Filtered, this._lock); this.PropertyChanged += this.DebugWindow_PropertyChanged; }
public GroupsManagerViewModel(GroupsManagerModel model) { Model = model; Groups = Model.CollectGroups(); Title = "Mission Control - Groups Manager v." + Assembly.GetExecutingAssembly().GetName().Version; BindingOperations.EnableCollectionSynchronization(_groups, _lock); WindowLoaded = new RelayCommand <Window>(OnWindowLoaded); WindowClosed = new RelayCommand <Window>(OnWindowClosed); SubmitComment = new RelayCommand(OnSubmitComment); Close = new RelayCommand <Window>(OnClose); Delete = new RelayCommand(OnDelete); Ungroup = new RelayCommand(OnUngroup); SelectAll = new RelayCommand(OnSelectAll); SelectNone = new RelayCommand(OnSelectNone); Check = new RelayCommand <bool>(OnCheck); FindGroup = new RelayCommand <GroupTypeWrapper>(OnFindGroup); IsolateGroup = new RelayCommand <GroupTypeWrapper>(OnIsolateGroup); Messenger.Default.Register <GroupsDeleted>(this, OnGroupsDeleted); Messenger.Default.Register <DocumentChanged>(this, OnDocumentChanged); }
/// <summary> /// constructor. /// </summary> protected BookmarkViewModel() { // set up the command to retrieve the maps _retrieveMapsCommand = new RelayCommand(() => RetrieveMaps(), () => true); _delBookmarkCommand = new RelayCommand(() => DeleteBookmark(), () => true); _readOnlyBookmarks = new ReadOnlyObservableCollection <Bookmark>(_bookmarks); _readOnlyMaps = new ReadOnlyObservableCollection <Map>(_maps); Utils.RunOnUiThread(() => { BindingOperations.EnableCollectionSynchronization(_readOnlyMaps, _lockCollection); BindingOperations.EnableCollectionSynchronization(_readOnlyBookmarks, _lockCollection); }); ProjectItemsChangedEvent.Subscribe(OnProjectCollectionChanged, false); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed CheckBookmarks(_selectedMap); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed IsShowCircularAnimation = Visibility.Collapsed; IsNoBookmarkExists = Visibility.Collapsed; }
/// <summary> /// CTor /// </summary> public OpenMapviewsDockpaneViewModel() { BindingOperations.EnableCollectionSynchronization(ListOfMapviews, _lockCollection); // create a simulated list of mapviews // either when a project is opened or if a project is already open ProjectOpenedEvent.Subscribe((ProjectEventArgs e) => { CreateMapviewItemsAsync(); }); if (Project.Current != null) { CreateMapviewItemsAsync(); } ProjectClosedEvent.Subscribe((ProjectEventArgs e) => { // cleanup temp folder if (!string.IsNullOrEmpty(_temporaryPath)) { System.IO.Directory.Delete(_temporaryPath, true); } _temporaryPath = string.Empty; }); }
public Authenticator(string path, string password) { if (String.IsNullOrEmpty(password.Trim())) { throw new ArgumentNullException(nameof(password)); } if (String.IsNullOrEmpty(path.Trim())) { throw new ArgumentNullException(nameof(path)); } _updateSemaphore = new SemaphoreSlim(1, 1); _confirmationSemaphore = new SemaphoreSlim(1, 1); _autoupdateSemaphore = new SemaphoreSlim(1, 1); //Collection Synhronization BindingOperations.EnableCollectionSynchronization(_confirmations, _collectionLock); _password = password; App.SteamGuardHelper.Initialize(path); State = AuthenticatorState.Ready; }
private async Task LoadInformationAsync() { await Task.Delay(1000); try { var e = Dns.GetHostEntry("www.google_com.hk"); } catch (Exception) { MapControl.Manager.Mode = AccessMode.ServerAndCache; } // config map //use google provider MapControl.MapProvider = GMapProviders.GoogleMap; //get tiles from server only // MapControl.Manager.Mode = AccessMode.ServerOnly; //not use proxy GMapProvider.WebProxy = null; //center map on moscow //MapControl.Position = new PointLatLng(7.199001, 125.454941); MapControl.Position = new PointLatLng(7.199001, 125.775604248047); //zoom min/max; default both = 2 MapControl.MinZoom = 1; MapControl.MaxZoom = 20; //set zoom MapControl.Zoom = 10; MapControl.MouseMove += MapControlOnMouseMove; MapControl.MouseLeftButtonDown += MapControl_MouseLeftButtonDown; UpdateView(); BindingOperations.EnableCollectionSynchronization(MapControl.Markers, _markersLock); ViewModelLocatorStatic.Locator.StationMapsModule.IsMapReady = true; }
//*********************************************************************************************************************************************************************************************************** private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { if (Properties.Settings.Default.RecSettings == null) { Properties.Settings.Default.RecSettings = new RecorderSettings(); } RecSettings = Properties.Settings.Default.RecSettings; IsPlayerAdblockerEnabled = Properties.Settings.Default.IsPlayerAdblockerEnabled; _logHandle.Report(new LogEventInfo("Track \"" + PlayerApp.CurrentTrack?.TrackName + "\" (" + PlayerApp.CurrentTrack?.CombinedArtistsString + ")")); PlayerApp.OnTrackChange += PlayerApp_OnTrackChange; PlayerApp.OnPlayStateChange += PlayerApp_OnPlayStateChange; PlayerApp.OnTrackTimeChange += PlayerApp_OnTrackTimeChange; PlayerApp.OnPlayerConnectionTokenExpired += PlayerApp_OnPlayerConnectionTokenExpired; Recorders = new ObservableCollection <Recorder>(); BindingOperations.EnableCollectionSynchronization(Recorders, _recordersListLock); Recorders.CollectionChanged += Recorders_CollectionChanged; //Recorder tmpRecorder = new SpotifyRecorderImplementierung((RecorderSettings)RecSettings.Clone(), PlayerApp.CurrentTrack, _logHandle); //Recorders.Add(tmpRecorder); }
private void Initialize() { //Set Log Listener Log.AttachListener(_listener); //Set Item source for list view of UI log and set syncronization options LogMessageList.ItemsSource = _listener.AllMessages; BindingOperations.EnableCollectionSynchronization(_listener.AllMessages, _listener.Token); //define filtering method CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(LogMessageList.ItemsSource); view.Filter = CheckLogFilter; //set on UI log on change event _listener.AllMessages.CollectionChanged += LogViewChanged; //init filter combo boxes LevelFilter.ItemsSource = Enum.GetValues(typeof(eCategory)).Cast <eCategory>(); LevelFilter.Text = eCategory.Debug.ToString(); ModuleFilter.ItemsSource = _moduleTags; ModuleFilter.Text = Log.ALL; }
public ProcessesInfoViewModel() { LinkedList <ReadableProcess> temp = new LinkedList <ReadableProcess>(); foreach (var process in Process.GetProcesses()) { try { temp.AddLast(new ReadableProcess(process)); } catch (Win32Exception) { } } _processes = new ObservableCollection <ReadableProcess>(temp); BindingOperations.EnableCollectionSynchronization(Processes, _locker); Model = new ProcessesInfoModel(); RebuildTimer = new Timer(RebuildProcesses, null, RebuildInterval, RebuildInterval); UpdateTimer = new Timer(UpdateProcesses, null, UpdateInterval + 1000, UpdateInterval); }
public WindowSelectEntityNameAndId( ConnectionData connectionData , string windowTitle , string selectionText ) { InitializeComponent(); SetInputLanguageEnglish(); this.Title = windowTitle; BindingOperations.EnableCollectionSynchronization(connectionData.ConnectionConfiguration.Connections, sysObjectConnections); LoadEntityNames(cmBEntityTypeNameOrCode, connectionData); cmBEntityTypeNameOrCode.Text = selectionText; cmBConnection.ItemsSource = connectionData.ConnectionConfiguration.Connections; cmBConnection.SelectedItem = connectionData; txtBEntityId.Focus(); }
/// <summary> /// Initializes a new instance of the <see cref="TournamentsViewModel"/> class. /// </summary> /// <remarks> /// </remarks> public TournamentsViewModel(params object[] args) { LayoutUpdatedCommand = new Command <double>(LayoutUpdated); Choice = new Command <TournamentVw>(OnChoiceExecute); ScrollChangedCommand = new Command <double>(ScrollChanged); CheckedBox = new Command <TournamentVw>(OnCheckedExecute); Mediator.Register <string>(this, HeaderShowFirstView, MsgTag.RefreshStation); BindingOperations.EnableCollectionSynchronization(_tournaments, _itemsLock); if (args.Length > 0) { if (args[0] is long) { SelectedCategoryId = (long)args[0]; } if (args.Length > 1 && args[1] is TournamentVw) { SelectedTournament = (TournamentVw)args[1]; } } }
public OverShortAllocationsEXViewModel_AutoGen() { RegisterToReceiveMessages <OverShortAllocationsEX>(MessageToken.CurrentOverShortAllocationsEXChanged, OnCurrentOverShortAllocationsEXChanged); RegisterToReceiveMessages(MessageToken.OverShortAllocationsEXesChanged, OnOverShortAllocationsEXesChanged); RegisterToReceiveMessages(MessageToken.OverShortAllocationsEXesFilterExpressionChanged, OnOverShortAllocationsEXesFilterExpressionChanged); RegisterToReceiveMessages <OverShortDetailAllocation>(MessageToken.CurrentOverShortDetailAllocationChanged, OnCurrentOverShortDetailAllocationChanged); RegisterToReceiveMessages <OverShortDetailsEX>(MessageToken.CurrentOverShortDetailsEXChanged, OnCurrentOverShortDetailsEXChanged); RegisterToReceiveMessages <AsycudaDocumentItem>(MessageToken.CurrentAsycudaDocumentItemChanged, OnCurrentAsycudaDocumentItemChanged); // Recieve messages for Core Current Entities Changed OverShortAllocationsEXes = new VirtualList <OverShortAllocationsEX>(vloader); OverShortAllocationsEXes.LoadingStateChanged += OverShortAllocationsEXes_LoadingStateChanged; BindingOperations.EnableCollectionSynchronization(OverShortAllocationsEXes, lockObject); OnCreated(); OnTotals(); }
/// <summary> /// this method is for the binding between the observable collection and the view /// its try to ask the server the log list and add them to the collection /// </summary> private void InitializedLog() { LogList = new ObservableCollection <MessageRecievedEventArgs>(); Object thisLock = new Object(); BindingOperations.EnableCollectionSynchronization(LogList, thisLock); //if client connected to server send this command if (this.client.IsConnected) { CommandRecievedEventArgs commanToSent = new CommandRecievedEventArgs((int)CommandStateEnum.GET_ALL_LOG, new string[5], ""); client.SendCommandToServer(commanToSent); } else //client not connected - log list write this to the log { MessageRecievedEventArgs e = new MessageRecievedEventArgs { Message = "Failed to connect to the server", Status = MessageTypeEnum.FAIL }; LogList.Add(e); } }
private void Plot2_Changed() { ObservableCollection <Point> plot2 = null; Dictionary <ObservableCollection <Point>, ObservableCollection <LineModel> > plots2Lines = null; try { Dispatcher.Invoke(() => { plot2 = Plot2; plots2Lines = Plots2Lines; }); } catch { } if (!Plots2Lines.ContainsKey(plot2)) { var lines = new ObservableCollection <LineModel>(); BindingOperations.EnableCollectionSynchronization(lines, lines); Plots2Lines.Add(plot2, lines); } Plot2Lines = Plots2Lines[plot2]; }
// Constructor protected FileTileLoaderViewModel() { _saveFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"RemoteSensing\ArcPro\FileTileLoader"); _saveFullPath = System.IO.Path.Combine(_saveFolder, _saveFile); _getMapsCommand = new RelayCommand(() => GetMaps(), () => true); _loadFileCommand = new RelayCommand(() => LoadFiles(), () => true); _getFileWorkspaceCommand = new RelayCommand(() => GetFileWorkspace(), () => true); Utilities.ProUtilities.RunOnUiThread(() => { BindingOperations.EnableCollectionSynchronization(_maps, _lockCollection); BindingOperations.EnableCollectionSynchronization(_featureLayers, _lockCollection); BindingOperations.EnableCollectionSynchronization(_fields, _lockCollection); BindingOperations.EnableCollectionSynchronization(_fileExtensions, _lockCollection); }); LayersAddedEvent.Subscribe(OnLayersAdded, false); LayersRemovedEvent.Subscribe(OnLayersRemoved, false); ProjectOpenedEvent.Subscribe(OnProjectOpened, false); ReadFileExtensionsFromDisk(); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsModel"/> class. /// </summary> public SettingsModel() { Folders = new ObservableCollection <string>(); BindingOperations.EnableCollectionSynchronization(Folders, new object()); Folders.CollectionChanged += (sender, e) => NotifyProperyChanged("Folders"); OutputDirPath = "Not Connected"; m_actions = new Dictionary <CommandEnum, CommandAction>(); m_actions.Add(CommandEnum.GetConfigCommand, OnConfigRefresh); m_actions.Add(CommandEnum.CloseCommand, OnRemoveHandler); ClientCommunication.Instance.OnDataRecieved += (s, e) => { CommandMessage cmdMsg = CommandMessage.FromJSON(e.Data); if (m_actions.ContainsKey(cmdMsg.CmdId)) { m_actions[cmdMsg.CmdId](cmdMsg); } }; ClientCommunication.Instance.Send(new CommandMessage(CommandEnum.GetConfigCommand, new string[] { })); }
public AgentInteractViewModel(MainWindowViewModel viewModel, string agentId) { MainViewModel = viewModel; AgentId = agentId; AgentLabel = string.Format("{0} >", AgentId); AgentEvents = new ObservableCollection <AgentEvent>(); BindingOperations.EnableCollectionSynchronization(AgentEvents, _lock); _submitAgentCommand = new DelegateCommand(OnAgentCommand); _detachTab = new DelegateCommand(OnDetachTab); _closeTab = new DelegateCommand(OnCloseTab); Task.Factory.StartNew(() => { while (true) { GetAgentData(AgentId); Thread.Sleep(1000); } }); }
public MainWindowViewModel() { _key = "TGILaGzUbldGjQcsDkDolY8M"; _secret = "hF32jD-OsGPxcTqY6sPxwvNEVpqJMgirxOTnME5t7J6sjqH4"; _bitmexAuthorization = new BitmexAuthorization { BitmexEnvironment = BitmexEnvironment.Test, Key = _key, Secret = _secret }; _bitmexApiSocketService = BitmexApiSocketService.CreateDefaultApi(_bitmexAuthorization); BuyCmd = new DelegateCommand(Buy); SellCmd = new DelegateCommand(Sell); StartLoadSymbolsCmd = new DelegateCommand(StartLoad, CanStart); Size = 1; Instruments = new ObservableCollection <InstrumentModel>(); OrderUpdates = new ObservableCollection <OrderUpdateModel>(); OrderBookL2 = new ObservableCollection <OrderBookModel>(); BindingOperations.EnableCollectionSynchronization(Instruments, _syncObj); BindingOperations.EnableCollectionSynchronization(OrderUpdates, _syncObjOrders); BindingOperations.EnableCollectionSynchronization(OrderBookL2, _syncObjOrderBookL2); }
internal InfiniteScrollList(Lazy <JoinableTaskFactory> joinableTaskFactory) { if (joinableTaskFactory == null) { throw new ArgumentNullException(nameof(joinableTaskFactory)); } _joinableTaskFactory = joinableTaskFactory; InitializeComponent(); _list.ItemsLock = ReentrantSemaphore.Create( initialCount: 1, joinableTaskContext: _joinableTaskFactory.Value.Context, mode: ReentrantSemaphore.ReentrancyMode.Stack); BindingOperations.EnableCollectionSynchronization(Items, _list.ItemsLock); DataContext = Items; CheckBoxesEnabled = false; _loadingStatusIndicator.PropertyChanged += LoadingStatusIndicator_PropertyChanged; }
public LogViewModel(DS4Windows.ControlService service) { string version = DS4Windows.Global.exeversion; logItems.Add(new LogItem { Datetime = DateTime.Now, Message = $"DS4Windows version {version}" }); logItems.Add(new LogItem { Datetime = DateTime.Now, Message = $"OS Version: {Environment.OSVersion}" }); logItems.Add(new LogItem { Datetime = DateTime.Now, Message = $"OS Product Name: {DS4Windows.Util.GetOSProductName()}" }); logItems.Add(new LogItem { Datetime = DateTime.Now, Message = $"OS Release ID: {DS4Windows.Util.GetOSReleaseId()}" }); //logItems.Add(new LogItem { Datetime = DateTime.Now, Message = "DS4Windows version 2.0" }); //BindingOperations.EnableCollectionSynchronization(logItems, _colLockobj); BindingOperations.EnableCollectionSynchronization(logItems, _logListLocker, LogLockCallback); service.Debug += AddLogMessage; DS4Windows.AppLogger.GuiLog += AddLogMessage; }