Exemple #1
0
 void Awake()
 {
     NM = GetComponentInParent<NotificationsManager>();
     NM.CreateEvent("PortalSpawn");
     NM.CreateEvent("PortalTimeSet");
     NM.CreateEvent("Destroied");
 }
	// Use this for initialization
	void Awake () {
		if (instance != null)
				Destroy (this);
		else
				instance = this;

		DontDestroyOnLoad (this);
	}
Exemple #3
0
 void Start()
 {
     GameObject notmantmp = GameObject.FindGameObjectWithTag("Manager");
     NM = notmantmp.GetComponent<NotificationsManager>();
     NM.AddListener(OnPortalTimeSet,"PortalTimeSet");
     NM.PostNotification("PortalSpawn", type, 0);
     Debug.Log("spwn");
 }
Exemple #4
0
 public DownloadController(
     DownloadManager downloadManager,
     NotificationsManager notificationsManager,
     DownloadStarter downloadStarter,
     CompletedDownloadsDirectory completedDownloadsDirectory,
     DownloadJobsDictionary jobs)
 {
     _downloadManager             = downloadManager;
     _notificationsManager        = notificationsManager;
     _downloadStarter             = downloadStarter;
     _completedDownloadsDirectory = completedDownloadsDirectory;
     _jobs = jobs;
 }
Exemple #5
0
 public void DeleteTask(Models.TaskModel task)
 {
     for (int i = 0; i < TasksList.Count; i++)
     {
         if (TasksList[i].Id == task.Id)
         {
             TasksList.RemoveAt(i);
             break;
         }
     }
     Data.TasksDAL.StoreTasks(TasksList);
     NotificationsManager.RemoveTaskNotification(task);
 }
        /// <summary>
        /// Aceita uma solicitação de reserva
        /// </summary>
        /// <param name="userID">Usuário que pediu a carona</param>
        /// <param name="rideID">Identificador da carona</param>
        /// <param name="username">Nome do usuário que solicitou a carona</param>
        /// <param name="driverName">Nome do motorista</param>
        public static void AcceptReservation(Guid userID, Guid rideID, string username)
        {
            DBConfigurations database = new DBConfigurations();
            var reserve = (from reservation in database.RidesRequest
                           where
                           reservation.RideID == rideID &&
                           reservation.UserID == userID
                           select reservation).First();

            database.RidesRequest.Remove(reserve);
            database.SaveChanges();
            RidesManager.AcceptRide(reserve.UserID, reserve.RideID, username);
            NotificationsManager.AddRideRequestNotification(userID, username, true);
        }
Exemple #7
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            //user theme
            UpdateTheme(AppSettings.Instance.Theme);
            //HideStatusBar();

            ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseVisible);

#if WINDOWS_UWP
            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 500));
            ApplicationView.PreferredLaunchViewSize      = new Size(380, 620);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
#endif

            //update default live tile (because I renamed the image, it was showing empty for some users)
            NotificationsManager.UpdateDefaultTile(AppSettings.Instance.TransparentTile);

            if (RootFrame.Content == null)
            {
                RootFrame.ContentTransitions = null;
                RootFrame.Navigated         += this.RootFrame_FirstNavigated;

                //await Windows.Storage.ApplicationData.Current.SetVersionAsync(AppSettings.Instance.Version - 1, (req) => { });

                //prepare app data
                await AppData.Init();

                AppData.LoadNotesIfNecessary();

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!RootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            //received parameters and the app was suspended
            else if (e.Arguments != null && !String.IsNullOrEmpty(e.Arguments.ToString()))
            {
                RootFrame.Navigate(typeof(MainPage), e.Arguments);
            }

            Window.Current.Activate();

            //System.Diagnostics.Debug.WriteLine("IsMobile={0}", Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1));
        }
        private void OnSaveState()
        {
            //App.RootFrame.Background = previousBackground;

            viewModel.PropertyChanged -= OnViewModelPropertyChanged;

            var note = viewModel.Note;

            viewModel.Note = null;

            //deleted
            if (note == null)
            {
                return;
            }

            //remove change binding
            note.Images.CollectionChanged        -= Images_CollectionChanged;
            note.Checklist.CollectionChanged     -= Checklist_CollectionChanged;
            note.Checklist.CollectionItemChanged -= Checklist_CollectionItemChanged;
            note.PropertyChanged -= OnNotePropertyChanged;

            //prevent from losing changes when navigating with textbox focused
            //this.CommandBar.Focus(FocusState.Programmatic);
            //this.CommandBar.IsOpen = false;
            //await Task.Delay(0200);

            //trim
            note.Trim();

            //always update live tile
            NotificationsManager.UpdateNoteTileIfExists(note, AppSettings.Instance.TransparentNoteTile);

            //save or remove if empty
            if (note.Changed || note.IsEmpty())
            {
                AppData.CreateOrUpdateNote(note);
            }

            //checklist changed (fix cache problem with converter)
            if (checklistChanged)
            {
                note.NotifyChanges();
            }

            NoteEditViewModel.CurrentNoteBeingEdited = null;
            note = null;
        }
Exemple #9
0
        private async void Unpin(Note note)
        {
            if (note == null)
            {
                return;
            }
            App.TelemetryClient.TrackEvent("Unpin_NoteNotesControlViewModel");

            NotificationsManager.RemoveTileIfExists(note.ID);
            note.NotifyPropertyChanged("IsPinned");

            await Task.Delay(0500);

            note.NotifyPropertyChanged("IsPinned");
            note.NotifyPropertyChanged("CanPin");
        }
        private async void Pin()
        {
            App.TelemetryClient.TrackEvent("Pin_EditViewModel");

            if (Note.IsEmpty())
            {
                return;
            }
            if (IsNewNote)
            {
                await AppData.CreateOrUpdateNote(Note);
            }

            await NotificationsManager.CreateOrUpdateNoteTile(Note, AppSettings.Instance.TransparentNoteTile);

            Note.NotifyPropertyChanged("IsPinned");
            Note.NotifyPropertyChanged("CanPin");
        }
        void BtnGCNGToggleClick(object sender, EventArgs e)
        {
            String fct = "togglepublishnotifications";

            try
            {
                if (!SpecialFeatures.SpecialFeaturesMgt.AreSpecialFeaturesEnabled())
                {
                    return;
                }
                CookieContainer cookieJar = _daddy.CheckGCAccount(true, false);
                if (cookieJar == null)
                {
                    return;
                }

                List <GCNotification> associatedGCN;
                List <String>         ids = GetSelectedIds(out associatedGCN);
                if (ids.Count == 0)
                {
                    _daddy.MsgActionWarning(this, _daddy.GetTranslator().GetString("LblErrorNoSelectionElt"));
                    return;
                }


                DialogResult dialogResult = MessageBox.Show(_daddy.GetTranslator().GetString("AskConfirm"),
                                                            _daddy.GetTranslator().GetString(fct),
                                                            MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    foreach (String id in ids)
                    {
                        NotificationsManager.ToggleNotificationsImpl(_daddy, id, cookieJar);
                    }

                    PopulateList();
                    _daddy.MsgActionDone(this);
                }
            }
            catch (Exception ex)
            {
                _daddy.ShowException("", _daddy.GetTranslator().GetString(fct), ex);
            }
        }
Exemple #12
0
    // Use this for initialization
    void Start()
    {
        manager       = GameObject.Find("GameManager").GetComponent <StateManager>();
        notifications = manager.NotificationRef;

        board = GameObject.Find("GameController").GetComponent <BoardController>();

        thisCollider = gameObject.GetComponent <BoxCollider2D>();

        gridSize = board.gridSize;
        tileSize = board.tileSize;
        Gds      = board.Gds;

        thisOffset = new Vector2((tileSize * gridSize) + (tileSize / 2), (tileSize * gridSize) + (tileSize / 2));
        thisSize   = new Vector2((tileSize * gridSize), (tileSize * gridSize));

        thisCollider.offset = thisOffset;
        thisCollider.size   = thisSize;
    }
Exemple #13
0
        private async void RegisterUserNotificationTask()
        {
            var accessResult = await NotificationsManager.RequestAccessAsync();

            if (!accessResult)
            {
                this.EnableUserNotifications = false;
                return;
            }

            var result = BackgroundManager.RegisterUserNotificationTask();

            if (result)
            {
                return;
            }

            this.EnableUserNotifications = false;
        }
Exemple #14
0
    // Use this for initialization
    void Start()
    {
        manager       = GameObject.Find("GameManager").GetComponent <StateManager>();
        notifications = manager.NotificationRef;
        boardRef      = gameObject.GetComponent <BoardController>();

        notifications.AddListener(this, "GoRight");
        notifications.AddListener(this, "GoLeft");
        notifications.AddListener(this, "GoUp");
        notifications.AddListener(this, "GoDown");
        notifications.AddListener(this, "GoTopRight");
        notifications.AddListener(this, "newBoard");
        notifications.AddListener(this, "boardDestroyed");
        notifications.AddListener(this, "GoBack");

        thisPos  = gameObject.transform;
        cachePos = thisPos.position;
        Gds      = boardRef.Gds;
    }
Exemple #15
0
        private async void Pin(Note note)
        {
            if (note == null || note.IsEmpty())
            {
                return;
            }
            App.TelemetryClient.TrackEvent("Pin_NotesControlViewModel");

#if WINDOWS_PHONE_APP
            //on wp81, the app will suspend after creating the note
            //on app.xaml.cs the tile will be updated after suspension
            NoteEditViewModel.CurrentNoteBeingEdited = note;
#endif

            await NotificationsManager.CreateOrUpdateNoteTile(note, AppSettings.Instance.TransparentNoteTile);

            note.NotifyPropertyChanged("IsPinned");
            note.NotifyPropertyChanged("CanPin");
        }
Exemple #16
0
        protected override async void OnBackgroundActivated(BackgroundActivatedEventArgs bgArgs)
        {
            var deferral = bgArgs.TaskInstance.GetDeferral();

            switch (bgArgs.TaskInstance.Task.Name)
            {
            case "ToastBackgroundTask":
                var details = bgArgs.TaskInstance.TriggerDetails as ToastNotificationActionTriggerDetail;
                if (details != null)
                {
                    Dictionary <string, string> args = GetArgs(details.Argument);
                    TasksModel tasks = new TasksModel();
                    TaskModel  task  = tasks.TasksList.FirstOrDefault(t => t.Id.ToString() == args["task"]);
                    if (task == null)
                    {
                        deferral.Complete();
                        return;
                    }
                    switch (args["action"])
                    {
                    case "done":
                        tasks.DeleteTask(task);
                        break;

                    case "remindlater":
                        task.Notification = task.Notification.AddHours(1);
                        tasks.StoreTasks();
                        break;
                    }
                }
                break;

            case "TimeBackgroundTask":
                if (NotificationsManager.LastUpdateTasksFile < Data.TasksDAL.LastChange())
                {
                    NotificationsManager.UpdateTaskNotifications();
                }
                break;
            }

            deferral.Complete();
        }
Exemple #17
0
    // Use this for initialization
    void Start()
    {
        notificationsManager = FindObjectOfType <NotificationsManager>();

        cameraUIManager = FindObjectOfType <CameraUIManager>();
        player          = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>();

        grapesHolder = transform.GetChild(1).gameObject;


        grapes = grapesHolder.GetComponentsInChildren <Transform>();
        print(grapes.Length);


        foreach (Transform grapeBunchTransform in grapes)
        {
            bunchPositions.Add(grapeBunchTransform.position);
        }
        inventory = FindObjectOfType <Inventory>();
    }
        public NotificationHubsOutputAsyncCollector(
            NotificationHubsAttribute attribute)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }

            if (attribute.Connection == null)
            {
                throw new ArgumentNullException(nameof(attribute.Connection));
            }

            if (attribute.HubsName == null)
            {
                throw new ArgumentNullException(nameof(attribute.Connection));
            }

            client = NotificationsManager.GetClient(attribute.Connection, attribute.HubsName);
        }
Exemple #19
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
            RegisterToastBackgroundTasks();
            RegisterTimeBackgroundTasks();
            ApplicationData.Current.DataChanged += RoamingDataChangeHandler;
            NotificationsManager.UpdateTaskNotifications();
        }
Exemple #20
0
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var note = NoteEditViewModel.CurrentNoteBeingEdited;

            System.Diagnostics.Debug.WriteLine("OnSuspending {0}", note);

            //update tile
            if (note != null)
            {
                NotificationsManager.UpdateNoteTileIfExists(note, AppSettings.Instance.TransparentNoteTile).ConfigureAwait(false);

                //save or remove if empty
                if (note.Changed || note.IsEmpty())
                {
                    AppData.CreateOrUpdateNote(note).ConfigureAwait(false);
                }
            }

            var deferral = e.SuspendingOperation.GetDeferral();
            await SuspensionManager.SaveAsync();

            deferral.Complete();
        }
Exemple #21
0
        public bool AcceptFriend(string userID)
        {
            ErrorEnum error;
            var       userModel = UserManager.RetrieveUser(new Guid(User.Identity.Name), out error);

            if (userModel == null)
            {
                userModel = UserManager.RetrieveUser(new Guid(userID), out error);
            }

            bool accepted = FriendshipManager.AcceptFriend(userModel.ID, new Guid(userID), out error);

            if (error == ErrorEnum.NoErrors)
            {
                NotificationsManager.AddFriendAcceptedNotification(new Guid(userID), userModel.FullName);
                return(true);
            }
            else
            {
                ViewBag.ErrorMessage = error;
                return(false);
            }
        }
Exemple #22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="daddy"></param>
        public NotificationCreation(MainWindow daddy)
        {
            _daddy      = daddy;
            _sErrTitle  = _daddy.GetTranslator().GetString("Error");
            _sErrFormat = _daddy.GetTranslator().GetString("ErrWrongParameter");

            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            if (!SpecialFeatures.SpecialFeaturesMgt.AreSpecialFeaturesEnabled())
            {
                return;
            }

            btnGCNMap.Image = _daddy.GetImageSized("Earth");
            _daddy._cacheDetail._gmap.ControlTextLatLon = tbGCNCenter;
            tbGCNCenter.TextChanged += new System.EventHandler(this.txtCoord_TextChanged);
            tbGCNCenter.Text         = _daddy.HomeLat.ToString() + " " + _daddy.HomeLon.ToString();
            this.Text         = _daddy.GetTranslator().GetString("createpublishnotifications");
            lblGCNRadius.Text = _daddy.GetTranslator().GetString("FTFDistance");
            lblGCNCentre.Text = _daddy.GetTranslator().GetString("ParamCenterLatLon");
            lblGCNEmail.Text  = _daddy.GetTranslator().GetString("FTFEmails");
            lblGCNGrid.Text   = _daddy.GetTranslator().GetString("FTFCacheTypes");
            lblGCNNom.Text    = _daddy.GetTranslator().GetString("FTFName");
            btnGCNCancel.Text = _daddy.GetTranslator().GetString("BtnCancel");
            btnGCNCreate.Text = _daddy.GetTranslator().GetString("BtnOK");

            daddy.UpdateHttpDefaultWebProxy();
            String post_response = "";
            // On checke que les L/MDP soient corrects
            // Et on récupère les cookies au passage
            CookieContainer cookieJar = daddy.CheckGCAccount(true, false);

            if (cookieJar == null)
            {
                return;
            }

            // Pour récupérer les emails
            String         url        = "https://www.geocaching.com/notify/edit.aspx";
            HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);

            objRequest.Proxy           = daddy.GetProxy(); // Là encore, on peut virer le proxy si non utilisé (NULL)
            objRequest.CookieContainer = cookieJar;        // surtout récupérer le container de cookie qui est maintenant renseigné avec le cookie d'authentification
            HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();

            using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))
            {
                post_response = responseStream.ReadToEnd();
                responseStream.Close();
            }
            if (NotificationsManager.CheckWarningMessage(_daddy, post_response))
            {
                // Shit
            }

            List <String> lsemails = new List <string>();
            String        email    = "";
            String        mails    = MyTools.GetSnippetFromText("ctl00$ContentBody$LogNotify$ddlAltEmails", "select>", post_response);

            lsemails = MyTools.GetSnippetsFromText("value=\"", "\">", mails);
            if (lsemails.Count != 0)
            {
                email = lsemails[0];
            }
            cbGCNEmails.Items.AddRange(lsemails.ToArray());
            if (cbGCNEmails.Items.Count != 0)
            {
                cbGCNEmails.SelectedIndex = 0;
            }
            else
            {
                cbGCNEmails.Visible = false;
                lblGCNEmail.Visible = false;
            }

            // List of cache type (to associate with list of int)
            listOfCacheTypes   = new List <string>(new String[] { "Earthcache", "Event Cache", "Cache In Trash Out Event", "Giga-Event Cache", "Mega-Event Cache", "Letterbox Hybrid", "Multi-cache", "Traditional Cache", "Unknown Cache", "Wherigo Cache", "Virtual Cache" }); // BCR 20170825
            listOfCacheTypesId = new List <int>(new int[] { 137, 6, 13, 7005, 453, 5, 3, 2, 8, 1858, 4 });                                                                                                                                                                       // BCR 20170825

            //Matrix
            listOfAlloweKindPerCacheType = new List <Tuple <String, List <int> > >();        // BCR 20170825
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Found it", new List <int>(new int[] { 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Retract Listing", new List <int>(new int[] { 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Didn't find it", new List <int>(new int[] { 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Temporarily Disable Listing", new List <int>(new int[] { 8, 10, 10, 10, 9, 8, 8, 8, 8, 8, 8 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Write note", new List <int>(new int[] { 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Enable Listing", new List <int>(new int[] { 9, 11, 11, 11, 10, 9, 9, 9, 9, 9, 9 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Archive", new List <int>(new int[] { 3, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Update Coordinates", new List <int>(new int[] { 10, 9, 9, 9, 11, 10, 10, 10, 10, 10, 10 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Needs Archived", new List <int>(new int[] { 4, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Needs Maintenance", new List <int>(new int[] { 11, -1, -1, -1, 12, 11, 11, 11, 11, 11, 11 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Unarchive", new List <int>(new int[] { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Owner Maintenance", new List <int>(new int[] { 12, -1, -1, -1, -1, 12, 12, 12, 12, 12, 12 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Publish Listing", new List <int>(new int[] { 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Announcement", new List <int>(new int[] { -1, 6, 6, 6, 6, -1, -1, -1, -1, -1, -1 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Will Attend", new List <int>(new int[] { -1, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Attended", new List <int>(new int[] { -1, 4, 4, 4, 4, -1, -1, -1, -1, -1, -1 })));

            // Create listview
            lvGCNGrid.HeaderStyle = ColumnHeaderStyle.None;
            ImageList imglist = new ImageList();

            imglist.ColorDepth = ColorDepth.Depth32Bit;
            imglist.ImageSize  = new Size(20, 20); // this will affect the row height
            imglist.Images.Add(_daddy.GetImageSized("Fail"));
            lvGCNGrid.SmallImageList   = imglist;
            lvGCNGrid.MouseClick      += new MouseEventHandler(lstv_MouseClick);
            lvGCNGrid.FullRowSelect    = true;
            lvGCNGrid.MyHighlightBrush = new SolidBrush(Color.Transparent);
            lvGCNGrid.MySelectBrush    = new SolidBrush(Color.Transparent);

            // Create columns
            // First column is for notification kind
            EXColumnHeader col = new EXColumnHeader("Type", 150);

            lvGCNGrid.Columns.Add(col);
            // And a column per cache type
            foreach (String key in listOfCacheTypes)
            {
                EXBoolColumnHeader boolcol = new EXBoolColumnHeader("", 20);
                boolcol.TrueImage  = _daddy.GetImageSized("Selected");
                boolcol.FalseImage = _daddy.GetImageSized("NotSelected");
                //col = new EXColumnHeader("", 50);
                lvGCNGrid.Columns.Add(boolcol);
            }

            // And a line with all cache type
            EXListViewItem lvi = new EXListViewItem("Cache types");

            lvGCNGrid.Items.Add(lvi);
            foreach (String key in listOfCacheTypes)
            {
                EXImageListViewSubItem si = new EXImageListViewSubItem(MyTools.ResizeImage(_daddy.GetImageSized(key), 16, 16));
                lvi.SubItems.Add(si);
            }

            // Add a line for each notification kind
            foreach (Tuple <String, List <int> > o in listOfAlloweKindPerCacheType)
            {
                lvi = new EXListViewItem(o.Item1);
                lvGCNGrid.Items.Add(lvi);
                foreach (int i in o.Item2)
                {
                    if (i != -1)
                    {
                        EXBoolListViewSubItem subi = new EXBoolListViewSubItem(false);
                        lvi.SubItems.Add(subi);
                    }
                    else
                    {
                        EXListViewSubItem subi = new EXListViewSubItem("");
                        subi.BackColor = Color.DarkBlue;
                        lvi.SubItems.Add(subi);
                    }
                }
            }
        }
Exemple #23
0
        void BtnGCNCreateClick(object sender, EventArgs e)
        {
            // On vérifie
            // coordonnées
            Double dLat = Double.MaxValue;
            Double dLon = Double.MaxValue;
            String sLat = "";
            String sLon = "";
            bool   bOK  = ParameterObject.TryToConvertCoordinates(tbGCNCenter.Text, ref sLat, ref sLon);

            if (sLat != CoordConvHMI._sErrorValue)
            {
                dLat = MyTools.ConvertToDouble(sLat);
            }
            if (sLon != CoordConvHMI._sErrorValue)
            {
                dLon = MyTools.ConvertToDouble(sLon);
            }
            if (!bOK)
            {
                DisplayError(lblGCNCentre.Text, _daddy.GetTranslator().GetString("WaypointCoord"), tbGCNCenter.Text, "");
                return;
            }

            // nom
            if (tbGCNName.Text == "")
            {
                DisplayError(lblGCNNom.Text, _daddy.GetTranslator().GetString("lblnotempty"), tbGCNName.Text, "");
                return;
            }

            // radius
            Int32 radius = 0;

            if (!Int32.TryParse(tbGCNRadius.Text, out radius))
            {
                DisplayError(lblGCNRadius.Text, _daddy.GetTranslator().GetString("lblnotnumber"), tbGCNRadius.Text, "");
                return;
            }

            // email
            if ((cbGCNEmails.Visible) && (cbGCNEmails.SelectedIndex == -1))
            {
                DisplayError(lblGCNEmail.Text, _daddy.GetTranslator().GetString("lblvalue"), "", "");
                return;
            }

            String email = "";

            if (cbGCNEmails.Items.Count != 0)
            {
                int pos = cbGCNEmails.SelectedIndex;
                email = cbGCNEmails.Items[pos].ToString();
            }

            // type
            // au moins une croix quelque part...
            // int associé au type de cache, nom du type de cache, liste des commandes POST pour kind of notif
            // Tuple<int, string, List<String>
            // on va créer un dico avec comme clé le type de cache
            Dictionary <String, Tuple <int, string, List <String> > > dicoCreation = new Dictionary <string, Tuple <int, string, List <string> > >();

            // On parcourt toutes les lignes, sauf la première qui correspond aux types
            for (int i = 1; i < lvGCNGrid.Items.Count; i++)
            {
                // On a l'item
                EXListViewItem lvi = (EXListViewItem)(lvGCNGrid.Items[i]);

                // On parcourt ses sous items
                for (int k = 1; k < lvi.SubItems.Count; k++)
                {
                    EXBoolListViewSubItem svi = lvi.SubItems[k] as EXBoolListViewSubItem;
                    if (svi != null)
                    {
                        // On a une valeur checkable
                        if (svi.BoolValue)
                        {
                            // Et elle est checkée !!
                            // On construit ce qu'il nous faut maintenant
                            //msg += listOfCacheTypes[k-1] + " " + listOfCacheTypesId[k-1] + " " + listOfAlloweKindPerCacheType[i-1].Item1 + " " + listOfAlloweKindPerCacheType[i-1].Item2[k-1] + "\r\n";


                            String typeofcache         = listOfCacheTypes[k - 1];
                            int    typeofcacheid       = listOfCacheTypesId[k - 1];
                            String kindofnotifreadable = listOfAlloweKindPerCacheType[i - 1].Item1;
                            String kindofnotifpost     = "ctl00$ContentBody$LogNotify$cblLogTypeList$" + listOfAlloweKindPerCacheType[i - 1].Item2[k - 1];
                            if (dicoCreation.ContainsKey(typeofcache))
                            {
                                // On met à jour la liste des kind of notif
                                Tuple <int, string, List <String> > obj = dicoCreation[typeofcache];
                                obj.Item3.Add(kindofnotifpost);
                            }
                            else
                            {
                                Tuple <int, string, List <String> > obj = new Tuple <int, string, List <string> >(typeofcacheid, typeofcache, new List <string>(new string[] { kindofnotifpost }));
                                dicoCreation.Add(typeofcache, obj);
                            }
                        }
                    }
                }
            }

            if (dicoCreation.Count == 0)
            {
                DisplayError(lblGCNGrid.Text, _daddy.GetTranslator().GetString("lblvalue"), "", "");
                return;
            }

            /*
             * foreach(KeyValuePair<String, Tuple<int, string, List<String>>> pair in dicoCreation)
             * {
             *      Tuple<int, string, List<String>> obj = pair.Value;
             *      msg += obj.Item1.ToString() + " " + obj.Item2 + " -> ";
             *      foreach(String s in obj.Item3)
             *      {
             *              msg += s + " ";
             *      }
             *      msg += "\r\n";
             * }
             * _daddy.MSG(msg);
             * return;
             */

            // On est valide, on peut créer
            _daddy._cacheDetail._gmap.ControlTextLatLon = null;

            // Go création
            CookieContainer cookieJar = _daddy.CheckGCAccount(true, false);
            String          url       = "https://www.geocaching.com/notify/edit.aspx";
            bool            error     = false;

            foreach (KeyValuePair <String, Tuple <int, string, List <String> > > pair in dicoCreation)
            {
                Tuple <int, string, List <String> > obj = pair.Value;
                // On demande la page par défaut pour initialiser une nouvelle demande
                HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
                objRequest.Proxy           = _daddy.GetProxy(); // Là encore, on peut virer le proxy si non utilisé (NULL)
                objRequest.CookieContainer = cookieJar;         // surtout récupérer le container de cookie qui est maintenant renseigné avec le cookie d'authentification
                HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
                String          post_response;
                using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))
                {
                    post_response = responseStream.ReadToEnd();
                    responseStream.Close();
                }
                // On regarde si on a un message de warning
                if (NotificationsManager.CheckWarningMessage(_daddy, post_response))
                {
                    // Shit
                    error = true;
                    break;
                }

                // Une mise à jour pour définir le type de cache
                String post_string = NotificationsManager.GeneratePostString(_daddy, post_response, dLat, dLon, radius, tbGCNName.Text, obj, email, true);
                post_response = NotificationsManager.GeneratePostRequets(_daddy, url, post_string, cookieJar);

                // Une mise à jour pour définir le type de notif
                post_string   = NotificationsManager.GeneratePostString(_daddy, post_response, dLat, dLon, radius, tbGCNName.Text, obj, email, true);
                post_response = NotificationsManager.GeneratePostRequets(_daddy, url, post_string, cookieJar);
                if (NotificationsManager.CheckValidationMessage(_daddy, post_response))
                {
                    // Shit
                    error = true;
                    break;
                }
            }
            if (!error)
            {
                _daddy.MsgActionDone(this);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemple #24
0
 void Awake()
 {
     NM = GetComponentInParent<NotificationsManager>();
     NM.CreateEvent("eventoProva");
 }
Exemple #25
0
 void Start()
 {
     NM = GetComponentInParent<NotificationsManager>();
     NM.AddListener(OnEvProva, "eventoProva");
 }
Exemple #26
0
        /// <summary>
        /// POST: api/Messages
        /// Receive a message from a user and reply to it
        /// </summary>
        public async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            if (activity.Type == ActivityTypes.Message)
            {
                string notificationData = string.Empty;
                // Notitication is sent
                if (NotificationsManager.TryGetNotificationData(activity, out notificationData))
                {
                    // A notification related backchannel message was detected
                    Notification notification = Notification.FromJsonString(notificationData);

                    var dialogManager = DialogManager.Dialogs.GetInstance();

                    //notification is already the active dialog
                    if (dialogManager.IsActiveDialog(activity.Conversation.Id))
                    {
                        await Notifications.NotificationsManager.SendNotificationAsync(notification);
                    }
                    else
                    {
                        //if there is not active dialog
                        if (dialogManager.IsFirstDialog(activity.Conversation.Id) && !dialogManager.ActiveDialogExist())
                        {
                            await Notifications.NotificationsManager.SendNotificationAsync(notification);
                        }
                        else
                        {
                            if (notification.Priority < NotificationPriorityOptions.High)
                            {
                                dialogManager.StackDialog(activity, notification);
                                var responseMessage = new HttpResponseMessage(HttpStatusCode.OK);
                                return(responseMessage);
                            }
                            else
                            {
                                var pausedDialog = dialogManager.PauseActiveDialog();
                                notification.Message = $"High Prio Message: {notification.Message}";
                                await Notifications.NotificationsManager.SendNotificationAsync(notification);

                                dialogManager.UnPauseActiveDialog(pausedDialog);
                            }
                        }
                    }
                }
                // Normal message is sent
                else
                {
                    // Normal Message, just sent it.
                    //Save sending party to Azure Table
                    MessageRouting.MessageRouterManager.Instance.StoreParties(activity);
                    await Conversation.SendAsync(activity, () => new RootDialog());
                }
            }
            else
            {
                HandleSystemMessage(activity);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK);

            return(response);
        }
        void BtnGCNGUpdateClick(object sender, EventArgs e)
        {
            String fct = "updatepublishnotifications";

            try
            {
                if (!SpecialFeatures.SpecialFeaturesMgt.AreSpecialFeaturesEnabled())
                {
                    return;
                }
                CookieContainer cookieJar = _daddy.CheckGCAccount(true, false);
                if (cookieJar == null)
                {
                    return;
                }

                List <GCNotification> associatedGCN;
                List <String>         ids = GetSelectedIds(out associatedGCN);
                if (ids.Count == 0)
                {
                    _daddy.MsgActionWarning(this, _daddy.GetTranslator().GetString("LblErrorNoSelectionElt"));
                    return;
                }

                List <ParameterObject> lst = new List <ParameterObject>();
                lst.Add(new ParameterObject(ParameterObject.ParameterType.Coordinates /*good*/, _daddy.GetInitialCoordinates(), "latlon", _daddy.GetTranslator().GetString("ParamCenterLatLon"), _daddy.GetTranslator().GetStringM("TooltipParamLatLon")));

                ParametersChanger changer = new ParametersChanger();
                changer.HandlerDisplayCoord = _daddy.HandlerToDisplayCoordinates;
                changer.DisplayCoordImage   = _daddy.GetImageSized("Earth");
                changer.Title         = _daddy.GetTranslator().GetString("updatepublishnotifications");
                changer.BtnCancel     = _daddy.GetTranslator().GetString("BtnCancel");
                changer.BtnOK         = _daddy.GetTranslator().GetString("BtnOk");
                changer.ErrorFormater = _daddy.GetTranslator().GetString("ErrWrongParameter");
                changer.ErrorTitle    = _daddy.GetTranslator().GetString("Error");
                changer.Parameters    = lst;
                changer.Font          = _daddy.Font;
                changer.Icon          = _daddy.Icon;

                // Force creation du get handler on control
                changer.CreateControls();
                _daddy._cacheDetail._gmap.ControlTextLatLon = changer.CtrlCallbackCoordinates;

                if (changer.ShowDialog() == DialogResult.OK)
                {
                    _daddy._cacheDetail._gmap.ControlTextLatLon = null;
                    Double dlon = Double.MaxValue;
                    Double dlat = Double.MaxValue;
                    if (ParameterObject.SplitLongitudeLatitude(lst[0].Value, ref dlon, ref dlat))
                    {
                        foreach (String id in ids)
                        {
                            NotificationsManager.UpdateNotificationsImpl(_daddy, id, cookieJar, dlat, dlon);
                        }

                        _daddy.MsgActionDone(this);
                    }
                }
                else
                {
                    _daddy._cacheDetail._gmap.ControlTextLatLon = null;
                }
            }
            catch (Exception ex)
            {
                _daddy.ShowException("", _daddy.GetTranslator().GetString(fct), ex);
            }
        }
Exemple #28
0
 void Start()
 {
     _notificationsManager = FindObjectOfType <NotificationsManager>();
     _isActivated          = false;
 }
Exemple #29
0
 internal void NotificationsManagerInit()
 {
     _notificationsManager = new NotificationsManager();
 }
Exemple #30
0
 void Awake()
 {
     Notification = GameObject.Find("GameManager").GetComponent <NotificationsManager>();
     anim         = GetComponent <Animator>();
 }
Exemple #31
0
 public NotificationsController(NotificationsManager mgr, HsConfig config)
 {
     _Mgr    = mgr;
     _Config = config;
 }
Exemple #32
0
 private void RoamingDataChangeHandler(Windows.Storage.ApplicationData appData, object o)
 {
     NotificationsManager.UpdateTaskNotifications();
 }
 private void Start()
 {
     NotificationsManager.CreateNotificationChannel("1", "Notifiations", Unity.Notifications.Android.Importance.High, "High Importance Notifcations");
 }
        public static async Task <Response> TryUpdateBidPhaseAndNotify(IServiceScope scope, IMailService mail, string bidId)
        {
            YotyContext          context              = scope.ServiceProvider.GetRequiredService <YotyContext>();
            IBidsManager         bidsManager          = new BidsManager(null, context);
            NotificationsManager notificationsManager = new NotificationsManager(context, mail);

            Response <BidPhase> updatePhaseResponse;

            try
            {
                updatePhaseResponse = await bidsManager.TryUpdatePhase(bidId).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                return(new Response()
                {
                    IsOperationSucceeded = false, SuccessOrFailureMessage = ex.Message
                });
            }

            Response notificationResponse = null;
            Response modifyDbResponse     = null;

            if (!updatePhaseResponse.IsOperationSucceeded)
            {
                Console.WriteLine($"UpdatePhase bidId:{bidId}, no update needed");
                return(new Response()
                {
                    IsOperationSucceeded = true, SuccessOrFailureMessage = updatePhaseResponse.SuccessOrFailureMessage
                });
            }
            switch (updatePhaseResponse.DTOObject)
            {
            case BidPhase.Vote:
                Console.WriteLine($"UpdatePhase bidId:{bidId}, new phase is vote");
                notificationResponse = await notificationsManager.NotifyBidTimeToVote(bidId).ConfigureAwait(false);

                modifyDbResponse = await bidsManager.UpdateBidProposalsToRelevant(bidId).ConfigureAwait(false);

                break;

            case BidPhase.Payment:
                Console.WriteLine($"UpdatePhase bidId:{bidId}, new phase is payment");
                notificationResponse = await notificationsManager.NotifyBidTimeToPay(bidId).ConfigureAwait(false);

                modifyDbResponse = await bidsManager.GetProposalWithMaxVotes(bidId).ConfigureAwait(false);

                if (modifyDbResponse.IsOperationSucceeded)
                {
                    // TODO figure better condition
                    notificationResponse = await notificationsManager.NotifyBidChosenSupplier(bidId).ConfigureAwait(false);
                }
                break;

            case BidPhase.CancelledSupplierNotFound:
                Console.WriteLine($"UpdatePhase bidId:{bidId}, new phase is canceled no relevant proposals found");
                notificationResponse = await notificationsManager.NotifyBidParticipantsSupplierNotFoundCancellation(bidId).ConfigureAwait(false);

                modifyDbResponse = await bidsManager.UpdateBidProposalsToRelevant(bidId).ConfigureAwait(false);

                break;

            case BidPhase.CancelledNotEnoughBuyersPayed:
                Console.WriteLine($"UpdatePhase bidId:{bidId}, new phase is canceled not enough consumers paid");
                modifyDbResponse = await bidsManager.CancelBid(bidId).ConfigureAwait(false);

                if (modifyDbResponse.IsOperationSucceeded)
                {
                    notificationResponse = await notificationsManager.NotifyBidAllMissingPaymentsCancellation(bidId).ConfigureAwait(false);
                }
                break;

            case BidPhase.Completed:
                Console.WriteLine($"UpdatePhase bidId:{bidId}, new phase is completed");
                modifyDbResponse = await bidsManager.CompleteBid(bidId).ConfigureAwait(false);

                if (modifyDbResponse.IsOperationSucceeded)
                {
                    notificationResponse = await notificationsManager.NotifyBidAllCompletion(bidId).ConfigureAwait(false);
                }
                break;
            }
            if (notificationResponse != null && !notificationResponse.IsOperationSucceeded)
            {
                return(notificationResponse);
            }
            if (modifyDbResponse != null && !modifyDbResponse.IsOperationSucceeded)
            {
                //TODO need to update
                return(modifyDbResponse);
            }
            return(new Response()
            {
                IsOperationSucceeded = true, SuccessOrFailureMessage = "TryUpdateBidPhaseAndNotify Success!"
            });
        }
Exemple #35
0
        /// <summary>
        /// Realiza consulta para trazer os dados do usuário no banco de dados e armazenar o resultado em uma
        /// variável de seção.
        /// </summary>
        /// <param name="userID">ID do usuário logado (Guid)</param>
        /// <param name="error">Enum de retorno de erros</param>
        /// <returns></returns>
        public static UserModel RetrieveUser(Guid userID, out ErrorEnum error)
        {
            DBConfigurations database = new DBConfigurations();

            error = ErrorEnum.NoErrors;

            try
            {
                var userDTO   = (from user in database.Users where user.ID == userID select user).First();
                var userModel = Conversor.UserDTOToModel(userDTO);

                #region Messages

                var messagesDTO = UserManager.GetMessages(userModel.ID);
                userModel.MessagesFromMe = new List <Messages>();
                userModel.MessagesToMe   = new List <Messages>();

                foreach (var message in messagesDTO)
                {
                    if (message.SenderID == userModel.ID)
                    {
                        userModel.MessagesFromMe.Add(message);
                    }
                    else
                    {
                        userModel.MessagesToMe.Add(message);
                    }
                }
                #endregion

                #region Rides

                userModel.DonorRides    = RidesManager.GetDonorRides(userModel.ID);
                userModel.ReceiverRides = RidesManager.GetReceiverRides(userModel.ID);
                userModel.OpenRequests  = RidesManager.GetRidesRequests(userModel.ID);

                #endregion

                #region BankAccount

                var userBankAccount = UserBankManager.GetUserBankAccount(userDTO.UserBankID);
                userModel.BankAccount.Account = userBankAccount.Account;
                userModel.BankAccount.Agency  = userBankAccount.Agency;
                userModel.BankAccount.BankID  = userBankAccount.BankID;
                userModel.BankAccount.ID      = userBankAccount.ID;

                #endregion

                #region Image

                userModel.FileContentResult = ImagesManager.RetrieveImage(userModel.ID);

                #endregion

                #region Friends Requests

                userModel.FriendsRequests = FriendshipManager.GetFriendsRequests(userModel.ID);

                #endregion

                #region ListNotifications

                userModel.ListNotifications = NotificationsManager.GetUserNotifications(userModel.ID);
                userModel.RidesRequests     = RidesRequestManager.GetAllRequestsByDriver(userModel.ID);

                #endregion

                return(userModel);
            }
            catch (Exception)
            {
                error = ErrorEnum.ExceptionError;
                return(null);
            }
        }