コード例 #1
0
        /// <summary>
        /// Adds a new partition and handles the "bookkeeping" associated with adding a partition.
        /// </summary>
        private void AddPartition()
        {
            var partition = new List <T>(BitnessToSize(NextPartitionBitness));

            Partitions.Add(partition);
            NextPartitionBitness++;
        }
コード例 #2
0
 public void AddPartition(string partitionId, string masterUrl)
 {
     //lock (Partitions) {
     Console.WriteLine("Creating partition " + partitionId);
     Partitions.Add(partitionId, new BaseServerPartition(partitionId, masterUrl));
     //}
 }
コード例 #3
0
        public AlarmSystemInfo(j64.AlarmServer.AlarmSystem myAlarmSystem)
        {
            Name       = myAlarmSystem.Name;
            ArmingCode = myAlarmSystem.ArmingCode;

            Host        = myAlarmSystem.Host;
            Port        = myAlarmSystem.Port;
            User        = myAlarmSystem.User;
            Password    = myAlarmSystem.Password;
            IsConnected = myAlarmSystem.IsConnectedToTpi;

            myAlarmSystem.PartitionList.ForEach(p => Partitions.Add(new PartitionInfo(p)));
            myAlarmSystem.ZoneList.ForEach(z => Zones.Add(new ZoneInfo(z)));
        }
コード例 #4
0
        private void AddPartitionsFromLargeInpartitionables()
        {
            foreach (int index in LargeInpartitionableIndexes)
            {
                if (index != 0)
                {
                    Partitions.Add(GetSeperationStart(index));
                }

                if (index != LargeInpartitionableIndexes.Count - 1)
                {
                    Partitions.Add(Seperations[index]);
                }
            }
        }
コード例 #5
0
        void ExecSave()
        {
            int i = 0;

            if (AddMode)
            {
                AddMode = false;
                AddCmd.RaiseCanExecuteChanged();
                RemoveCmd.RaiseCanExecuteChanged();
                _dataService.UpdatePartition(CurrentObject, (data, error) =>
                {
                    if (error != null)
                    {
                        return;
                    }                              // Report error here
                    i = data;
                });
                Partitions.Add(CurrentObject);
                SelectedItem = CurrentObject;
                NormalUIState();
                MessengerInstance.Send(SelectedItem, AppContext.PartitionAddedMsg);
                return;
            }
            if (EditMode)
            {
                EditMode = false;
                AddCmd.RaiseCanExecuteChanged();
                RemoveCmd.RaiseCanExecuteChanged();
                _dataService.UpdatePartition(CurrentObject, (data, error) =>
                {
                    if (error != null)
                    {
                        return;
                    }                              // Report error here
                    i = data;
                });

                int ix = Partitions.IndexOf(SelectedItem);
                Partitions[ix] = CurrentObject;
                SelectedItem   = CurrentObject;

                NormalUIState();
                MessengerInstance.Send(SelectedItem, AppContext.PartitionChangedMsg);
                return;
            }
        }
コード例 #6
0
        /************************************************************/

        #region Messendger Handlers

        private void PartitionAdded(Partition partition)
        {
            Partitions.Add(partition);
        }
コード例 #7
0
        public void InsertPartition(Partition partition, int commandTopics, int commandSubscriptions,
                                    string area, string ns,
                                    string owner, string ownerSecret, string storageAccount,
                                    string acs, string acsSecret)
        {
            if (partition == null)
            {
                throw new ArgumentNullException("partition");
            }

            if (commandTopics <= 0)
            {
                throw new ArgumentOutOfRangeException("commandTopics");
            }

            if (commandSubscriptions <= 0)
            {
                throw new ArgumentOutOfRangeException("commandSubscriptions");
            }

            if (string.IsNullOrWhiteSpace(area))
            {
                throw new ArgumentException("area");
            }

            if (string.IsNullOrWhiteSpace(ns))
            {
                throw new ArgumentException("ns");
            }

            if (string.IsNullOrWhiteSpace(owner))
            {
                throw new ArgumentException("owner");
            }

            if (string.IsNullOrWhiteSpace(ownerSecret))
            {
                throw new ArgumentException("ownerSecret");
            }

            if (string.IsNullOrWhiteSpace(storageAccount))
            {
                throw new ArgumentException("storageAccount");
            }

            if (string.IsNullOrWhiteSpace(acs))
            {
                throw new ArgumentException("acs");
            }

            if (string.IsNullOrWhiteSpace(acsSecret))
            {
                throw new ArgumentException("acsSecret");
            }

            partition.Area = area;
            partition.MaximumCommandTopic = commandTopics;
            partition.MaximumSubscription = commandSubscriptions;
            partition.Namespace           = ns;
            partition.Owner               = owner;
            partition.OwnerSecret         = ownerSecret;
            partition.StorageAccount      = storageAccount;
            partition.AccessControl       = acs;
            partition.AccessControlSecret = acsSecret;
            Partitions.Add(partition);

            SaveChanges();
            DetachEntity(partition);
        }
コード例 #8
0
 public void AddPartition(string partitionId, string masterUrl)
 {
     Console.WriteLine("Creating partition " + partitionId);
     Partitions.Add(partitionId, new AdvancedServerPartition(partitionId, masterUrl, this));
 }
コード例 #9
0
        private void SetupCommands()
        {
            this.Open = new RelayCommand(async() => {
                this.IsOpening = true;
                this.Partitions.Clear();
                this.Messages.Clear();

                _partitionSubscription = _service.PartitionFound.Subscribe((p) =>
                {
                    App.Current.Dispatcher.BeginInvoke(new Action(() => {
                        this.TotalMessageCount = _service.MessageCount;
                        Partitions.Add(new PartitionViewModel(p));
                    }), null);
                },
                                                                           () => {
                    App.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        this.IsOpening = false;
                    }));
                });
                await _service.OpenEventHubAsync(EventHubConnectionString, HubName);
                UpdateCommands();
            });

            this.ReadAll = new RelayCommand(() =>
            {
                ResetReading();
                switch (CheckPoint)
                {
                case CheckPointTypes.Start:
                    _service.ReadAllAsync(DateTime.MinValue);
                    break;

                case CheckPointTypes.Now:
                    _service.ReadAllAsync(DateTime.Now);
                    break;

                case CheckPointTypes.PastMinutes:
                    _service.ReadAllAsync(TimeSpan.FromMinutes(this.PastMinutes));
                    break;

                case CheckPointTypes.PastMessages:
                    _service.ReadAllAsync(this.PastMessages);
                    break;

                default:
                    break;
                }
                IsReading = true;
                UpdateCommands();
            }, () => {
                return(!_service.IsReading && _service.IsOpen);
            });

            this.Read = new RelayCommand <PartitionViewModel>((p) => {
                ResetReading();
                switch (CheckPoint)
                {
                case CheckPointTypes.Start:
                    _service.ReadAsync(p.PartitionId, DateTime.MinValue);
                    break;

                case CheckPointTypes.Now:
                    _service.ReadAsync(p.PartitionId, DateTime.Now);
                    break;

                case CheckPointTypes.PastMinutes:
                    break;

                case CheckPointTypes.PastMessages:
                    break;

                default:
                    break;
                }
                IsReading = true;
                UpdateCommands();
            }
                                                              );

            this.FilterByPublisher = new RelayCommand <string>((publisher) =>
            {
                if (string.IsNullOrWhiteSpace(publisher))
                {
                    return;
                }

                var found = (from m in Messages where m.Publisher == publisher select m).ToList();
                Messages.Clear();
                foreach (var f in found)
                {
                    Messages.Add(f);
                }
            });

            this.Stop = new RelayCommand(() =>
            {
                StopReading();
            }, () => { return(_service.IsReading); });
        }