示例#1
0
 public WBOReport(WorkBookBD bd)
 {
     this.bd = bd;
     bdFullFileName = bd.FileName;
     bdName = Path.GetFileNameWithoutExtension(bdFullFileName);
     bdDirectory = Path.GetDirectoryName(bdFullFileName);
 }
示例#2
0
 // add
 public WindowCopy(WorkBookBD xml)
 {
     InitializeComponent();
     init(xml);
     dateSelect.SelectedDate = new DateTime();
     typeBox.Focus();
 }
 public WindowTechbook(WorkBookBD xml)
 {
     InitializeComponent();
     initHotKeys();
     this.xml = xml;
     type = null;
     typeBox.Focus();
 }
示例#4
0
 // add with know type
 public WindowCopy(WorkBookBD xml, string type)
 {
     InitializeComponent();
     this.type = type;
     init(xml);
     confirmBox.IsChecked = true;
     typeBox.SelectedValue = type;
     typeBox.Focus();
 }
        public WindowPlaceRename(WorkBookBD xml)
        {
            InitializeComponent();
            initHotKeys();
            this.xml = xml;

            oldNameBox.ItemsSource = xml.getPlaceList();
            oldNameBox.SelectedIndex = 0;
        }
示例#6
0
 public WindowFind(WorkBookBD xml)
 {
     InitializeComponent();
     initHotKeys();
     this.Title = Properties.Resources.ProgrammName + " - Find";
     this.xml = xml;
     prevFindText = "";
     findBox.Focus();
 }
示例#7
0
        public MainWindow()
        {
            InitializeComponent();

            xml = new WorkBookBD();
            DateTime date = new DateTime();

            var infile = new StreamReader("techbookreplaced.txt");
            var line = infile.ReadLine(); // 0 type 1 name 2 number 3 place 4 note
            while (line != null)
            {
                var strs = line.Split('\t');
                xml.addType(strs[0], "");
                xml.addCopy(strs[0], strs[1], Convert.ToInt32((string)strs[2]), strs[3], strs[4], date);
                line = infile.ReadLine();
            }
        }
        public WindowTechbook(WorkBookBD xml, string type)
        {
            InitializeComponent();
            initHotKeys();
            this.xml = xml;
            this.type = type;

            WindowType.Title = "Edit Type - " + type;
            button.Content = "_Edit Type";

            XElement el = xml.getType(type);

            typeBox.Text = el.Element("Type").Value;
            codeBox.Text = el.Element("Code").Value;
            noteBox.Text = el.Element("Note").Value;

            typeBox.Focus();
        }
示例#9
0
        // edit constructor
        public WindowCopy(WorkBookBD xml, string type, int number)
        {
            InitializeComponent();
            init(xml);
            this.number = number;
            this.type = type;
            isEdit = true;

            windowCopy.Title = "Edit Copy";
            button.Content = "_Edit Copy";

            XElement el = xml.getCopy(number);

            typeBox.SelectedValue = type;
            typeBox.IsEnabled = false;
            noteTB.Text = el.Element("Note").Value;
            nameTB.Text = el.Element("Name").Value;
            numberTB.Text = el.Element("Number").Value;
            numberTB.IsEnabled = false;
            placeBox.SelectedValue = el.Element("Place").Value;
            // при редактирования дата по умолчанию не меняется, если убрать галочку, то дату сбросит
            dateSelect.SelectedDate = DateTime.Parse(el.Element("Date").Value);
            nameTB.Focus();
        }
示例#10
0
 public WBOStatistic(WorkBookBD bd)
 {
     this.xml = bd.getXMLBase();
     this.bd = bd;
 }
示例#11
0
        public WindowWBO()
        {
            InitializeComponent();
            initHotKeys();
            this.Title = Properties.Resources.ProgrammName + " v." + Properties.Resources.ProgrammVersion;

            allCopyMode = false;
            typeBox.Items.SortDescriptions.Add(new SortDescription("", ListSortDirection.Ascending));
            settings = new WBOSettings();
            // Загрузка размера и положения окна, если было открыто на весь экран, то координаты и размеры окна не устанавливаются
            if (!settings.MainWindowMaximized)
            {
                if (settings.MainWindowWidth != 0.0) this.Width = settings.MainWindowWidth;
                if (settings.MainWindowHeight != 0.0) this.Height = settings.MainWindowHeight;
                if (settings.MainWindowTop != 0.0) this.Top = settings.MainWindowTop;
                if (settings.MainWindowLeft != 0.0) this.Left = settings.MainWindowLeft;
            }
            else
            {
                this.WindowState = WindowState.Maximized;
            }

            if (settings.LastFile != "")
            {
                fileName = settings.LastFile;
                xml = new WorkBookBD(fileName, true);
                init();
                //--------------
                //MessageBoxResult mbRes = MessageBox.Show(fileName,
                //    "Load this?", MessageBoxButton.OKCancel);
                //if (mbRes == MessageBoxResult.OK)
                //{
                //    xml = new WorkBookBD(fileName, true);
                //    init();
                //}
                //------------------------
            }
        }
示例#12
0
        private void openBase()
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            //openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter = "xml files (*.xml)|*.xml";
            //openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;

            bool result = (bool)openFileDialog1.ShowDialog();

            if (result == true)
            {
                try
                {
                    if (openFileDialog1.OpenFile() != null)
                    {
                        string filename = openFileDialog1.FileName;
                        xml = new WorkBookBD(filename, true);
                        settings.LastFile = filename;
                        init();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                }
            }

            if (result == false && xml == null) this.Close();
        }
示例#13
0
        private void newBase()
        {
            // Configure save file dialog box
            SaveFileDialog dlg = new SaveFileDialog();
            dlg.FileName = "wbo_base"; // Default file name
            dlg.DefaultExt = ".xml"; // Default file extension
            dlg.Filter = "xml documents (.xml)|*.xml"; // Filter files by extension

            // Show save file dialog box
            Nullable<bool> result = dlg.ShowDialog();

            // Process save file dialog box results
            if (result == true)
            {
                // Save document
                string filename = dlg.FileName;
                xml = new WorkBookBD(filename, false);
                settings.LastFile = filename;
                init();
            }
        }
示例#14
0
        private void init(WorkBookBD xml)
        {
            initHotKeys();
            this.Title = Properties.Resources.ProgrammName + " - Copy";
            this.xml = xml;

            ArrayList typeList = xml.getTypeList();

            if (typeList == null)
            {
                MessageBox.Show("No Type in base", Properties.Resources.ProgrammName + " - Error");
                this.Close();
            }

            typeBox.ItemsSource = typeList;
            typeBox.SelectedIndex = 0;

            ArrayList placeList = xml.getPlaceList();

            placeBox.ItemsSource = placeList;
            placeBox.SelectedIndex = 0;

            int num = (xml.getFreeNumbers(1))[0];
            numberTB.Text = num.ToString();
        }
示例#15
0
 public WBOError(WorkBookBD bd)
 {
     this.bd = bd;
     ErrorList = new List<string>();
 }