Inheritance: IWindow
        /// <summary>
        /// Gets the window root that is the top level ascendant of the window.Content.
        /// </summary>
        /// <param name="window">The window.</param>
        /// <returns></returns>
        public static UIElement GetRealWindowRoot(Window window = null)
        {
            if (window == null)
            {
                window = Window.Current;
            }

            if (window == null)
            {
                return null;
            }

            var root = window.Content as FrameworkElement;

            if (root != null)
            {
                var ancestors = root.GetAncestors().ToList();

                if (ancestors.Count > 0)
                {
                    root = (FrameworkElement)ancestors[ancestors.Count - 1];
                }
            }

            return root;
        }
示例#2
0
        public ScreenHandler(sw.Window window)
        {
            var source = sw.PresentationSource.FromVisual(window);

            Control = GetCurrentScreen(window);
            scale   = (float)(source.CompositionTarget.TransformToDevice.M22 * 96.0 / 72.0);
        }
示例#3
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (textBox.Text.Length != 16)
            {
                textBlock1.Text = "Pogresan format broja licne karte"; return;
            }
            if (radioButton.IsChecked == true)
            {
                KontejnerskaKlasa.uplate.Add(new KLASE.Uplata(2m, DateTime.Now, "Satni"));
            }
            if (radioButton2.IsChecked == true)
            {
                KontejnerskaKlasa.uplate.Add(new KLASE.Uplata(10m, DateTime.Now, "Dnevni"));
            }
            if (radioButton3.IsChecked == true)
            {
                KontejnerskaKlasa.uplate.Add(new KLASE.Uplata(75m, DateTime.Now, "Mjesečni"));
            }
            if (radioButton1.IsChecked == true)
            {
                KontejnerskaKlasa.uplate.Add(new KLASE.Uplata(400m, DateTime.Now, "Godišnji"));
            }

            Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
            if (window != null)
            {
                Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
                if (frame != null)
                {
                    frame.Navigate((typeof(MainPage)));
                }
            }
        }
示例#4
0
 internal WindowWrapper(Window window)
 {
     if (ActiveWrappers.Any(x => x.Window == window))
         throw new Exception("Windows already has a wrapper; use Current(window) to fetch.");
     Window = window;
     ActiveWrappers.Add(this);
     window.Closed += (s, e) => { ActiveWrappers.Remove(this); };
 }
示例#5
0
 public static void ClearNavigationServices(Window window)
 {
     var wrapperToRemove = ActiveWrappers.FirstOrDefault(wrapper => object.ReferenceEquals(wrapper.Window, window));
     if (wrapperToRemove != null)
     {
         wrapperToRemove.NavigationServices.Clear();
     }
 }
示例#6
0
        internal static CGSize GetScreenSizeInternal(Windows.UI.Xaml.Window window)
        {
#if __IOS__
            var nativeFrame = window?.NativeWindow?.Frame ?? CGRect.Empty;

            return(new CGSize(nativeFrame.Width, nativeFrame.Height));
#else
            var applicationFrameSize = NSScreen.MainScreen.VisibleFrame;
            return(new CGSize(applicationFrameSize.Width, applicationFrameSize.Height));
#endif
        }
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
     if (window != null)
     {
         Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
         if (frame != null)
         {
             frame.Navigate((typeof(FormaUnosDezurnogRadnika)));
         }
     }
 }
示例#8
0
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
     if (window != null)
     {
         Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
         if (frame != null)
         {
             frame.Navigate((typeof(FormaGodisnjiIzvjestaj)));
         }
     }
 }
示例#9
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
     if (window != null)
     {
         Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
         if (frame != null)
         {
             frame.Navigate((typeof(MainPage)));
         }
     }
 }
示例#10
0
 public static void TryShowNewWindow <TView>()
 {
     Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
     if (window != null)
     {
         Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
         if (frame != null)
         {
             frame.Navigate(typeof(TView));
         }
     }
 }
示例#11
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     //dodaj korisnika button
     Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
     if (window != null)
     {
         Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
         if (frame != null)
         {
             frame.Navigate((typeof(FormaUnosKorisnikavol2)));
         }
     }
 }
示例#12
0
        static swf.Screen GetCurrentScreen(sw.Window window)
        {
            var centerPoint = new sd.Point((int)(window.Left + window.ActualWidth / 2), (int)(window.Top + window.ActualHeight / 2));

            foreach (var s in swf.Screen.AllScreens)
            {
                if (s.Bounds.Contains(centerPoint))
                {
                    return(s);
                }
            }
            return(swf.Screen.PrimaryScreen);
        }
示例#13
0
        public ViewService(Window window)
        {
            Window = window;

            DispatcherService = new Dispatcher.DispatcherService(window.Dispatcher);

            DisplayInformation = Windows.Graphics.Display.DisplayInformation.GetForCurrentView();

            ApplicationView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();

            UIViewSettings = Windows.UI.ViewManagement.UIViewSettings.GetForCurrentView();

            ActiveWindows.Add(this);
        }
        void subscribeToFrameEvents(Window frame)
        {
            if (frame != null && listeningToEvents == false)
            {
                frame.SizeChanged += frame_SizeChanged;

                var windowSize = new Size(frame.Bounds.Width, frame.Bounds.Height);

                //intial call to setup default styles
                handleChangeEvents(windowSize,
                                   ApplicationView.Value,
                                   false);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyGestureRecognizer"/> class.
        /// </summary>
        /// <param name="gesture">The gesture to recognized.</param>
        /// <exception cref="System.ArgumentNullException">gesture</exception>
        /// <exception cref="System.ArgumentException">The gesture needs to consist of at least one key or key combination.;gesture</exception>
        public KeyGestureRecognizer(KeyGesture gesture)
        {
            if (gesture == null)
            {
                throw new ArgumentNullException("gesture");
            }

            if (gesture.Count == 0)
            {
                throw new ArgumentException("The gesture needs to consist of at least one key or key combination.", "gesture");
            }

            this.gesture = gesture;
            this.window = Window.Current;
            this.window.CoreWindow.KeyDown += this.CoreWindowOnKeyDown;
        }
示例#16
0
 internal WindowWrapper(Window window)
 {
     if (Current(window) != null)
     {
         throw new Exception("Windows already has a wrapper; use Current(window) to fetch.");
     }
     Window = window;
     ActiveWrappers.Add(this);
     Dispatcher = new DispatcherWrapper(window.Dispatcher);
     window.CoreWindow.Closed += (s, e) =>
     {
         ActiveWrappers.Remove(this);
     };
     window.Closed += (s, e) =>
     {
         ActiveWrappers.Remove(this);
     };
 }
        public WindowWrapper(Window window)
        {
            if (ActiveWrappers.Any(x => x.Window == window))
                throw new Exception("Windows already has a wrapper; use Current(window) to fetch.");
            Window = window;
            ActiveWrappers.Add(this);
            Dispatcher = new DispatcherWrapper(window.Dispatcher);
            window.Closed += (s, e) => { ActiveWrappers.Remove(this); };

            _busyIndicator = new Grid
            {
                Background = new SolidColorBrush(Colors.Black) { Opacity = .5 },
            };
            _busyIndicator.Children.Add(new ProgressRing
            {
                Height = 100,
                Width = 100,
                Foreground = new SolidColorBrush(Colors.White),
                IsActive = true,
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center
            });
        }
示例#18
0
        private void button1_Click_1(object sender, RoutedEventArgs e)
        {
            decimal broj;
            bool    jelDecimalni = decimal.TryParse(textBox5.Text, out broj);

            if (!jelDecimalni)
            {
                textBlock6.Text = "Neispravna cijena!";
                return;
            }


            KontejnerskaKlasa.isplate.Add(new KLASE.Isplata(broj, datum.Date.DateTime, textBox1.Text));
            Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
            if (window != null)
            {
                Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
                if (frame != null)
                {
                    frame.Navigate((typeof(MainPage)));
                }
            }
        }
示例#19
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (checkBox.IsChecked == true)
            {
                textBlock2.Text = "Javite se vlasniku";
            }
            //provjerava validnost podataka ako vlasnik nije zaboravio pasword
            if (checkBox.IsChecked != true && radioButton.IsChecked == true)
            {
                if (textBox.Text != "boss")
                {
                    textBlock2.Text = "Pogresno korisnicko ime!!!";
                }
                else if (passwordBox.Password != "1234")
                {
                    textBlock2.Text = "Pogresan password!!!";
                }
                else
                {
                    //ako sve okej prodje, otvara se forma za vlasnika
                    Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
                    if (window != null)
                    {
                        Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
                        if (frame != null)
                        {
                            frame.Navigate((typeof(FormaVlasnikIzvjestaji)));
                        }
                    }
                }
            }
            //provjerava validnost podataka ako se loguje korisnik i nije zaboravio pass
            //treba napraviti formu koja ce se prikazati korisniku
            if (checkBox.IsChecked != true && radioButton1.IsChecked == true)
            {
                bool nadjen = false;
                foreach (Korisnik korisnik in KontejnerskaKlasa.korisnici)
                {
                    if (korisnik.Username == textBox.Text && korisnik.Password == passwordBox.Password)
                    {
                        nadjen = true;

                        Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
                        if (window != null)
                        {
                            Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
                            if (frame != null)
                            {
                                frame.Navigate((typeof(FormaKorisnik)));
                            }
                        }
                    }
                }
                //ako se ne nadje ni jedan korisnik sa usernameom i pw znaci da je pogrijesio
                if (!nadjen)
                {
                    textBlock2.Text = "Pogresan username ili password!!!";
                }
            }
            //Login za majstora
            if (checkBox.IsChecked != true && radioButton4.IsChecked == true)
            {
                bool nadjen = false;
                foreach (Majstor majstor in KontejnerskaKlasa.majstori)
                {
                    if (majstor.Username == textBox.Text && majstor.Password == passwordBox.Password)
                    {
                        Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
                        if (window != null)
                        {
                            Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
                            if (frame != null)
                            {
                                frame.Navigate((typeof(FormaIzvjestajMajstora)));
                            }
                        }
                    }
                }
                //ako se ne nadje ni jedan majstor sa usernameom i pw znaci da je pogrijesio
                if (!nadjen)
                {
                    textBlock2.Text = "Pogresan username ili password!!!";
                }
            }

            if (checkBox.IsChecked != true && radioButton2.IsChecked == true)
            {
                bool nadjen = false;
                foreach (DezurniRadnik radnik in KontejnerskaKlasa.dezurniRadnici)
                {
                    if (radnik.Username == textBox.Text && radnik.Password == passwordBox.Password)
                    {
                        Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
                        if (window != null)
                        {
                            Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
                            if (frame != null)
                            {
                                frame.Navigate((typeof(FormaDezurniRadnik)));
                            }
                        }
                    }
                }
                //ako se ne nadje ni jedan majstor sa usernameom i pw znaci da je pogrijesio
                if (!nadjen)
                {
                    textBlock2.Text = "Pogresan username ili password!!!";
                }
            }

            //Login za supervizora
            if (checkBox.IsChecked != true && radioButton3.IsChecked == true)
            {
                if (textBox.Text != "merima")
                {
                    textBlock2.Text = "Pogresno korisnicko ime!!!";
                }
                else if (passwordBox.Password != "1234")
                {
                    textBlock2.Text = "Pogresan password!!!";
                }
                else
                {
                    //ako sve okej prodje, otvara se forma za supervizora
                    Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
                    if (window != null)
                    {
                        Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
                        if (frame != null)
                        {
                            frame.Navigate((typeof(FormaSupervizor)));
                        }
                    }
                }
            }
        }
示例#20
0
 public static WindowWrapper Current(Window window) { return ActiveWrappers.FirstOrDefault(x => x.Window == window); }
示例#21
0
//event za klik na dugme dodaj
        private void button_Click(object sender, RoutedEventArgs e)
        {
            //validacija
            foreach (char slovo in textBox.Text)
            {
                if (!Char.IsLetter(slovo))
                {
                    textBlock10.Visibility = Visibility.Visible;
                    textBlock10.Text       = "Ime nije validno, unesite opet";
                    return;
                }
            }
            foreach (char slovo in textBox1.Text)
            {
                if (!Char.IsLetter(slovo))
                {
                    textBlock10.Visibility = Visibility.Visible;
                    textBlock10.Text       = "Prezime nije validno, unesite opet";
                    return;
                }
            }
            foreach (char broj in textBox2.Text)
            {
                if (!Char.IsDigit(broj))
                {
                    textBlock10.Visibility = Visibility.Visible;
                    textBlock10.Text       = "Broj telefona nije validan, unesite broj u formatu 0038xxxxxxxxx";
                    return;
                }
            }
            if (datumrodj.Date.Year < 1920 || datumrodj.Date.Year > 1997)
            {
                textBlock10.Text = "Niste unijeli dobro datum rođenja."; return;
            }
            if (textBox4.Text.Length != 14)
            {
                textBlock10.Text = "Pogresan format broja licne karte"; return;
            }
            foreach (Korisnik item in KontejnerskaKlasa.korisnici)
            {
                if (item.Username == textBox5.Text)
                {
                    textBlock10.Text = "Username vec zauzet."; return;
                }
            }
            if (textBox5.Text.Length > 10)
            {
                textBlock10.Text = "Username ne moze biti duzi od 10 znakova"; return;
            }
            if (passwordBox.Password.Length > 16)
            {
                textBlock10.Text = "Password ne moze btii duzi od 16 znakoma"; return;
            }

            foreach (char slovo in textBox3.Text)
            {
                if (!Char.IsLetter(slovo))
                {
                    textBlock10.Visibility = Visibility.Visible;
                    textBlock10.Text       = "Adresa nije validna";
                    return;
                }
            }
            //ako prodju sve validacije
            //dodajemo korisnika u kontejnersku klasu

            KontejnerskaKlasa.korisnici.Add(new Korisnik(textBox.Text, textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, datumrodj.Date.DateTime, textBox8.Text, textBox7.Text, textBox5.Text, passwordBox.Password));
            Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current;
            if (window != null)
            {
                Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame;
                if (frame != null)
                {
                    frame.Navigate((typeof(FormaDezurniRadnik)));
                }
            }
        }
 public WindowEvents(Window This)
 {
     this.This = This;
 }
        public void Dispose()
        {
            if (!this.window.Dispatcher.HasThreadAccess)
            {
                this.window.Dispatcher.RunAsync(
                    CoreDispatcherPriority.High,
                    Dispose);
                return;
            }

            this.window.CoreWindow.KeyDown -= this.CoreWindowOnKeyDown;
            this.window = null;
            this.gesture = null;
        }
示例#24
0
 public static IViewService Current(Windows.UI.Xaml.Window window)
 => ActiveWindows.FirstOrDefault(x => x.Window == window);
示例#25
0
 protected virtual INavigationProvider CreateNavigationManager(Window window, IFrameworkTypeResolver typeResolver, 
     ILifecycleProvider lifecycle)
 {
     return new UwpNavigationProvider(window, typeResolver, lifecycle);
 }
示例#26
0
 public static IWindowWrapper Current(Window window) => ActiveWrappers.FirstOrDefault(x => x.Window == window);
示例#27
0
 internal static void WindowCreated(Window window) => new WindowWrapper(window);
示例#28
0
 public IViewService Register(Window window)
 {
     return new ViewService(window);
 }
        public void Dispose()
        {
            if (!this.window.Dispatcher.HasThreadAccess)
            {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                this.window.Dispatcher.RunAsync(
                    CoreDispatcherPriority.High,
                    Dispose);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

                return;
            }

            this.window.CoreWindow.KeyDown -= this.CoreWindowOnKeyDown;
            this.window = null;
            this.gesture = null;
        }