/// <summary>
        /// Creates a new event and saves a copy
        /// </summary>
        private NewEventItemModel(AppLevelModel appViewModel, DateTime eventStartDate, bool navFromCalendar) :
            base(appViewModel, eventStartDate, navFromCalendar)
        {
            EditEvent  = true;
            IsNewEvent = true;

            // Override base icons
            IconCode  = "Add";
            PageTitle = Q.Resources.NewEvent_PageTitle;

            SubMenu.Clear();
            SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_EditAttendance, "Contact2", EditAttendanceCommand));
            SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_SaveEvent, "Save", SaveEventCommand));
            SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_DiscardChanges, "Cancel", CancelEventChangesCommand));

            SqLiteManager.RetriveNewEvent(this);

            // Create backup
            meetingBackup = new Meeting
            {
                EventTitle        = EventTitle,
                Venue             = Venue,
                Description       = Description,
                EventStart        = EventBegin,
                EventEnd          = EventBegin,
                ImagePath         = ImagePath,
                VenueContactEmail = VenueContactEmail,
                VenueContactPhone = VenueContactPhone,
                MeetingID         = ID
            };
        }
Esempio n. 2
0
        protected void SetMainMenu()
        {
            // Set to 0 to force index change
            MainMenuIndex = 0;
            if (NavFromCalendar)
            {
                MainMenu = new ObservableCollection <MenuItem <AppLevelModel> >()
                {
                    new MenuItem <AppLevelModel>(Q.Resources.Event_ReturnToCalendar, "ImportAll")
                };
                MainMenuIndex = -1;
                ResetMainMenuIndexOnNavigation = true;
            }
            else
            {
                MainMenu      = AppViewModel.TopLevelMenu;
                MainMenuIndex = 1;
                ResetMainMenuIndexOnNavigation = false;
            }

            SubMenu.Clear();
            SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_EditAttendance, "Contact2", EditAttendanceCommand));
            if (EditEvent)
            {
                SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_SaveEvent, "Save", SaveEventCommand));
                SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_DiscardChanges, "Cancel", CancelEventChangesCommand));
            }
            else
            {
                SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_EditEvent, "Edit", ViewEventCommand));
                SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_DeleteEvent, "Delete", DeleteEventCommand));
            }
        }
        private async Task <bool> CancelChangesCommandTask()
        {
            if (!backupContact.EmailAddress.Equals(EmailAddress) ||
                !backupContact.EmailAddress.Equals(EmailAddress) ||
                !backupContact.EmailAddress2.Equals(EmailAddress2) ||
                !backupContact.FirstName.Equals(FirstName) ||
                !backupContact.ImagePath.Equals(ImagePath) ||
                !backupContact.LastName.Equals(LastName) ||
                !backupContact.PhoneNumber.Equals(PhoneNumber) ||
                !backupContact.PhoneNumber2.Equals(PhoneNumber2) ||
                !backupContact.ImagePath.Equals(ImagePath))
            {
                AppViewModel.MessageDialogResults = MessageDialogResultsEnum.No_Results;

                // Send message
                AppViewModel.MessageDialog(
                    Q.Resources.Contact_CancelConfirmDialog_Message,
                    Q.Resources.Contact_CancelConfirmDialog_Title,
                    MessageDialogOptions.Okay_Cancel);

                await Task.Factory.StartNew(() =>
                {
                    while (AppViewModel.MessageDialogResults == MessageDialogResultsEnum.No_Results)
                    {
                        Task.Delay(100);
                    }
                });

                if (AppViewModel.MessageDialogResults == MessageDialogResultsEnum.Okay)
                {
                    // Cancel changes
                    SubMenu.Clear();
                    SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Contact_Edit, "Edit", EditCommand));
                    EditContact = false;

                    // Restore from backup
                    ID            = backupContact.ContactID;
                    EmailAddress  = backupContact.EmailAddress;
                    EmailAddress2 = backupContact.EmailAddress2;
                    FirstName     = backupContact.FirstName;
                    LastName      = backupContact.LastName;
                    PhoneNumber   = backupContact.PhoneNumber;
                    PhoneNumber2  = backupContact.PhoneNumber;
                    ImagePath     = backupContact.ImagePath;

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
 private async void For_CancelChangesCommand()
 {
     if (await CancelChangesCommandTask())
     {
         EditContact = false;
         SubMenu.Clear();
         SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Contact_Edit, "Edit", EditCommand));
         SubMenuIndex = -1;
     }
 }
Esempio n. 5
0
        protected override void EventSaveAction()
        {
            // Restore sub-menu
            SubMenu.Clear();
            SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_EditAttendance, "Contact2", EditAttendanceCommand));
            SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Event_EditEvent, "Edit", EditEventCommand));
            EditEvent = false;

            AppViewModel.Calendar.AddOrUpdateEvent(this);
        }
Esempio n. 6
0
        /// <summary>
        /// Confirm if user wants to cancel changes
        /// </summary>
        private async Task <bool> CancelChangesCommandTask()
        {
            if (!string.IsNullOrWhiteSpace(EmailAddress) ||
                !string.IsNullOrWhiteSpace(EmailAddress2) ||
                !string.IsNullOrWhiteSpace(FirstName) ||
                !string.IsNullOrWhiteSpace(LastName) ||
                !string.IsNullOrWhiteSpace(PhoneNumber) ||
                !string.IsNullOrWhiteSpace(PhoneNumber2))
            {
                AppViewModel.MessageDialogResults = MessageDialogResultsEnum.No_Results;

                // Send message
                AppViewModel.MessageDialog(
                    Q.Resources.Contact_SaveConfirmDialog_Message,
                    Q.Resources.Contact_CancelConfirmDialog_Title,
                    MessageDialogOptions.Okay_Cancel);

                await Task.Factory.StartNew(() =>
                {
                    while (AppViewModel.MessageDialogResults == MessageDialogResultsEnum.No_Results)
                    {
                        Task.Delay(100);
                    }
                });

                if (AppViewModel.MessageDialogResults == MessageDialogResultsEnum.Okay)
                {
                    SubMenu.Clear();
                    SubMenu.Add(new MenuItem <AppLevelModel>(Q.Resources.Contact_Edit, "Edit", EditCommand));
                    EditContact = false;

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
Esempio n. 7
0
        public void CreateSubMenuItems(dhModule pModule)
        {
            // need check what sub module are allowed 14,15,29,30,31,26,27,38,1,2,3,4,5,6,7,8,9,10,11,12,13,22,23,24,34,35,19,20,21
            List <string> AllowedModuleIds = Globalized.ObjCurrentUser.VAllowdModule.Split(',').ToList();
            // I have list of module on local
            ObservableCollection <dhModule> submodule = Globalized.AppModuleList.Where(ob => ob.IModuleParentID == pModule.IModuleID).ToObservableCollection <dhModule>();

            SubMenu.Clear();
            foreach (dhModule Module in submodule)
            {
                //BitmapImage image = new BitmapImage(new Uri("/SublimeCareCloud;component/Images/" + Module.VIconName, UriKind.Relative));
                //Module.VIconName = new Uri("/SublimeCareCloud;component/Images/" + Module.VIconName, UriKind.Relative).ToString();

                if (AllowedModuleIds.Contains(Module.IModuleID.ToString()))
                {
                    this.SubMenu.Add(Module);
                }
            }// end main menu
        }
Esempio n. 8
0
        override public bool doEvent(object caller, MouseMotionEventArgs mmData)
        {
            if (!visible)
            {
                return(false);
            }

            if (SubMenu != null && SubMenu.doEvent(this, mmData))
            {
                return(true);
            }

            Point p = new Point(mmData.X - position.X, mmData.Y - position.Y);

            selected = -1;

            if (p.X < 0 ||
                p.Y < 0 ||
                p.X >= dimensions.Width ||
                p.Y >= dimensions.Height)
            {
                // Out of focus, brute force clear
                Clear();
                return(false);
            }

            int scanY = 0;
            int index = 0;

            foreach (MenuItem mi in menuEntries)
            {
                if (mi is MenuSeperator)
                {
                    scanY += Compound.Padding;
                }
                else
                {
                    if (scanY + DisplaySettings.lableFont.Height > p.Y)
                    {
                        selected = index;

                        if (mi.IsPopup())
                        {
                            if (SubMenu != null)
                            {
                                SubMenu.Clear();
                            }

                            SubMenu          = (PopupMenu)mi;
                            SubMenu.Position = new Point(dimensions.Width - Compound.Padding * 2 + position.X, scanY + position.Y + Compound.Padding);
                            SubMenu.Show();
                        }

                        return(true);
                    }
                    scanY += DisplaySettings.lableFont.Height;
                }
                index++;
            }

            return(true);
        }