aboutsummaryrefslogtreecommitdiff
path: root/Source/Ribbon/RibbonController.cs
blob: c4ca6d77108919074d7e30f6516be73bb7dbafea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ExcelDna.Integration.CustomUI;
using RehauSku.Assist;

namespace Ribbon
{
    [ComVisible(true)]
    public class RibbonController : ExcelRibbon
    {
        public override string GetCustomUI(string RibbonID)
        {
            return @"
      <customUI xmlns='http://schemas.microsoft.com/office/2006/01/customui'>
      <ribbon>
        <tabs>
          <tab id='tab1' label='REHAU'>
            <group id='group1' label='Прайс-лист'>
              <button id='button1' label='Экспорт' onAction='OnButtonPressed'/>
            </group >
          </tab>
        </tabs>
      </ribbon>
    </customUI>";
        }

        public void OnButtonPressed(IRibbonControl control)
        {
            using (DataWriter dw = new DataWriter())
            {
                if (!dw.IsRangeValid())
                {
                    MessageBox.Show("Выделен неверный диапазон!", "Неверный диапазон", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                else
                {
                    dw.FillSkuAmountDict();
                    //dw.FillPriceList();
                }
            }
        }
    }
}