Exemple #1
0
        private async void ButtonSaveColor_Click(object sender, RoutedEventArgs e)
        {
            string         message;
            string         title;
            InfoDialogType dialogType = InfoDialogType.Info;

            if (Employee != null && !string.IsNullOrEmpty(_color))
            {
                var result = await Proxy.ChangeEmployeeForegroundColor(Employee.EmployeeId, _color);

                if (result)
                {
                    Proxy.UpdateEmployee(Employee);
                    message = "Die Schriftfarbe Deiner Anmeldeinformationsbox wurde geändert";
                    title   = "Erfolg";
                }
                else
                {
                    message    = "Die Schriftfarbe konnte nicht gespeichert werden";
                    title      = "Fehler";
                    dialogType = InfoDialogType.Error;
                }
            }
            else
            {
                message    = "Ein Fehler ist aufgetreten";
                title      = "Fehler";
                dialogType = InfoDialogType.Error;
            }
            var dialog = new InfoDialog(message, title, dialogType);
            await dialog.ShowAsync();
        }
Exemple #2
0
 private async void ServiceCallback_ServiceMessageEvent(string message)
 {
     await Dispatcher.RunTaskAsync(async() =>
     {
         var dialog = new InfoDialog(message);
         await dialog.ShowAsync();
     });
 }
Exemple #3
0
        private async void ButtonCreateProfiles_Click(object sender, RoutedEventArgs e)
        {
            if (MaterialRequirementsCollection == null || MaterialRequirementsCollection.MaterialRequirements.Count == 0 ||
                LocalClient.Division == null)
            {
                var infoDialog = new InfoDialog("Es konnten keine Profile in Materialanforderungen gefunden werden!");
                await infoDialog.ShowAsync();

                return;
            }

            var result = new List <MaterialRequirementModel>();
            var list   = new List <ElementModel>();

            foreach (var materialRequirement in MaterialRequirementsCollection.MaterialRequirements)
            {
                if (materialRequirement.ArticleDescription.Contains("I-Schale"))
                {
                    if (!result.Exists(x => x.Id == materialRequirement.Id))
                    {
                        result.Add(materialRequirement);
                        var item = MaterialRequirementsCollection.MaterialRequirements.FirstOrDefault(x => x.ArticleDescription.Contains("A-Schale") &&
                                                                                                      x.Position == materialRequirement.Position && x.Length == materialRequirement.Length &&
                                                                                                      x.Count == materialRequirement.Count);
                        if (item != null)
                        {
                            var element = new ElementModel()
                            {
                                Length        = Convert.ToDouble(materialRequirement.Length).ToString(),
                                Position      = GetPositionNumber(materialRequirement.Position),
                                Filename      = FileEntry.Name,
                                ColourInside  = materialRequirement.SurfaceInside,
                                ColourOutside = materialRequirement.SurfaceOutside,
                                Amount        = new Random().Next(0, Convert.ToInt32(materialRequirement.Count)),
                                Count         = Convert.ToDouble(materialRequirement.Count),
                                Description   = string.Format("I-Schale: {0:s}", materialRequirement.ArticleNumber) + Environment.NewLine +
                                                string.Format("A-Schale: {0:s}", item.ArticleNumber) + Environment.NewLine +
                                                string.Format("Mat. Nummer: {0:d}", materialRequirement.MaterialNumber),
                                ElementType  = Contracts.Domain.Core.Enums.ElementType.Profile,
                                PlantOrderId = PlantOrder.Id,
                                Surface      = string.Format("I: {0:s} - A: {1:s}", materialRequirement.SurfaceInside, materialRequirement.SurfaceOutside),
                                Contraction  = GetPositionContraction(materialRequirement.Position),
                                DivisionId   = LocalClient.Division.DivisionId
                            };

                            list.Add(element);
                        }
                    }
                }
            }

            if (list.Count > 0)
            {
                ElementCollection.Load(list);
                ElementView.SelectedIndex = 0;
            }
        }
Exemple #4
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(1200, 600));
            EnableLoadingControl("Verbindung wird aufgebaut...");

            var clientDeviceInformation = new EasClientDeviceInformation();
            var deviceId  = clientDeviceInformation.Id;
            var hostNames = NetworkInformation.GetHostNames();
            var hostname  = hostNames.FirstOrDefault(name => name.Type == HostNameType.DomainName)?.DisplayName ?? null;
            var username  = WindowsIdentity.GetCurrent().Name;

            if (string.IsNullOrEmpty(hostname))
            {
                var dialog = new InfoDialog("Der Hostname konnte nicht aufgelöst werden.", "Fehler", InfoDialogType.Error);
                await dialog.ShowAsync();

                return;
            }

            if (string.IsNullOrEmpty(username))
            {
                var dialog = new InfoDialog("Der Username konnte nicht aufgelöst werden.", "Fehler", InfoDialogType.Error);
                await dialog.ShowAsync();

                return;
            }

            if (deviceId == null || deviceId == Guid.Empty)
            {
                var dialog = new InfoDialog("Der Geräte Identifikator konnte nicht aufgelöst werden.", "Fehler", InfoDialogType.Error);
                await dialog.ShowAsync();

                return;
            }

            await Proxy.InitializeAsync();

            Proxy.ServiceCallback.AuthorizedEvent       += ServiceCallback_AuthorizedEvent;
            Proxy.ServiceCallback.ServiceMessageEvent   += ServiceCallback_ServiceMessageEvent;
            Proxy.ServiceCallback.AuthorizedFailedEvent += ServiceCallback_AuthorizedFailedEvent;
            Proxy.ServiceCallback.EmployeeUpdatedEvent  += ServiceCallback_EmployeeUpdatedEvent;
            bool connect = Proxy.Connect(deviceId, hostname, username);

            if (!connect)
            {
                var dialog = new InfoDialog("Der Service steht momentan nicht zur Verfügung", "Anmeldung fehlgeschlagen", InfoDialogType.Error);
                await dialog.ShowAsync();
            }

            var tempFolder = Windows.Storage.ApplicationData.Current.TemporaryFolder;
            var d          = new MessageDialog(tempFolder.Path);
            await d.ShowAsync();

            Proxy.DeviceId = deviceId;
        }
Exemple #5
0
        private async void ButtonAddProfile_Click(object sender, RoutedEventArgs e)
        {
            var dialog       = new ProfileDialog();
            var dialogResult = await dialog.ShowAsync();

            if (dialogResult == ContentDialogResult.Primary)
            {
                var profile = dialog.Result;
                if (profile != null)
                {
                    var existingElement = ProfileExists(profile);
                    if (existingElement != null)
                    {
                        var yesNoDialog = new YesNoDialog("Profil bereits vorhanden",
                                                          string.Format("Das Profil mit der Profilnummer '{0:s}', einer Länge von '{1:s}' und der Farbe '{2:s}' ist bereits vorhanden. " +
                                                                        "Soll das vorhandene Profil geändert werden?", profile.ProfileNumber, profile.Length, profile.Surface));
                        await yesNoDialog.ShowAsync();

                        if (yesNoDialog.Result == YesNoDialogType.Yes)
                        {
                            existingElement.Count  += profile.Count;
                            existingElement.Amount += profile.Amount;
                            await UpdateProfile(existingElement);
                        }

                        return;
                    }

                    if (PlantOrder != null)
                    {
                        profile.PlantOrderId = PlantOrder.Id;
                    }

                    if (FileEntry != null)
                    {
                        profile.Filename = FileEntry.Name;
                    }

                    var profileId = await Proxy.CreateProfile(profile);

                    if (profileId > 0)
                    {
                        profile.ProfileId = profileId;
                        var element = AutoMapperConfiguration.Map(profile);
                        ElementCollection.Add(element);
                    }
                    else
                    {
                        var errorDialog = new InfoDialog("Beim Anlegen des Profil's ist ein Fehler aufgetreten!", "Information", InfoDialogType.Error);
                        await errorDialog.ShowAsync();
                    }
                }
            }
        }
Exemple #6
0
        private async Task ElementAmountChanged(ElementModel element, double newAmount)
        {
            var result = await Proxy.UpdateProfileAmount(element.Id, newAmount);

            if (result > 0)
            {
                element.Amount = result;
                NotificationControl.Show($"Von '{element.Position}' sind nun '{result}' fertiggemeldet", 6000);
            }
            else
            {
                var dialog = new InfoDialog($"Der Vorgang konnte nicht ausgeführt werden.", "Information", InfoDialogType.Error);
                await dialog.ShowAsync();
            }
        }
Exemple #7
0
        public async Task ShowProjectDialog()
        {
            var dialog       = new ProjectDialog(DivisionCollection);
            var dialogResult = await dialog.ShowAsync();

            if (dialogResult == ContentDialogResult.Primary)
            {
                if (dialog.Result == null || dialog.Division == null)
                {
                    var infoDialog = new InfoDialog("Einige Daten wurden nicht gefunden!", "Fehler", Core.Enums.InfoDialogType.Error);
                    await infoDialog.ShowAsync();
                }
                //await GetElements();
                await GetElements(dialog.Result, dialog.Division);
            }
        }
Exemple #8
0
        private async void PdfViewerPreviewPage_ButtonOpenProjectClicked(ProjectPreviewPage projectPreviewPage, ProjectPreviewType projectPreviewType, FolderModel project)
        {
            var tabItem = FindTab(projectPreviewPage.Index);

            if (tabItem != null)
            {
                var name = GetProjectIdentifier(projectPreviewPage.SelectedPlantOrder, projectPreviewPage.SelectedFileEntry);
                if (name != null)
                {
                    UpdateTabViewItemHeader(tabItem, project, name);

                    var plantOrder = projectPreviewPage.SelectedPlantOrder;
                    var fileEntry  = projectPreviewPage.SelectedFileEntry;

                    if (fileEntry == null && plantOrder != null)
                    {
                        fileEntry = projectPreviewPage.FindFilename(plantOrder);
                    }

                    if (tabItem.Content is Frame frame && fileEntry != null)
                    {
                        ProjectViewSession session;
                        session = await ProjectViewSession.LoadAsync();

                        var summary = new ProjectSummary()
                        {
                            FileEntry          = fileEntry,
                            Folder             = project,
                            PlantOrder         = plantOrder,
                            ProjectPreviewType = projectPreviewType
                        };
                        if (session == null)
                        {
                            session = new ProjectViewSession();
                        }
                        await session.Add(summary);

                        frame.Navigate(typeof(ProjectContentPage), new object[] { projectPreviewType, project, fileEntry, plantOrder, false });
                    }
                    else
                    {
                        var dialog = new InfoDialog("Es wurde leider keine Datei gefunden", "Information", InfoDialogType.Error);
                        await dialog.ShowAsync();
                    }
                }
            }
Exemple #9
0
        private async void ButtonCreateFilter_Click(object sender, RoutedEventArgs e)
        {
            var filter = TextBoxFilter.Text;

            if (string.IsNullOrWhiteSpace(filter))
            {
                var infoDialog = new InfoDialog("Das Feld für den gesuchten Wert muss ausgefüllt sein!");
                await infoDialog.ShowAsync();

                return;
            }

            var yesNoDialog = new YesNoDialog("Filter speichern?", "Soll der Filter für dieses Projekt gespeichert werden?" + Environment.NewLine + Environment.NewLine +
                                              "[Ja]              Der Filter wird gespeichert, wird unter 'Bekannte Filter' hinzugefügt und ist für dieses Projekt jeder Zeit abrufbar" + Environment.NewLine + Environment.NewLine +
                                              "[Nein]          Der Filter wird unter 'Bekannte Filter' hinzugefügt, ist jedoch nach Beenden dieser Sitzung nicht mehr verfügbar" + Environment.NewLine +
                                              Environment.NewLine +
                                              "[Abbrechen] Der Filter wird nicht erstellt");
            await yesNoDialog.ShowAsync();

            if (yesNoDialog.Result != Dialogs.Core.Enums.YesNoDialogType.Abort && PlantOrder != null)
            {
                var selectedProperty = (ComboBoxFilterProperty.SelectedItem as ComboBoxItem).Tag.ToString();
                var selectedAction   = (ComboBoxFilterAction.SelectedItem as ComboBoxItem).Tag.ToString();

                var elementFilter = new ElementFilterModel()
                {
                    Action       = selectedAction,
                    PropertyName = selectedProperty,
                    Filter       = filter,
                    EmployeeId   = CurrentEmployee.EmployeeId,
                    PlantOrderId = PlantOrder.Id
                };

                FilterCollection.Add(elementFilter);
                TextBoxFilter.Text = string.Empty;
                FilterFlyout.Hide();
                Filter(selectedProperty, selectedAction, filter);
                FilterCollection.SelectedFilter = elementFilter;

                if (yesNoDialog.Result == Dialogs.Core.Enums.YesNoDialogType.Yes)
                {
                    elementFilter.FilterId = await Proxy.UpsertElementFilter(elementFilter);
                }
            }
        }
Exemple #10
0
        private async void ButtonChangePassword_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidatePassword())
            {
                return;
            }

            string         message;
            string         title;
            InfoDialogType dialogType = InfoDialogType.Info;

            if (Employee != null)
            {
                var password    = PasswordBoxPassword.Password;
                var newPassword = PasswordBoxNewPassword.Password;

                var result = await Proxy.ChangeEmployePassword(Employee.EmployeeId, password, newPassword);

                if (result)
                {
                    Proxy.UpdateEmployee(Employee);
                    message = "Dein Passwort wurde geändert";
                    title   = "Erfolg";
                }
                else
                {
                    message    = "Das eingegebende Passwort war falsch";
                    title      = "Fehler";
                    dialogType = InfoDialogType.Error;
                }
            }
            else
            {
                message    = "Ein Fehler ist aufgetreten";
                title      = "Fehler";
                dialogType = InfoDialogType.Error;
            }

            var dialog = new InfoDialog(message, title, dialogType);
            await dialog.ShowAsync();
        }
Exemple #11
0
        private async Task UpdateProfile(ElementModel element)
        {
            var dialog       = new ProfileDialog(element);
            var dialogResult = await dialog.ShowAsync();

            if (dialogResult == ContentDialogResult.Primary && dialog.Mode == ProfileDialogMode.Edit)
            {
                var profile = dialog.Result;
                var result  = await Proxy.UpdateProfileAsync(profile);

                if (result)
                {
                    UpdateElement(element, profile);
                }
                else
                {
                    var infoDialog = new InfoDialog("Das Profil konnte nicht geändert werden!");
                    await infoDialog.ShowAsync();
                }
            }
        }
Exemple #12
0
        private async void ButtonDelete_Click(object sender, RoutedEventArgs e)
        {
            if (sender is Button button && button.DataContext is ElementModel element)
            {
                var yesNoDialog = new YesNoDialog("Profil löschen?",
                                                  string.Format("Bist Du sicher, dass das Profil mit der Profilnummer '{0:s}' gelöscht werden soll?", element.Position));
                await yesNoDialog.ShowAsync();

                if (yesNoDialog.Result == YesNoDialogType.Yes)
                {
                    var result = await Proxy.DeleteProfileAsync(element.Id);

                    if (!result)
                    {
                        var dialog = new InfoDialog(string.Format("Das Profil mit der Profilnummer '{0:s}' konnte nicht gelöscht werden!", element.Position));
                        await dialog.ShowAsync();
                    }
                    else
                    {
                        ElementCollection.Remove(element);
                    }
                }
            }
        }
Exemple #13
0
        private async void Navigator_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
        {
            FrameNavigationOptions navOptions = new FrameNavigationOptions
            {
                TransitionInfoOverride = args.RecommendedNavigationTransitionInfo
            };

            var navigationTransitionInfo = new SlideNavigationTransitionInfo
            {
                Effect = SlideNavigationTransitionEffect.FromLeft
            };

            if (args.IsSettingsSelected)
            {
                NavigateToSettingsPage(LocalClient.Employee, navigationTransitionInfo);
                return;
            }

            if (args.SelectedItem is NavigationViewItem navigationViewItem && navigationViewItem.Tag is string tag)
            {
                if (_pages.TryGetValue(tag, out Type type))
                {
                    /*if (tag == "ProjectViewer" && CurrentTabView != null)
                     * {
                     *  parameter = CurrentTabView;
                     * }
                     *
                     * if (ContentFrame.Navigate(type, parameter, navigationTransitionInfo))
                     * {
                     *  CurrentPageKey = tag;
                     *
                     *  if (tag == "ProjectViewer" && CurrentTabView == null)
                     *  {
                     *      CurrentTabView = (ContentFrame.Content as ProjectViewerPage).TabViewCollection;
                     *  }
                     * }*/

                    if (tag == "ProjectViewer")
                    {
                        ContentFrame.Navigate(type, LocalClient.Employee, navigationTransitionInfo);
                    }
                    else if (tag == "Administration")
                    {
                        ContentFrame.Navigate(type, null, navigationTransitionInfo);
                    }
                    else if (tag == "Configuration")
                    {
                        ContentFrame.Navigate(type, null, navigationTransitionInfo);
                    }
                    else if (tag == "ElementView")
                    {
                        if (LocalClient.Employee == null)
                        {
                            var infoDialog = new InfoDialog("Du musst Dich anmelden, um Einsicht in den aktuellen Fertigungsstatus zu bekommen!");
                            await infoDialog.ShowAsync();

                            return;
                        }
                        ContentFrame.Navigate(type, LocalClient.Employee, navigationTransitionInfo);
                    }
                }
            }

            //ContentFrame.Navigate(typeof(AdministrationPage), null, navigationTransitionInfo);
        }
Exemple #14
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //if (PageLoaded)
            //return;

            if (FileEntry == null && PlantOrder == null)
            {
                var dialog = new MessageDialog("Da ist wohl etwas schief gelaufen");
                await dialog.ShowAsync();

                LoadingControl.IsLoading = false;
                return;
            }

            if (FileEntry == null && PlantOrder != null)
            {
                var infoDialog = new InfoDialog("Fehler beim Bestimmen der Datei oder des Werkauftrags!", "Information", InfoDialogType.Error);
                await infoDialog.ShowAsync();
            }

            RemoteRootPath = await Proxy.GetRemoteRootPath();

            if (string.IsNullOrEmpty(RemoteRootPath))
            {
                var infoDialog = new InfoDialog("Beim Abfragen des Stammverzeichnisses ist etwas schief gelaufen!", "Information", InfoDialogType.Error);
                await infoDialog.ShowAsync();
            }

            var plantOrderProcesses = await Proxy.GetPlantOrderProcesses(PlantOrder.Id);

            foreach (var plantOrderProcess in plantOrderProcesses)
            {
                ProcessQRImages.Add(new ProcessQRImageModel()
                {
                    ProcessName = plantOrderProcess.Process,
                    Source      = await QRCodeImageGenerator.Generate(plantOrderProcess.ProcessGuid.ToString())
                });
            }

            var materialRequirements = await Proxy.GetMaterialRequirements(new string[] { "1", "2" });

            if (materialRequirements != null)
            {
                MaterialRequirementsCollection.Load(materialRequirements);
                DataGridMaterialRequirements.ItemsSource = MaterialRequirementsCollection.GroupData().View;
            }

            /*var elements = await Proxy.GetElements();
             * if (elements != null)
             * {
             *  ElementCollection.Load(elements);
             * }*/

            /*var profiles = await Proxy.GetProfiles(PlantOrder.Id);
             * if (profiles != null)
             * {
             *  ElementCollection.Load(profiles);
             * }*/

            //ElementView.ItemsSource = ElementCollection.Elements;

            //PdfViewerFrame.Content = new PdfWebViewContentPage();

            if (!PageLoaded)
            {
                var fullFilePath = Path.Combine(RemoteRootPath, FileEntry.FilePath).Replace("/", @"\");

                var remoteFile = await StorageFile.GetFileFromPathAsync(fullFilePath);

                if (remoteFile != null)
                {
                    LocalFile = await CopyFileToDeviceAsync(remoteFile);

                    /*var pdfFile = new PdfFileModel()
                     * {
                     *  FullFilePath = LocalFile.Path,
                     *  IsFavorite = false,
                     *  LastTimeOpened = DateTime.Now
                     * };
                     * LoadPdfViewer(LocalFile, pdfFile);*/

                    //Uri url = PdfViewerControl.BuildLocalStreamUri("MyTag", "/Assets/PdfViewer/web/viewer.html");
                    //StreamUriWinRTResolver resolver = new StreamUriWinRTResolver();
                    //PdfViewerControl.NavigateToLocalStreamUri(url, resolver);
                    //
                    //PdfViewerControl.NavigateToLocalStreamUri(new Uri(LocalFile.Path), resolver);

                    //var url = new Uri(
                    //    string.Format("ms-appx-web:///Assets/PdfViewer/web/viewer.html?file={0}",
                    //    string.Format("ms-appx-web:///Assets/Content/{0}", WebUtility.UrlEncode("compressed.tracemonkey-pldi-09.pdf"))));
                    //
                    //PdfViewerControl.Source = url;
                    //var dialog = new MessageDialog(url.AbsoluteUri);
                    //await dialog.ShowAsync();
                    //PdfViewerControl.Source = new Uri("ms-appx-web:///Assets/PdfViewer/web/viewer.html");
                    //PdfViewerControl.NavigationCompleted += PdfViewerControl_NavigationCompleted;
                    PdfViewerControl.ScriptNotify += PdfViewerControl_ScriptNotify;
                }

                LoadingControl.IsLoading = false;
                PageLoaded = true;
            }
        }