Ejemplo n.º 1
0
        private ChatManager(WindowSettingsBase settings) : base(settings)
        {
            _pauseQueue           = new ConcurrentQueue <ChatMessage>();
            _privateMessagesCache = new List <TempPrivateMessage>();
            ChatWindows           = new TSObservableCollection <ChatWindow>(Dispatcher);
#if BATCH
            _mainQueue  = new ConcurrentQueue <ChatMessage>();
            _flushTimer =
                new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Background, OnFlushTick, Dispatcher);
            ChatMessages = new TSObservableCollectionBatch <ChatMessage>(Dispatcher);
            _flushTimer.Start();
#else
            ChatMessages = new TSObservableCollection <ChatMessage>(Dispatcher);
#endif
            LFGs = new TSObservableCollection <LFG>(Dispatcher);

            ChatMessages.CollectionChanged += OnChatMessagesCollectionChanged;
            BindingOperations.EnableCollectionSynchronization(ChatMessages, _lock);

            ChatWindows.CollectionChanged += OnChatWindowsCollectionChanged;
            PrivateChannelJoined          += OnPrivateChannelJoined;

            KeyboardHook.Instance.RegisterCallback(App.Settings.ForceClickableChatHotkey, ToggleForcedClickThru);

            Factory = new ChatMessageFactory(Dispatcher);

            Log.NewChatMessage += OnLogChatMessage;
        }
Ejemplo n.º 2
0
        public NpcWindowViewModel(NpcWindowSettings settings) : base(settings)
        {
            _npcList = new TSObservableCollection <NPC>(Dispatcher);
            Bams     = CollectionViewFactory.CreateLiveCollectionView(_npcList,
                                                                      npc => npc.IsBoss && !npc.IsTower && npc.Visible,
                                                                      new[] { nameof(NPC.Visible), nameof(NPC.IsBoss) },
                                                                      new[] { new SortDescription(nameof(NPC.CurrentHP), ListSortDirection.Ascending) });
            Mobs = CollectionViewFactory.CreateLiveCollectionView(_npcList,
                                                                  npc => !npc.IsBoss && !npc.IsTower && npc.Visible,
                                                                  new[] { nameof(NPC.Visible), nameof(NPC.IsBoss) },
                                                                  new[] { new SortDescription(nameof(NPC.CurrentHP), ListSortDirection.Ascending) });
            GuildTowers = CollectionViewFactory.CreateLiveCollectionView(_npcList,
                                                                         npc => npc.IsTower,
                                                                         sortFilters: new[] { new SortDescription(nameof(NPC.CurrentHP), ListSortDirection.Ascending) });

            PendingAbnormalities = new List <PendingAbnormality>();
            InitFlushTimer();
            NpcListChanged                        += FlushCache;
            settings.AccurateHpChanged            += OnAccurateHpChanged;
            settings.HideAddsChanged              += OnHideAddsChanged;
            MonsterDatabase.OverrideChangedEvent  += RefreshOverride;
            MonsterDatabase.BlacklistChangedEvent += RefreshBlacklist;

            void InitFlushTimer()
            {
                var flushTimer = new DispatcherTimer {
                    Interval = TimeSpan.FromMilliseconds(500)
                };

                flushTimer.Tick += (_, __) => FlushCache();
                flushTimer.Start();
            }
        }
Ejemplo n.º 3
0
 public EventGroup(string name, DateTime start, DateTime end, bool rc)
 {
     Dispatcher  = WindowManager.DashboardWindow.Dispatcher;
     Events      = new TSObservableCollection <DailyEvent>(Dispatcher);
     Name        = name;
     RemoteCheck = rc;
     _start      = start;
     _end        = end;
 }
Ejemplo n.º 4
0
 public TSObservableCollection <Bid> getArchiveCollection()
 {
     if (_archiveCollection == null)
     {
         List <Bid> collection = _collection.Where(x => x.Is_archive != 0).ToList();
         _archiveCollection = new TSObservableCollection <Bid>(collection);
     }
     return(_archiveCollection);
 }
Ejemplo n.º 5
0
        protected override void load()
        {
            TSObservableCollection <MessageTemplates> collection =
                StangradCRM.Core.Model.load <TSObservableCollection <MessageTemplates> >("MessageTemplates");

            if (collection != default(TSObservableCollection <MessageTemplates>))
            {
                collection.ToList().ForEach(x => { x.IsSaved = true; add(x); });
            }
        }
Ejemplo n.º 6
0
 public MergedInventoryViewModel()
 {
     MergedInventory     = new TSObservableCollection <MergedInventoryItem>();
     MergedInventoryView = CollectionViewFactory.CreateLiveCollectionView(MergedInventory,
                                                                          sortFilters: new[]
     {
         new SortDescription($"{nameof(MergedInventoryItem.Item)}.{nameof(InventoryItem.Item)}.{nameof(Item.Id)}", ListSortDirection.Ascending),
         new SortDescription($"{nameof(MergedInventoryItem.Item)}.{nameof(InventoryItem.Item)}.{nameof(Item.RareGrade)}", ListSortDirection.Ascending),
     });
 }
        protected override void load()
        {
            TSObservableCollection <TransportCompany> collection =
                StangradCRM.Core.Model.load <TSObservableCollection <TransportCompany> >("TransportCompany");

            if (collection != default(TSObservableCollection <TransportCompany>))
            {
                collection.ToList().ForEach(x => { x.IsSaved = true; add(x); });
            }
        }
Ejemplo n.º 8
0
        protected override void load()
        {
            TSObservableCollection <Role> collection =
                StangradCRM.Core.Model.load <TSObservableCollection <Role> >("Role");

            if (collection != default(TSObservableCollection <Role>))
            {
                collection.ToList().ForEach(x => add(x));
            }
        }
        protected override void load()
        {
            TSObservableCollection <ComplectationItem> collection =
                StangradCRM.Core.Model.load <TSObservableCollection <ComplectationItem> >("ComplectationItem");

            if (collection != default(TSObservableCollection <ComplectationItem>))
            {
                collection.ToList().ForEach(x => { x.IsSaved = true; add(x); });
            }
        }
Ejemplo n.º 10
0
 public GearInfo()
 {
     Gear   = new TSObservableCollection <GearItem>();
     Jewels = new CollectionViewSource()
     {
         Source = Gear
     }.View;
     Jewels.Filter = g => ((GearItem)g).IsJewel && ((GearItem)g).Piece < GearPiece.Circlet;
     Jewels.SortDescriptions.Add(new SortDescription("Piece", ListSortDirection.Ascending));
 }
Ejemplo n.º 11
0
        protected override void load()
        {
            TSObservableCollection <Manager> collection =
                StangradCRM.Core.Model.load <TSObservableCollection <Manager> >("Manager");

            if (collection != default(TSObservableCollection <Manager>))
            {
                collection.ToList().ForEach(x => { x.loadedItemInitProperty(); x.IsSaved = true; add(x); });
            }
        }
Ejemplo n.º 12
0
        protected override void load()
        {
            TSObservableCollection <Equipment> collection =
                StangradCRM.Core.Model.load <TSObservableCollection <Equipment> >("Equipment");

            if (collection != default(TSObservableCollection <Equipment>))
            {
                collection.ToList().ForEach(x => { x.IsSaved = true; add(x); });
            }
        }
Ejemplo n.º 13
0
        void sendMail()
        {
            Buyer buyer = bid.BidBuyer;

            CRMSettingViewModel crmSetting = CRMSettingViewModel.instance();

            MailMessage message = new MailMessage();

            message.To.Add(buyer.Email);
            message.From       = new MailAddress(crmSetting.getByMashineName("email").Setting_value);
            message.Subject    = getTheme();
            message.Body       = getMessageBody();
            message.IsBodyHtml = true;

            TSObservableCollection <BidFiles> bidFiles =
                bid.BidFilesCollection;

            List <MemoryStream> streamsList = new List <MemoryStream>();

            for (int i = 0; i < bidFiles.Count; i++)
            {
                if (bidFiles[i].IsCurrent == false)
                {
                    continue;
                }

                MemoryStream stream     = new MemoryStream(bidFiles[i].FileBody);
                Attachment   attachment = new Attachment(stream, bidFiles[i].Name);
                message.Attachments.Add(attachment);
                streamsList.Add(stream);
            }

            SmtpClient smtpClient = new SmtpClient(crmSetting.getByMashineName("smtp_server").Setting_value, int.Parse(crmSetting.getByMashineName("smtp_port").Setting_value));

            smtpClient.Credentials = new NetworkCredential(crmSetting.getByMashineName("mail_user").Setting_value, crmSetting.getByMashineName("mail_password").Setting_value);
            int useSSL = int.Parse(crmSetting.getByMashineName("mail_use_ssl").Setting_value);

            if (useSSL == 1)
            {
                smtpClient.EnableSsl = true;
            }
            smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

            loadingProgress.Visibility = Visibility.Visible;

            Task.Factory.StartNew(() => {
                try {
                    smtpClient.Send(message);
                    Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { closeStreams(streamsList); saveBid(); }));
                }
                catch (Exception ex) {
                    Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { closeStreams(streamsList); errorSave("Не отправить письмо.\n" + ex.ToString()); }));
                }
            });
        }
Ejemplo n.º 14
0
        public static TSObservableCollection <T> RemoveAll <T>(this TSObservableCollection <T> coll, Func <T, bool> condition)
        {
            var itemsToRemove = coll.Where(condition).ToList();

            foreach (var itemToRemove in itemsToRemove)
            {
                coll.Remove(itemToRemove);
            }

            return(coll);
        }
Ejemplo n.º 15
0
        public double getDebtByBidId(int bidId)
        {
            TSObservableCollection <Payment> payment = getByBidId(bidId);
            double Debt = 0;

            for (int i = 0; i < payment.Count; i++)
            {
                Debt += payment[i].Paying;
            }
            return(Debt);
        }
        public SystemMessagesConfigWindow()
        {
            InitializeComponent();
            DataContext    = this;
            HiddenMessages = new TSObservableCollection <SystemMessageViewModel>();
            ShowedMessages = new TSObservableCollection <SystemMessageViewModel>();

            App.Settings.UserExcludedSysMsg.ForEach(opc =>
            {
                HiddenMessages.Add(new SystemMessageViewModel(opc, Game.DB !.SystemMessagesDatabase.Messages[opc]));
            });
            Game.DB !.SystemMessagesDatabase.Messages.ToList().ForEach(keyVal =>
            {
                if (App.Settings.UserExcludedSysMsg.Contains(keyVal.Key))
                {
                    return;
                }
                ShowedMessages.Add(new SystemMessageViewModel(keyVal.Key, keyVal.Value));
            });

            HiddenMessages.CollectionChanged += (_, args) =>
            {
                switch (args.Action)
                {
                case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                    foreach (var item in args.NewItems !)
                    {
                        var opcode = ((SystemMessageViewModel?)item)?.Opcode;
                        if (opcode != null)
                        {
                            App.Settings.UserExcludedSysMsg.Add(opcode);
                        }
                    }
                    break;

                case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                    foreach (var item in args.OldItems !)
                    {
                        var opcode = ((SystemMessageViewModel?)item)?.Opcode;
                        if (opcode != null)
                        {
                            App.Settings.UserExcludedSysMsg.Remove(opcode);
                        }
                    }
                    break;
                }
                App.Settings.Save();
            };

            ShowedMessagesView = CollectionViewFactory.CreateLiveCollectionView(ShowedMessages);
            HiddenMessagesView = CollectionViewFactory.CreateLiveCollectionView(HiddenMessages);
        }
 public PaymentHistoryWindow(Bid bid)
 {
     InitializeComponent();
     paymentCollection = bid.PaymentCollection;
     viewSource.Source = paymentCollection;
     viewSource.SortDescriptions.Add(new SortDescription("Payment_date", ListSortDirection.Descending));
     DataContext = new
     {
         PaymentHistoryCollection = viewSource.View
     };
     Title   += bid.Id.ToString();
     this.bid = bid;
 }
Ejemplo n.º 18
0
        protected override void load()
        {
            EquipmentBidViewModel.instance().reload();
            PaymentViewModel.instance().reload();
            BidFilesViewModel.instance().reload();

            TSObservableCollection <Bid> collection =
                StangradCRM.Core.Model.load <TSObservableCollection <Bid> >("Bid");

            if (collection != default(TSObservableCollection <Bid>))
            {
                collection.ToList().ForEach(x => { x.IsSaved = true; x.loadedItemInitProperty(); add(x); });
            }
        }
Ejemplo n.º 19
0
        protected override bool afterRemove(ResponseParser parser, bool soft = false)
        {
            bool result = base.afterRemove(parser, soft);

            if (result)
            {
                EquipmentBidCollection.ToList().ForEach(x => { x.remove(true); });
                BidFilesCollection.ToList().ForEach(x => { x.remove(true); });

                PaymentCollection.ToList().ForEach(x => { x.remove(true); });

                equipmentBidCollection = null;
                bidFilesCollection     = null;
            }
            return(result);
        }
Ejemplo n.º 20
0
        public void fastSearch(string searchString, TSObservableCollection <Bid> collection = null)
        {
            searchString = searchString.ToLower();
            string[] properties = new string[]
            {
                "Account", "Amount", "BuyerName", "EquipmentBidStringSearch", "ManagerName"
            };

            if (collection == null)
            {
                collection = _collection;
            }

            collection.ToList().ForEach(x => x.setFilters(properties, false));

            collection.Where(x => (x.Account.ToLower().IndexOf(searchString) != -1) |
                             (x.Id.ToString().ToLower().IndexOf(searchString) != -1) |
                             (x.Amount.ToString().ToLower().IndexOf(searchString) != -1) |
                             (x.BuyerInfo.ToLower().IndexOf(searchString) != -1) |
                             (x.EquipmentBidStringSearch.ToLower().IndexOf(searchString) != -1) |
                             (x.ManagerName.ToLower().IndexOf(searchString) != -1)
                             ).ToList().ForEach(y => y.setFilters(properties, true));
        }
Ejemplo n.º 21
0
 public MessageLine()
 {
     LinePieces = new TSObservableCollection <MessagePieceBase>();
 }
Ejemplo n.º 22
0
 public NotificationAreaViewModel(WindowSettingsBase settings) : base(settings)
 {
     _queue               = new ConcurrentQueue <NotificationInfoBase>();
     Notifications        = new TSObservableCollection <NotificationInfoBase>(Dispatcher);
     Log.NewNotification += Enqueue;
 }
Ejemplo n.º 23
0
 public Account()
 {
     Characters = new TSObservableCollection <Character>();
 }