﻿// 
// Copyright (c) 2011-2015 Exxeleron GmbH
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// 

//
// Based on Excel-DNA by Govert van Drimmelen
// https://exceldna.codeplex.com/
//

#region

using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ExcelDna.Integration;
using ExcelDna.Integration.Extensibility;

#endregion

namespace qXL
{
    [ComVisible(true)]
    [Guid("9424FD1F-B97B-441D-B7BF-A69C3C3B7B5B")]
    [ProgId("qXL")]
// ReSharper disable InconsistentNaming
    public class qXLComAddIn : ExcelComAddIn
// ReSharper restore InconsistentNaming
    {
        public override void OnConnection(object application, ext_ConnectMode connectMode, object addInInst,
            ref Array custom)
        {
            try
            {
                dynamic addIn = addInInst;
                addIn.Object = new qXLShared();
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"Error: " + ex);
            }
        }
    }
}