Ejemplo n.º 1
0
        private void AddEquipmentGroupClick(object sender, RoutedEventArgs e)
        {
            var group = new EquipmentGroup();

            group.EquipmentGroupDelete += GroupDelete;

            if (wrap)
            {
                wrapGroupPanel.Children.Add(group);
            }
            else
            {
                noWrapGroupPanel.Children.Add(group);
            }
        }
Ejemplo n.º 2
0
        public EquipmentGroup(string groupName, StreamReader statusLines)
        {
            InitializeComponent();

            try
            {
                slideHeader.Content = techHeader.Content = adminHeader.Text = groupName;
                var groupOptions = statusLines.ReadLine().Split(',');
                wrap       = groupOptions[0].Contains("True");
                horizontal = groupOptions[1].Contains("True");
                PageGroup  = groupOptions[2].Contains("True");

                if (horizontal)
                {
                    wrapGroupPanel.Orientation = Orientation.Horizontal;
                }
                else
                {
                    wrapGroupPanel.Orientation = Orientation.Vertical;
                }


                string line;

                while (!(line = statusLines.ReadLine()).Equals("End Group"))
                {
                    if (line.StartsWith("Start Group:"))
                    {
                        var group = new EquipmentGroup(line.Remove(0, 13), statusLines);
                        group.EquipmentGroupDelete += GroupDelete;

                        if (wrap)
                        {
                            wrapGroupPanel.Children.Add(group);
                        }
                        else
                        {
                            noWrapGroupPanel.Children.Add(group);
                        }
                    }
                    else
                    {
                        var equipment = new Equipment(line.Remove(0, 17), statusLines);
                        equipment.EquipmentDelete += EquipmentDelete;

                        if (wrap)
                        {
                            wrapGroupPanel.Children.Add(equipment);
                        }
                        else
                        {
                            noWrapGroupPanel.Children.Add(equipment);
                        }
                    }
                }

                AppModeNotifications.Subscribe(this);
                SetMode(AppMode.Slide);
                SetTags();
            }catch (OutOfMemoryException e)
            {
                var error = "Error Importing Equipment Group:\nAn Out of Memory Exception occured\nSee dump file";

                ErrorLogger.ErrorDialog(error, ErrorType.Failure);
                ErrorLogger.LogError(error, e,
                                     Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                     Properties.Settings.Default.AppDataFolder +
                                     Properties.Settings.Default.ErrorLogFilename);
            }
            catch (IOException e)
            {
                var error = "Error Importing Equipment Group:\nAn IO Exception occured\nSee dump file";

                ErrorLogger.ErrorDialog(error, ErrorType.Failure);
                ErrorLogger.LogError(error, e,
                                     Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                     Properties.Settings.Default.AppDataFolder +
                                     Properties.Settings.Default.ErrorLogFilename);
            }
            catch (Exception e)
            {
                var error = "Error Importing Equipment Group:\nAn Unknown Exception occured\nSee dump file";

                ErrorLogger.ErrorDialog(error, ErrorType.Failure);
                ErrorLogger.LogError(error, e,
                                     Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                     Properties.Settings.Default.AppDataFolder +
                                     Properties.Settings.Default.ErrorLogFilename);
            }
        }