Пример #1
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Translate();
            DatabaseHelperClass dbhandle = new DatabaseHelperClass();
            ObservableCollection <Classes.Idioma> myLang  = dbhandle.ReadIdiomas();
            ObservableCollection <Classes.Pais>   myCount = dbhandle.ReadPaises();

            ComboBoxLang.ItemsSource    = myLang.OrderBy(i => i.Nome).ToList();
            ComboBoxCountry.ItemsSource = myCount.OrderBy(i => i.Nome).ToList();

            CultureInfo ci        = new CultureInfo(Windows.System.UserProfile.GlobalizationPreferences.Languages[0]);
            string      SOlang    = ci.TwoLetterISOLanguageName;
            Boolean     langfound = false;

            foreach (var lang in myLang)
            {
                if (SOlang == lang.Codigo_Idioma)
                {
                    langfound = true;
                }
            }

            if (!langfound)
            {
                NoLangPanel.Visibility = Visibility.Visible;
                btnPanel.Margin        = new Thickness(0, 0, 0, 0);
            }
        }
Пример #2
0
        private void listBoxobj_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Classes.Conteudo_Topico m = new Classes.Conteudo_Topico();
            m = listBoxobj.SelectedItem as Classes.Conteudo_Topico;

            // If selected index is -1 (no selection) do nothing
            if (listBoxobj.SelectedIndex == -1)
            {
                return;
            }

            // Check if Subtopic Exists
            string s = Convert.ToString(m.parent_topico.Titulo);
            DatabaseHelperClass dbtopicos = new DatabaseHelperClass();
            Boolean             exists    = dbtopicos.SubtopicExist(s);

            if (exists)
            {
                // Navigate to the new page
                Frame.Navigate(typeof(Pages.Subtopicos), m.parent_topico.Titulo);
            }
            else
            {
                // Navigate to the new page
                Frame.Navigate(typeof(Pages.Conteudo), m.parent_topico);
            }

            // Reset selected index to -1 (no selection)
            listBoxobj.SelectedIndex = -1;
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPage.instance.change_title("Esquadra mais próxima");
            DatabaseHelperClass dbtemas = new DatabaseHelperClass();
            ObservableCollection <Classes.Entidade> EntList = dbtemas.ReadEntidade();

            this.EntList = EntList;
            CalcDist();
            closest_police();
            NomeEnt.Text      = closest.Nome;
            MoradaEnt.Text    = closest.Morada;
            CodPostalEnt.Text = closest.Codigo_Postal;

            TeleEnt.Text  = closest.Telefone.ToString();
            EmailEnt.Text = closest.Email;

            if (closest.Fax.ToString() == "0")
            {
                FaxEnt.Text       = "Não Disponível";
                FaxEnt.Foreground = new SolidColorBrush(Colors.Gray);
            }
            else
            {
                FaxEnt.Text = closest.Fax.ToString();
            }

            ImageEnt.Source = new BitmapImage(new Uri(ConfigData.Iconpath + closest.Anexo, UriKind.Absolute));
            MapFrame.Navigate(typeof(Pages.Contactos), closest);
            Translate();
        }
Пример #4
0
        private async void CalcDist()
        {
            var         geolocator = new Geolocator();
            Geoposition position;
            Position    CurrentP = new Position();

            try
            {
                // Carry out the operation  Geoposition pos =
                position           = MainPage.instance.getPos();
                CurrentP.Latitude  = position.Coordinate.Latitude;
                CurrentP.Longitude = position.Coordinate.Longitude;
            }
            catch
            {
                //Operation aborted Your App does not have permission to access location data.
                //Launcher.LaunchUriAsync(new Uri("ms-settings-location:"));
            }


            DatabaseHelperClass dbtemas = new DatabaseHelperClass();

            foreach (var E in EntList)
            {
                double   lat     = dbtemas.latitude(E.N_Vertice);
                double   lon     = dbtemas.longitude(E.N_Vertice);
                Position TargetP = new Position();
                TargetP.Latitude  = lat;
                TargetP.Longitude = lon;

                E.dist = Distance(CurrentP, TargetP, DistanceType.Kilometers);
            }
        }
Пример #5
0
        public AddingViewModel(IDialogService dialogService, INavigationService navigationService)
        {
            IsActivitySplitViewPaneOpen = false;
            _dialogService        = dialogService;
            _navigationService    = navigationService;
            ContactListCollection = new ObservableCollection <ContactList>();
            int counts = ContactListCollection.Count;

            //VideosObservableCollections = GetVideos();
            WorkOrder = new ObservableCollection <SimpleDemoData>()
            {
                new SimpleDemoData {
                    GTitle = "Equipments", Id = 1, count = 3, Image = "/Images/Big/Artboard [email protected]"
                },
                new SimpleDemoData {
                    GTitle = "Inspections", Id = 2, count = 53, Image = "/Images/Big/Artboard 1 copy [email protected]"
                },
                new SimpleDemoData {
                    GTitle = "Notifications", Id = 3, count = counts, Image = "/Images/Big/Artboard 1 [email protected]"
                },
                new SimpleDemoData {
                    GTitle = "WorkOrders", Id = 4, count = 90, Image = "/Images/Big/Artboard 1 copy [email protected]"
                }
            };
            NotificationsStatus = new ObservableCollection <string>()
            {
                "Completed", "Progress", "Submitted"
            };
            // TreeItems = BuildTree(5, 5);
            Db_Helper = new DatabaseHelperClass();//Creating object for DatabaseHelperClass.cs from ViewModel/DatabaseHelperClass.cs
        }
Пример #6
0
        //Для отображения списка устройств и выбора активного в комбобоксе
        private void ReadDeviceList_Loaded(object sender, RoutedEventArgs e)
        {
            ObservableCollection <Device> ComboList = new ObservableCollection <Device>();
            ReadAllDeviceList             dbdevices = new ReadAllDeviceList();
            DatabaseHelperClass           Db_Helper = new DatabaseHelperClass();

            ComboList = dbdevices.GetAllDevices();
            try
            {
                ComboBox.ItemsSource = ComboList.OrderBy(i => i.Id).ToList();
                if (Sync_Page.Main_Current_Device.Model != null)
                {
                    CurrentDevice = Sync_Page.Main_Current_Device;
                    foreach (var device in ComboList)
                    {
                        if (device.Name == CurrentDevice.Name)
                        {
                            var index = ComboList.IndexOf(device);
                            ComboBox.SelectedIndex = index;
                        }
                    }
                    ReadSongList_Loaded();
                }
                else
                {
                    Percent.Text = "На устройстве будет свободно __ Gb";
                }
            }
            catch
            {
                //Пустое значение
            }
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPage.instance.change_title("Definições");
            Translate();
            DatabaseHelperClass dbidiomas = new DatabaseHelperClass();
            ObservableCollection <Classes.Idioma> myLang = dbidiomas.ReadIdiomas();//Get all DB contacts
            string pht = "Selected Language";

            foreach (var lang in myLang)
            {
                if (localSettings.Values["Idioma"].ToString() == lang.Codigo_Idioma)
                {
                    pht = lang.Nome;
                }
            }

            ComboBoxIdioma.PlaceholderText = pht;
            ComboBoxIdioma.ItemsSource     = myLang.ToList();

            Geolocator locator = new Geolocator();

            if (locator.LocationStatus == PositionStatus.Disabled)
            {
                geoText.Visibility = Visibility.Visible;
            }
        }
Пример #8
0
        private async void AddContact_Click(object sender, RoutedEventArgs e)
        {
            DatabaseHelperClass Db_Helper = new DatabaseHelperClass();

            if (NametxtBx.Text != "" && PhonetxtBx.Text != "")
            {
                string gendertext;
                if (GenderMaleRd.IsChecked == true)
                {
                    gendertext = "Nam";
                }
                else if (GenderFemaleRd.IsChecked == true)
                {
                    gendertext = "Nữ";
                }
                else
                {
                    gendertext = "Nam";
                }
                Db_Helper.Insert(new Contacts(NametxtBx.Text.Trim(), PhonetxtBx.Text.Trim(), EmailtxtBx.Text.Trim(), AddresstxtBx.Text.Trim(), gendertext));//
                //NavigationService.Navigate(new Uri("/Views/ReadContactList.xaml", UriKind.Relative));
                NavigationService.GoBack();
            }
            else
            {
                MessageBox.Show("Bạn chưa nhập họ tên hoặc số điện thoại!");
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ExpenseReport deletingExpense = (sender as Button).Tag as ExpenseReport;

            DatabaseHelperClass.DeleteExpenseReport(deletingExpense);
            this.Context.LoadReport.Execute();
        }
Пример #10
0
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            DatabaseHelperClass dbHelper = new DatabaseHelperClass();
            ObservableCollection <ImageModel> favImages = dbHelper.GetImages();

            ImageGrid.DataContext = favImages;
        }
Пример #11
0
        private async void AddEmployee_Click(object sender, RoutedEventArgs e)
        {
            Saving.IsActive = true;
            DatabaseHelperClass Db_Helper = new DatabaseHelperClass();//Creating object for DatabaseHelperClass.cs from ViewModel/DatabaseHelperClass.cs

            if (NametxtBx.Text != "" & PhonetxtBx.Text != "" & PositiontxtBx.Text != "" & AddresstxtBx.Text != "" & AgetxtBx.Text != "" & RatetxtBx.Text != "")
            {
                Db_Helper.Insert(new Employees(NametxtBx.Text, PhonetxtBx.Text, PositiontxtBx.Text, AddresstxtBx.Text, AgetxtBx.Text, RatetxtBx.Text));

                ReadAllEmployeesList dbAtte = new ReadAllEmployeesList();
                DB_Employees = dbAtte.GetAllEmployees();
                newAtte.GenerateAttendance(NametxtBx.Text);

                Employees.EmployeeAdded = true; //reference that the navigation came from adding employee
                if (fromMainPage != "firstEmployee")
                {
                    Frame.BackStack.RemoveAt(Frame.BackStackDepth - 1); //removing the back button's previous history
                }
                Frame.Navigate(typeof(EmployeeBuddy));                  //after adding Employee redirect to EmployeeBuddy page
            }
            else
            {
                MessageDialog messageDialog = new MessageDialog("Please fill all the fields");//Text should not be empty
                await messageDialog.ShowAsync();

                Saving.IsActive = false;
            }
        }
Пример #12
0
        private void DeleteAll_Click(object sender, RoutedEventArgs e)
        {
            DatabaseHelperClass Db_Helper = new DatabaseHelperClass();

            Db_Helper.DeleteAllContact(); //delete all DB contacts
            DB_ContactList.Clear();       //Clear collections
            listBoxobj.ItemsSource = DB_ContactList;
        }
Пример #13
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            ObservableCollection <makinat> DB_ContactList = new ObservableCollection <makinat>();
            DatabaseHelperClass            dbcontacts     = new DatabaseHelperClass();

            DB_ContactList         = dbcontacts.ReadContacts();
            listBoxobj.ItemsSource = DB_ContactList.OrderByDescending(i => i.Id).ToList();
        }
Пример #14
0
        public DetailSViewModel(INavigationService navigationService, IDialogService dialogService)
        {
            _navigationService = navigationService;

            _dialogService = dialogService;
            MessengerInstance.Register <ContactList>(this, p => GetContacts(p));
            Db_Helper = new DatabaseHelperClass();
        }
Пример #15
0
        private async void ListViewItem_Loaded(object sender, RoutedEventArgs e)
        {
            DatabaseHelperClass db = new DatabaseHelperClass();

            if (RefInBack)
            {
                //Start Of EventsAPI call
                db.DeleteAllEvents();
                List <EventClass> listevents = new List <EventClass>();
                listevents = await GetEventsAPIAsync();

                db.Insert(listevents);
                //End of Events API Call



                List <EventClass> l = new List <EventClass>();
                l = db.ReadEvents();

                List <EventClass> Day1_Events = new List <EventClass>();
                List <EventClass> Day2_Events = new List <EventClass>();
                List <EventClass> Day3_Events = new List <EventClass>();
                List <EventClass> Day4_Events = new List <EventClass>();

                Day1_Events = (l.Where(p => p.Day == "1").ToList()).OrderBy(eve => eve.Name).ToList();
                Day2_Events = (l.Where(p => p.Day == "2").ToList()).OrderBy(eve => eve.Name).ToList();
                Day3_Events = (l.Where(p => p.Day == "3").ToList()).OrderBy(eve => eve.Name).ToList();
                Day4_Events = (l.Where(p => p.Day == "4").ToList()).OrderBy(eve => eve.Name).ToList();

                List <Day> list = new List <Day>();
                Day        day1 = new Day();
                day1.Events = Day1_Events;
                day1.day    = "day 1";

                Day day2 = new Day();
                day2.Events = Day2_Events;
                day2.day    = "day 2";

                Day day3 = new Day();
                day3.Events = Day3_Events;
                day3.day    = "day 3";

                Day day4 = new Day();
                day4.Events = Day4_Events;
                day4.day    = "day 4";


                list.Add(day1);
                list.Add(day2);
                list.Add(day3);
                list.Add(day4);

                RefInBack = false;

                this.defaultViewModel["Days"]    = list;
                (sender as ListView).ItemsSource = this.defaultViewModel["Days"];
            }
        }
        private async void Fbook(object sender, RoutedEventArgs e)
        {
            DatabaseHelperClass dbhelper = new DatabaseHelperClass();
            ImageModel          mm       = mal;

            dbhelper.Insert(mm);
            MessageDialog SuccessMsg = new MessageDialog("Image added sucessfully to your favorites");
            await SuccessMsg.ShowAsync();
        }
        private void DeleteAll_Click(object sender, RoutedEventArgs e)
        {
            DatabaseHelperClass delete = new DatabaseHelperClass();

            delete.DeleteAllContact(); //delete all DB contacts
            DB_ContactList.Clear();    //Clear collections
            btnDelete.IsEnabled    = false;
            listBoxobj.ItemsSource = DB_ContactList;
        }
Пример #18
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var param = e.Parameter as string[];

            rootPage = param[0];
            sqlip    = param[1];
            localDb  = new DatabaseHelperClass(sqlip);
            errorLog = new ErrorLog(sqlip);
        }
Пример #19
0
        private void ruaj_Click(object sender, RoutedEventArgs e)
        {
            DatabaseHelperClass Db_Helper = new DatabaseHelperClass();

            Db_Helper.Insert(new Tabela.makinat("Auto",
                                                localSettings.Values["targa"].ToString(),
                                                localSettings.Values["shasia"].ToString()));
            Frame.Navigate(typeof(shfaqMakinat));
        }
Пример #20
0
        public MainPage()
        {
            this.InitializeComponent();
            DatabaseHelperClass dbhelp = new DatabaseHelperClass();
            dbhelp.OnCreate("sample2.sqlite");

            Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;

            this.NavigationCacheMode = NavigationCacheMode.Required;
        }
Пример #21
0
        private void InsertMusicFormat()
        {
            string[]            ListFormat = new string[] { "mp3", "flac", "alac", "m4a", "ape", "ogg", "wav", "wma", "aac" };
            DatabaseHelperClass Db_Helper  = new DatabaseHelperClass();

            foreach (string format in ListFormat)
            {
                Db_Helper.Insert(new MusicFormat(format));
            }
        }
Пример #22
0
 private void Command(IUICommand command)
 {
     if (command.Label.Equals("Yes"))
     {
         DatabaseHelperClass Db_Helper = new DatabaseHelperClass();
         Db_Helper.DeleteAllContact(); //delete all DB contacts
         DB_ContactList.Clear();       //Clear collections
         Btn_Delete.IsEnabled   = false;
         listBoxobj.ItemsSource = DB_ContactList;
     }
 }
Пример #23
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            Category cat = e.NavigationParameter as Category;

            this.DataContext = cat;

            DatabaseHelperClass db   = new DatabaseHelperClass();
            List <EventClass>   list = db.ReadEvents();

            EventsList.ItemsSource = list.Where(item => item.cid == cat.cid).ToList();
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Category cat = e.Parameter as Category;

            this.DataContext = cat;

            DatabaseHelperClass db   = new DatabaseHelperClass();
            List <EventClass>   list = db.ReadEvents();

            EventsList.ItemsSource = list.Where(item => item.cid == cat.cid).ToList();
        }
Пример #25
0
 public static void Init(string _sqlip)
 {
     try
     {
         sqlsrv  = new SqlServerRepository(_sqlip);
         localdb = new DatabaseHelperClass(_sqlip);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #26
0
        public void Filter_Fav_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            List <int> Favs = new List <int>();

            if ((sender as ComboBox).SelectedIndex == 1)
            {
                Day dayfav = new Day();
                dayfav.day = "";

                ObservableCollection <EventClass> FavEvents = new ObservableCollection <EventClass>();


                var roamingSettings = ApplicationData.Current.RoamingSettings;
                if (roamingSettings.Values["Favs"] != null)
                {
                    Favs = Deserialize <List <int> >(roamingSettings.Values["Favs"].ToString());
                }

                if (Favs.Count == 0)
                {
                    dayfav.day = "No Favourites Added Yet..";
                }

                else
                {
                    DatabaseHelperClass db = new DatabaseHelperClass();

                    foreach (int id in Favs)
                    {
                        if (db.ReadEventById(id) != null)
                        {
                            FavEvents.Add(db.ReadEventById(id));
                        }
                    }

                    foreach (EventClass eve in FavEvents)
                    {
                        eve.Fav_Image = "";
                    }
                }
                dayfav.Events = FavEvents;

                Favourites.Clear();
                Favourites.Add(dayfav);
                MyPivot.ItemsSource = Favourites;
            }
            else
            {
                AssignItemSource();
                MyPivot.ItemsSource = Days;
            }
        }
Пример #27
0
        private async void AddContact_Click(object sender, RoutedEventArgs e)
        {
            DatabaseHelperClass Db_Helper = new DatabaseHelperClass();//Creating object for DatabaseHelperClass.cs from ViewModel/DatabaseHelperClass.cs

            if (NametxtBx.Text != "" & PhonetxtBx.Text != "")
            {
                Db_Helper.Insert(new Contacts(NametxtBx.Text, PhonetxtBx.Text));
                Frame.Navigate(typeof(HomePage));//after add contact redirect to contact listbox page
            }
            else
            {
            }
        }
Пример #28
0
        private void Translate()
        {
            ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;

            if (localSettings.Values["Idioma"].ToString() == "pt")
            {
                return;
            }

            DatabaseHelperClass dbhandle = new DatabaseHelperClass();

            NewTitle = dbhandle.Translate(NewTitle);
        }
Пример #29
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Translate();

            MainPage.instance.change_title(NewTitle);
            MainPage.instance.seach_clear();

            string Text = e.Parameter.ToString();
            DatabaseHelperClass dbtemas = new DatabaseHelperClass();
            ObservableCollection <Search_Result> ResultList = dbtemas.Search(Text);

            listBoxobj.ItemsSource = ResultList.ToList();
        }
Пример #30
0
 public App()
 {
     this.InitializeComponent();
     this.Suspending += OnSuspending;
     if (!CheckFileExists(nameDataBase).Result)
     {
         try
         {
             DatabaseHelperClass.CreateDatabase();
         }
         catch { }
     }
 }
Пример #31
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPage.instance.change_title("Temas");

            DatabaseHelperClass dbtemas = new DatabaseHelperClass();
            ObservableCollection <Classes.Conteudo_Tema> TemasList = dbtemas.ReadTemas();//Get all DB contacts

            foreach (var Temas in TemasList)
            {
                Temas.parent_tema.Icone = ConfigData.Iconpath + Temas.parent_tema.Icone;
            }
            listBoxobj.ItemsSource = TemasList.OrderByDescending(i => i.Titulo).ToList();//Latest contact ID can Display first
        }