Esempio n. 1
0
        private void AddManhoursMain(Manhours manhours)
        {
            var dpMain = new DockPanelMain(manhours);

            dpMain.PlusBtn_Main.Click   += PlusBtn_Click;
            dpMain.MinusBtn_Main.Click  += MinusBtn_Click;
            dpMain.PercentBox.LostFocus += PercentBox_LostFocus;
            dpMain.PercentBox.AddHandler(Validation.ErrorEvent, new EventHandler <ValidationErrorEventArgs>(PercentBox_Error));

            var stackPanel = new StackPanel();

            RootStackPanel.Children.Add(stackPanel);
            stackPanel.Children.Add(dpMain);

            manhours.Contents.ForEach(content => AddManhoursContent(manhours, stackPanel));
        }
Esempio n. 2
0
        private void PlusBtn_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            if (button.Name.Contains("Main"))
            {
                var mh = new Manhours(initName, 0, initContent);
                manhoursList.Add(mh);
                AddManhoursMain(mh);
            }
            else if (button.Name.Contains("Content"))
            {
                var stackPanel = ((button.Parent as DockPanel).Parent as DockPanelContent).Parent as StackPanel;
                var index      = RootStackPanel.Children.IndexOf(stackPanel);
                manhoursList[index].Contents.Add(initContent);
                AddManhoursContent(manhoursList[index], stackPanel);
            }
        }
Esempio n. 3
0
        private void AddManhoursContent(Manhours manhours, StackPanel stackPanel)
        {
            var dpContent = new DockPanelContent();

            stackPanel.Children.Add(dpContent);
            var index = stackPanel.Children.IndexOf(dpContent);

            dpContent.PlusBtn_Content.Click  += PlusBtn_Click;
            dpContent.MinusBtn_Content.Click += MinusBtn_Click;
            dpContent.UpBtn_Content.Click    += UpDownBtn_Click;
            dpContent.DownBtn_Content.Click  += UpDownBtn_Click;
            dpContent.ContentBox.SetBinding(TextBox.TextProperty,
                                            new Binding($"[{index - 1}]")
            {
                Source = manhours,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            });
        }
Esempio n. 4
0
        private void SetManhoursList()
        {
            if (!Directory.Exists(dicPath))
            {
                Directory.CreateDirectory(dicPath);
            }

            if (File.Exists(filePath))
            {
                var doDeserialize = MessageBox.Show("前回の工数コメントを復元しますか", "Select", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (doDeserialize == MessageBoxResult.Yes)
                {
                    DeserializeManhoursList();
                    return;
                }
            }

            MessageBox.Show("工数コメントを新規作成します", "New Create", MessageBoxButton.OK, MessageBoxImage.Information);
            manhoursList = new List <Manhours>();
            var mh = new Manhours(initName, 100, initContent);

            manhoursList.Add(mh);
            AddManhoursMain(mh);
        }
Esempio n. 5
0
        public DockPanelMain(Manhours manhours)
        {
            InitializeComponent();

            this.DataContext = manhours;
        }