Ejemplo n.º 1
0
        public Task getNumber(User player)
        {
            var dbChar = Utils.Utils.GetDatabaseCharacter(player);

            NotifyHandler.SendNotification(player, "Deine Telefonnummer: " + dbChar.Number);
            return(Task.CompletedTask);
        }
Ejemplo n.º 2
0
        public async Task aduty_CMDAsync(User player)
        {
            Users dbUser = Main.database.UserCollection.AsQueryable().FirstOrDefault(x => x.Username == player.Username);
            var   dbChar = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(x => x.ownerObjId == dbUser.id);

            if (player.adminLevel == 0)
            {
                await NotifyHandler.SendNotification(player, "Keine Rechte!");

                return;
            }

            if (player.isAduty)
            {
                player.Emit("player:aduty:leave");
                await Utils.Utils.LoadClothes(player, dbChar);

                Discord.Webhookhandler.sendMessage($"[{dbChar.firstName} {dbChar.lastName} / {dbUser.Username}] Aduty verlassen. `{DateTime.Now.ToLocalTime():dd.MM.yyyy HH:mm:ss}`");
                player.isAduty = false;
                return;
            }
            if (!player.isAduty)
            {
                player.Emit("player:aduty:enter", player.sex, player.adminLevel);
                Discord.Webhookhandler.sendMessage($"[{dbChar.firstName} {dbChar.lastName} / {dbUser.Username}] Aduty betreten. `{DateTime.Now.ToLocalTime():dd.MM.yyyy HH:mm:ss}`");
                player.isAduty = true;
            }
        }
Ejemplo n.º 3
0
        internal async Task <bool> addItem(int id, int amount)
        {
            var dbChar = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(c => c.ownerObjId == this.uid);
            var dbInv  = dbChar.Inventar;
            var Item   = new Item()
            {
                itemId = id, amount = amount
            };
            var dbInvItem = dbInv.FirstOrDefault(i => i.itemId == id);

            if (dbInvItem != null)
            {
                dbInvItem.amount += amount;
            }
            else
            {
                Console.WriteLine("ADD: " + id + " " + amount);
                dbInv.Add(Item);
            }
            double invWeight = 0;

            foreach (var item in dbInv)
            {
                var dbItem = Main.database.ItemCollection.AsQueryable().FirstOrDefault(i => i.itemId == item.itemId);
                invWeight += dbItem.weight * item.amount;
            }
            if (invWeight >= 50)
            {
                await NotifyHandler.SendNotification(this, "Dein Inventar ist voll!", 3000);

                return(false);
            }
            Main.database.CharacterCollection.ReplaceOne(c => c.ownerObjId == this.uid, dbChar);
            return(true);
        }
Ejemplo n.º 4
0
        public void TestModuleManager()
        {
            var manager     = (IAppModuleManager)AppInstance;
            var testHandler = new NotifyHandler(null);
// ReSharper disable once JoinDeclarationAndInitializer
            IAddinModuleManagerNotifyHandler oldHandler;

            // just read CurrentModule
            Assert.IsTrue(manager.CurrentModule != null, "Unassigned CurrentModule");

            // test BeforeCurrentModuleChange
            oldHandler = manager.BeforeCurrentModuleChange;
            manager.BeforeCurrentModuleChange = testHandler;
            Assert.IsTrue(manager.BeforeCurrentModuleChange == testHandler, "Cannot Set BeforeCurrentModuleChange");
            manager.BeforeCurrentModuleChange = null;
            Assert.IsTrue(manager.BeforeCurrentModuleChange == null, "Cannot Set BeforeCurrentModuleChange");
            manager.BeforeCurrentModuleChange = oldHandler;
            Assert.IsTrue(manager.BeforeCurrentModuleChange == oldHandler, "Cannot restore BeforeCurrentModuleChange");
            Assert.IsTrue(BeforeCurrentModuleChangeCount > 0, "BeforeCurrentModuleChange handler has not been executed");

            // test AfterCurrentModuleChange
            oldHandler = manager.AfterCurrentModuleChange;
            manager.AfterCurrentModuleChange = testHandler;
            Assert.IsTrue(manager.AfterCurrentModuleChange == testHandler, "Cannot Set AfterCurrentModuleChange");
            manager.AfterCurrentModuleChange = null;
            Assert.IsTrue(manager.AfterCurrentModuleChange == null, "Cannot Set AfterCurrentModuleChange");
            manager.AfterCurrentModuleChange = oldHandler;
            Assert.IsTrue(manager.AfterCurrentModuleChange == oldHandler, "Cannot estore AfterCurrentModuleChange");
            Assert.IsTrue(AfterCurrentModuleChangeCount > 0, "AfterCurrentModuleChange handler has not been executed");
        }
Ejemplo n.º 5
0
        public BaseInfo()
        {
            _InfoType = InfoType.None;

            //_ErrorList = new List<ErrorInfo>();

            _NotifyHandler = this.NotifyBase;
        }
Ejemplo n.º 6
0
 public SleepBonusNotify(ILogger logger, ISoundManager soundManager, ITrayPopups trayPopups, string popupTitle,
                         string popupMessage, bool popupPersistent = false)
 {
     handler = new NotifyHandler(logger, soundManager, trayPopups)
     {
         PopupPersistent = popupPersistent,
         Message         = (popupMessage ?? ""),
         Title           = (popupTitle ?? "")
     };
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 接收指定类型消息,并注册消息触发事件
 /// </summary>
 /// <param name="message"> 消息类型 </param>
 /// <param name="call"> 事件方法 </param>
 public void Register(Enum message, NotifyHandler call)
 {
     if (_messageDic.ContainsKey(message))
     {
         _messageDic[message] += call;
     }
     else
     {
         _messageDic.Add(message, call);
     }
 }
Ejemplo n.º 8
0
        public async Task ausparken(User player, string model, string license, string objId)
        {
            var dbCar = Main.database.CarCollection.AsQueryable().FirstOrDefault(c => c.numPlate == license);

            var ausparkPunkte = Main.database.GarageCollection.AsQueryable().FirstOrDefault(g => g.garageId == dbCar.garageId).Ausparkpunkte;


            for (int i = 0; i < ausparkPunkte.Count; i++)
            {
                var ausparkPunkt    = ATMS.atmInteraction.toAltPos(ausparkPunkte.ElementAt(i).position);
                var ausparkRotation = ausparkPunkte.ElementAt(i).rotation;
                var ausparkBlocked  = Alt.GetAllVehicles().ToList().FirstOrDefault(v => v.Position.IsInRange(ausparkPunkt, 1.5f));
                var dbModifiers     = Main.database.VehicleModiferCollection.AsQueryable().FirstOrDefault(c => c.ModelName.ToLower() == dbCar.carmodel.ToLower());
                if (ausparkBlocked != null)
                {
                }
                else
                {
                    Car spawnCar = (Car)Alt.CreateVehicle(model, ausparkPunkt, new Rotation(0, 0, (float)ausparkRotation));
                    spawnCar.NumberplateText = license;


                    spawnCar.ownerId             = dbCar.ownerId;
                    spawnCar.allowedIds          = dbCar.allowedIds;
                    spawnCar.carmodel            = model;
                    spawnCar.numPlate            = license;
                    spawnCar.fuel                = dbCar.fuel;
                    spawnCar.kilometer           = dbCar.kilometer;
                    spawnCar.carId               = dbCar.carId;
                    spawnCar.ManualEngineControl = true;
                    spawnCar.LockState           = VehicleLockState.Locked;


                    dbCar.parkedIn = false;
                    await Main.database.CarCollection.ReplaceOneAsync(c => c.numPlate == license, dbCar);

                    if (dbModifiers != null && dbModifiers.VehSpeedModifier != 0)
                    {
                        Alt.EmitAllClients("vehicle:setSpeed", spawnCar, dbModifiers.VehSpeedModifier);
                    }


                    break;
                }

                if (i != ausparkPunkte.Count || !ausparkBlocked.Exists)
                {
                    continue;
                }
                await NotifyHandler.SendNotification(player, "Es sind keine Ausparkpunkte frei!");

                break;
            }
        }
Ejemplo n.º 9
0
        public async Task carinfo_CMD(User player)
        {
            var carinrange = (Car)Alt.GetAllVehicles().FirstOrDefault(x => x.Position.IsInRange(player.Position, 1.5f));

            if (!carinrange.Exists)
            {
                return;
            }
            var dbCar      = Main.database.CarCollection.AsQueryable().FirstOrDefault(c => c.carId == carinrange.carId);
            var dbcarOwner = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(c => c.playerId == dbCar.ownerId);
            await NotifyHandler.SendNotification(player, $"Model: {dbCar.carmodel} CarID: {dbCar.carId} Owner: {dbcarOwner.firstName} {dbcarOwner.lastName}");
        }
Ejemplo n.º 10
0
        public Task jailtime_CMD(User player)
        {
            var dbChar = Utils.Utils.GetDatabaseCharacter(player.playerId);

            if (dbChar.jailTime > 1)
            {
                NotifyHandler.SendNotification(player, $"Du hast noch {dbChar.jailTime} Hafteinheiten!");
                return(Task.CompletedTask);
            }
            NotifyHandler.SendNotification(player, $"Du befindest dich nicht im Gefängnis!");
            return(Task.CompletedTask);
        }
Ejemplo n.º 11
0
 public static NotifyHandler InstanceCreation()
 {
     if (_scoreHandlerObject == null)
     {
         lock (lockingObject)
         {
             if (_scoreHandlerObject == null)
             {
                 _scoreHandlerObject = new NotifyHandler();
             }
         }
     }
     return(_scoreHandlerObject);
 }
Ejemplo n.º 12
0
        public async Task ooc_Chat(User player, params string[] args)
        {
            var playerPool  = Alt.GetAllPlayers();
            var dbChar      = Utils.Utils.GetDatabaseCharacter(player);
            var chatMessage = "";

            foreach (var x in args)
            {
                chatMessage += $"{x} ";
            }
            foreach (User p in playerPool.Where(x => x.Position.IsInRange(player.Position, 10f)))
            {
                await NotifyHandler.SendNotification(p, $"OOC: {dbChar.firstName} {dbChar.lastName} ({dbChar.playerId}) {chatMessage}");
            }
        }
Ejemplo n.º 13
0
        public static void LoadFromJson()
        {
            string        obj  = File.ReadAllText(@"..\\..\\Shop\\Shop.json");
            TempShopValue temp = JsonConvert.DeserializeObject <TempShopValue>(obj);

            nh                 = NotifyHandler.InstanceCreation();
            nh.VBombCount      = temp.VBombCount;
            nh.Apokalypsecount = temp.Apokalypsecount;
            nh.GoldAmount      = temp.GoldAmount;
            nh.SupernovaCount  = temp.SupernovaCount;
            nh.HighestScore    = temp.HighestScore;
            _highscore         = temp.HighestScore;
            nh.WaveHighScore   = temp.WaveHighScore;
            _waveScore         = temp.WaveHighScore;
            nh.LivesExceed     = temp.Lives;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 移除指定类型消息的指定事件
        /// </summary>
        /// <param name="message"> 消息类型 </param>
        /// <param name="call"> 事件方法 </param>
        public void Remove(Enum message, NotifyHandler call)
        {
            if (!_messageDic.ContainsKey(message))
            {
                return;
            }

            if (_messageDic[message] != call && _messageDic[message] != null)
            {
                _messageDic[message] -= call;
            }
            else
            {
                _messageDic.Remove(message);
            }
        }
Ejemplo n.º 15
0
        public async Task Leave(User player)
        {
            if (player.paintballArena == 0)
            {
                return;
            }
            await NotifyHandler.SendNotification(player, "Du hast Paintball verlassen!");

            await Utils.Utils.LoadClothes(player, Utils.Utils.GetDatabaseCharacter(player));

            Main.database.PaintballCollection.AsQueryable().FirstOrDefault(p => p.arenaId == player.paintballArena).playerCount -= 1;
            player.RemoveAllWeapons();
            player.paintballArena = 0;
            player.Dimension      = 0;
            await Utils.Utils.LoadPlayerWeapons(player);
        }
Ejemplo n.º 16
0
        public ActionResult PayNotifyUrl()
        {
            try
            {
                string[] strs   = Request.RawUrl.ToString().Split("/".ToCharArray());
                string   userID = strs[strs.Length - 1];
                LogerHelper.DefaultInfo(strs[strs.Length - 1]);
                NotifyHandler resHandler = new NotifyHandler(Request.InputStream);
                Hashtable     table      = resHandler.Parameters;
                ArrayList     akeys      = new ArrayList(table.Keys);
                akeys.Sort();
                foreach (string k in akeys)
                {
                    string v = (string)table[k];
                    LogerHelper.DefaultInfo(v);
                }
                string openid       = resHandler.GetParameter("openid");
                string total_fee    = resHandler.GetParameter("total_fee");
                string out_trade_no = resHandler.GetParameter("out_trade_no");
                LogerHelper.DefaultInfo("total_fee:    " + total_fee);
                LogerHelper.DefaultInfo("out_trade_no:    " + out_trade_no);
                resHandler.SetKey(Mch_Id);
                //验证请求是否从微信发过来(安全)
                //  if (resHandler.IsTenpaySign())
                // {
                //正确的订单处理
                LogerHelper.DefaultInfo("nofify     ok");
                //此处userid是回调url最后一个参数
                if (paymentbll.chargePayment(userID, Convert.ToInt32(total_fee), out_trade_no, (int)Commons.PayType.RECHARGE))
                {
                    LogerHelper.debug("微信支付成功!");
                }
                // WebHelper.Post(LocalContext.platformUrl + "/Pay/Recharge", "UserID=" + (Common.GlobalMap[openid] as UserInformation).userid + "Amount=" + total_fee + "PayOrderID=" + out_trade_no + "Type=1");
                //  }
                // else
                // {
                //错误的订单处理
                // LogerHelper.DefaultInfo("nofify     no");
                //  }
            }
            catch (Exception ex)
            {
                LogerHelper.DefaultInfo("ex:    " + ex.ToString());
            }

            return(Content("success"));
        }
Ejemplo n.º 17
0
        public void InitializeNotifyHandler()
        {
            if (string.IsNullOrEmpty(BotSettings.Token))
            {
                throw new InvalidOperationException($"{nameof(BotSettings.Token)} property must be specified");
            }
            if (UpdatesHandler == null)
            {
                throw new InvalidOperationException($"{nameof(UpdatesHandler)} property must be initialized first.");
            }
            if (Authorizer == null)
            {
                throw new InvalidOperationException($"{nameof(Authorizer)} property must be initialized first.");
            }

            NotifyHandler = new NotifyHandler();
        }
Ejemplo n.º 18
0
        public async Task medicDuty_CMD(User player)
        {
            Console.WriteLine("Call Medic CMD" + "Jobduty: " + player.IsJobDuty);
            if (player.IsJobDuty)
            {
                await NotifyHandler.SendNotification(player, "Du bist nun nichtmehr im Medic-Dienst!");

                player.IsJobDuty = false;
                return;
            }
            else
            {
                await NotifyHandler.SendNotification(player, "Du bist nun im Medic-Dienst!");

                player.IsJobDuty = true;
                return;
            }
        }
Ejemplo n.º 19
0
        void NotifyCallback(IntPtr handle, IntPtr pspec, IntPtr gch)
        {
            try {
                GLib.Signal sig = ((GCHandle)gch).Target as GLib.Signal;
                if (sig == null)
                {
                    throw new Exception("Unknown signal GC handle received " + gch);
                }

                NotifyArgs args = new NotifyArgs();
                args.Args    = new object[1];
                args.Args[0] = pspec;
                NotifyHandler handler = (NotifyHandler)sig.Handler;
                handler(GLib.Object.GetObject(handle), args);
            } catch (Exception e) {
                ExceptionManager.RaiseUnhandledException(e, false);
            }
        }
Ejemplo n.º 20
0
        public void TestUTC()
        {
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.UTC, Is.EqualTo(DateTime.UtcNow));

            NotifyHandler theHandler = new NotifyHandler(theLocation);
            DateTime      theDate    = DateTime.UtcNow;

            theLocation.UTC = theDate.AddHours(2);
            DateTime theNewDate = theLocation.UTC;

            Assert.That(theNewDate.Date, Is.EqualTo(theDate.Date));
            Assert.That(theNewDate.Hour, Is.EqualTo(theDate.Hour + 2));
            Assert.That(theNewDate.Second, Is.EqualTo(theDate.Second));
            Assert.That(theNewDate.Minute, Is.EqualTo(theDate.Minute));
            Assert.That(theHandler.nUtcChanges, Is.EqualTo(1));
        }
Ejemplo n.º 21
0
        internal async Task <bool> removeMoneyAsync(int price)
        {
            var dbChar   = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(c => c.ownerObjId == this.uid);
            var oldMoney = dbChar.moneyHand;

            dbChar.moneyHand -= price;
            if (dbChar.moneyHand < 0)
            {
                dbChar.moneyHand = oldMoney;
                await NotifyHandler.SendNotification(this, "Du hast nicht genug Geld!");

                return(false);
            }

            await Main.database.CharacterCollection.ReplaceOneAsync(c => c.ownerObjId == this.uid, dbChar);

            await this.UpdateMoneyHud(dbChar.moneyHand);

            return(true);
        }
Ejemplo n.º 22
0
            public FavorTimerNotify(PrayerTimer timer, string player, string serverGroupId, ILogger logger,
                                    ISoundManager soundManager, ITrayPopups trayPopups, [NotNull] SkillEntryParser skillEntryParser)
            {
                if (skillEntryParser == null)
                {
                    throw new ArgumentNullException("skillEntryParser");
                }
                this.serverGroupId    = serverGroupId;
                this.skillEntryParser = skillEntryParser;
                Settings = timer.favorSettings;

                favorHandler = new NotifyHandler(
                    logger,
                    soundManager,
                    trayPopups,
                    Settings.FavorNotifySoundId,
                    player,
                    "",
                    Settings.FavorNotifyPopupPersist);
            }
Ejemplo n.º 23
0
        public void TestLongitude()
        {
            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";

            theProfile.WriteValue(Telescope.ProgId, "Longitude", Convert.ToString(4.12345), "");
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(4.12345).Within(0.00001));

            NotifyHandler theHandler = new NotifyHandler(theLocation);

            theLocation.Longitude = 12.54321;
            double storedLongitude = Convert.ToDouble(theProfile.GetValue(Telescope.ProgId, "Longitude", ""));

            Assert.That(theLocation.Longitude, Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(storedLongitude, Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(theHandler.nLongitudeChanges, Is.EqualTo(1));
        }
Ejemplo n.º 24
0
        public Task OnColShape(IColShape colShape, IEntity entity, bool state)
        {
            if (state == false)
            {
                return(Task.CompletedTask);
            }
            if (entity is IPlayer)
            {
                var player = entity as User;
                if (!player.IsInVehicle)
                {
                    return(Task.CompletedTask);
                }
                NotifyHandler.SendNotification(player, "Verlasse dieses Gebiet innerhalb von 10 Sekunden", 10000);
            }

            if (entity is IVehicle)
            {
                var veh = entity as Car;
                Console.WriteLine("Create Timer");
                var EmpTimer = new Timer();
                EmpTimer.Interval = 10000;
                EmpTimer.Enabled  = true;
                EmpTimer.Elapsed += (sender, args) =>
                {
                    Console.WriteLine("Timer elapsed");

                    if (!veh.Position.IsInRange(colShape.Position, 200f))
                    {
                        EmpTimer.Dispose();
                        return;
                    }
                    ;
                    Console.WriteLine("Veh inside!");
                    EmpTimer.Dispose();
                    veh.SetNetworkOwner(veh.Driver, false);
                    veh.Driver.Emit("NetOwner:DestroyVehicle", veh);
                };
            }
            return(Task.CompletedTask);
        }
Ejemplo n.º 25
0
        public async Task Support_CMD(User player, params string[] args)
        {
            var playerpool = Alt.GetAllPlayers();

            var dbChar      = Utils.Utils.GetDatabaseCharacter(player);
            var supportText = $"{dbChar.firstName} {dbChar.lastName} ({dbChar.playerId}) ";

            foreach (var t in args)
            {
                supportText += $"{t} ";
            }

            foreach (var x  in playerpool)
            {
                var tempPlayer = x as User;
                if (tempPlayer.adminLevel >= 1)
                {
                    await NotifyHandler.SendSupportMessage(tempPlayer, supportText, 30000);
                }
            }
        }
Ejemplo n.º 26
0
        public Task revive_CMD(User player, int targetId)
        {
            if (!player.isAduty || player.adminLevel < 5)
            {
                return(Task.CompletedTask);
            }
            var playerpool = Alt.GetAllPlayers();

            foreach (User p in playerpool)
            {
                if (p.playerId != targetId)
                {
                    continue;
                }
                p.Spawn(p.Position, 0);
                NotifyHandler.SendNotification(p, "Du wurdest von einem Admin wiederbelebt!");
            }


            return(Task.CompletedTask);
        }
Ejemplo n.º 27
0
        public async Task pwset_CMD(User player, string username, string password)
        {
            if (!player.isAduty)
            {
                return;
            }
            var dbUser = Utils.Utils.GetDatabasePlayer(player);

            if (dbUser.adminLevel != 9)
            {
                return;
            }
            var wantedUser = Main.database.UserCollection.AsQueryable().FirstOrDefault(u => u.Username.ToLower() == username.ToLower());

            if (wantedUser == null)
            {
                return;
            }
            wantedUser.Password = BCrypt.Net.BCrypt.HashString(password);
            Main.database.UserCollection.ReplaceOne(u => u.Username.ToLower() == username.ToLower(), wantedUser);
            await NotifyHandler.SendNotification(player, "Du hast das Passwort von " + username + " erfolgreich geändert!");
        }
 /// <summary>
 /// 注册相应类型的回调
 /// </summary>
 /// <param name="handler">回调函数</param>
 /// <param name="msgType">消息类型</param>
 public void Register(NotifyHandler handler, EnumMsgType msgType)
 {
     try
     {
         //判断消息类型是否存在,为消息类型添加回调函数
         if (_callbackDic.ContainsKey(msgType))
         {
             _callbackDic[msgType].Add(handler);
         }
         else
         {
             _callbackDic[msgType] = new List <NotifyHandler> {
                 handler
             };
         }
         Logger.WriteInfoFmt(Log.ReceiverRegister, "消息类型:{0}", new object[] { msgType.ToString() });
     }
     catch (Exception ex)
     {
         Logger.WriteError(Log.ReceiverRegister, "注册消息接收组件时出现异常", ex);
     }
 }
Ejemplo n.º 29
0
        public async Task givekey_CMD(User player, string str_playerid)
        {
            int playerid = int.Parse(str_playerid);

            if (!player.Vehicle.Exists)
            {
                await NotifyHandler.SendNotification(player, "Du sitzt in keinem Auto!");

                return;
            }
            var playerVehicle = (Car)player.Vehicle;
            var dbCar         = Main.database.CarCollection.AsQueryable().ToList().FirstOrDefault(c => c.carId == playerVehicle.carId);

            if (dbCar.allowedIds.Contains(playerid))
            {
                await NotifyHandler.SendNotification(player, "Dieser Spieler hat bereits einen Schlüssel!");

                return;
            }
            dbCar.allowedIds.Add(playerid);
            playerVehicle.allowedIds.Add(playerid);
            await Main.database.CarCollection.ReplaceOneAsync(c => c.carId == playerVehicle.carId, dbCar);
        }
Ejemplo n.º 30
0
		static void DisconnectNotification (GLib.Object w, string signal, NotifyHandler handler)
		{
			var sig = GLib.Signal.Lookup (w, signal, delegateInstance);
			sig.RemoveDelegate (handler);
		}
Ejemplo n.º 31
0
		public static void AddNotification (GLib.Object w, NotifyHandler handler)
		{
			ConnectNotification (w, "notify", handler);
		}
Ejemplo n.º 32
0
		public static void AddNotification (GLib.Object w, string property, NotifyHandler handler)
		{
			ConnectNotification (w, "notify::" + property, handler);
		}
Ejemplo n.º 33
0
 public void RemoveNotification(NotifyHandler handler)
 {
     DisconnectNotification ("notify", handler);
 }
Ejemplo n.º 34
0
 void DisconnectNotification(string signal, NotifyHandler handler)
 {
     Signal sig = Signal.Lookup (this, signal, new NotifyDelegate (NotifyCallback));
     sig.RemoveDelegate (handler);
 }
Ejemplo n.º 35
0
 public void RemoveNotification(NotifyHandler handler)
 {
     RemoveSignalHandler ("notify", handler);
 }
Ejemplo n.º 36
0
        public void TestLongitude()
        {
            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";

            theProfile.WriteValue(Telescope.ProgId, "Longitude", Convert.ToString(4.12345), "");
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;
            Assert.That(theLocation.Longitude, Is.EqualTo(4.12345).Within(0.00001));

            NotifyHandler theHandler = new NotifyHandler(theLocation);
            theLocation.Longitude = 12.54321;
            double storedLongitude = Convert.ToDouble(theProfile.GetValue(Telescope.ProgId, "Longitude", ""));
            Assert.That(theLocation.Longitude, Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(storedLongitude,Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(theHandler.nLongitudeChanges, Is.EqualTo(1));
        }
Ejemplo n.º 37
0
 public void AddNotification(NotifyHandler handler)
 {
     AddSignalHandler ("notify", handler, typeof(NotifyArgs));
 }
Ejemplo n.º 38
0
		public static void RemoveNotification (GLib.Object w, NotifyHandler handler)
		{
			DisconnectNotification (w, "notify", handler);
		}
Ejemplo n.º 39
0
        public void TestUTC()
        {
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;
            Assert.That(theLocation.UTC, Is.EqualTo(DateTime.UtcNow));

            NotifyHandler theHandler = new NotifyHandler(theLocation);
            DateTime theDate = DateTime.UtcNow;
            theLocation.UTC = theDate.AddHours(2);
            DateTime theNewDate = theLocation.UTC;
            Assert.That(theNewDate.Date, Is.EqualTo(theDate.Date));
            Assert.That(theNewDate.Hour, Is.EqualTo(theDate.Hour + 2));
            Assert.That(theNewDate.Second, Is.EqualTo(theDate.Second));
            Assert.That(theNewDate.Minute, Is.EqualTo(theDate.Minute));
            Assert.That(theHandler.nUtcChanges, Is.EqualTo(1));
        }
Ejemplo n.º 40
0
		static void DisconnectNotification (GLib.Object w, string signal, NotifyHandler handler)
		{
			var sig = GLib.Signal.Lookup (w, signal, new NotifyDelegate (NotifyCallback));
			sig.RemoveDelegate (handler);
		}
Ejemplo n.º 41
0
    //
    // Construction/finalisation
    //

    /// <summary>
    /// Constructeur
    /// </summary>
    /// <param name="notifyHandler">délégué de notification des changements</param>
    public Locker( NotifyHandler notifyHandler )
      : this() {
      this.notifyHandler = notifyHandler;
    }
Ejemplo n.º 42
0
 public void AddNotification(string property, NotifyHandler handler)
 {
     AddSignalHandler ("notify::" + property, handler, typeof(NotifyArgs));
 }
Ejemplo n.º 43
0
 public void AddNotification(string property, NotifyHandler handler)
 {
     ConnectNotification ("notify::" + property, handler);
 }
Ejemplo n.º 44
0
 public void RemoveNotification(string property, NotifyHandler handler)
 {
     RemoveSignalHandler ("notify::" + property, handler);
 }
Ejemplo n.º 45
0
 public void AddNotification(NotifyHandler handler)
 {
     ConnectNotification ("notify", handler);
 }
Ejemplo n.º 46
0
 public void RemoveNotification(NotifyHandler handler)
 {
     RemoveSignalHandler("notify", handler);
 }
Ejemplo n.º 47
0
 public void RemoveNotification(string property, NotifyHandler handler)
 {
     DisconnectNotification ("notify::" + property, handler);
 }