void adapter_PersistenceDataUpdateEvent(IIntegrationAdapter adapter)
 {
     if (OperationalState != OperationalStateEnum.Unknown)
     {
         RaisePersistenceDataUpdatedEvent();
     }
 }
 private void toolStripButtonRemoveAdapter_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in listViewIntegrations.SelectedItems)
     {
         IIntegrationAdapter adapter = (IIntegrationAdapter)item.Tag;
         Operator.Adapters.Remove(adapter);
     }
 }
 private void toolStripButtonAdapterProperties_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in listViewIntegrations.SelectedItems)
     {
         IIntegrationAdapter adapter = (IIntegrationAdapter)item.Tag;
         PropertiesForm      form    = new PropertiesForm("Adapter Properties", adapter);
         form.ShowOkCancel = false;
         form.ShowDialog();
     }
 }
Example #4
0
 private void toolStripButtonRemoveAdapter_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in listViewIntegrations.SelectedItems)
     {
         IIntegrationAdapter adapter = (IIntegrationAdapter)item.Tag;
         if (WinFormsHelper.ShowMessageBox(string.Format("Remove adapter [{0}]?", adapter.Name), string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
         {
             Operator.Adapters.Remove(adapter);
         }
     }
 }
        public IIntegrationAdapter GetAdapter(string uniqueId, Version version)
        {
            string key = buildKey(uniqueId, version);

            if (!_adaptersMap.ContainsKey(key))
            {
                throw new Exception("Proxy con UniqueId " + uniqueId + " e Version " + version + " non trovato");
            }
            IntegrationAdapterInfo adapterInfo = _adaptersMap[key];
            IIntegrationAdapter    instance    = (IIntegrationAdapter)Activator.CreateInstance(adapterInfo.Type);

            return(instance);
        }
        void Adapters_ItemAddedEvent(GenericContainer <IIntegrationAdapter> keeper, IIntegrationAdapter adapter)
        {
            adapter.PersistenceDataUpdateEvent += new IntegrationAdapterUpdateDelegate(adapter_PersistenceDataUpdateEvent);
            if (Arbiter != null)
            {
                Arbiter.AddClient(adapter);
            }

            if (OperationalState != OperationalStateEnum.Unknown)
            {
                RaisePersistenceDataUpdatedEvent();
            }
        }
Example #7
0
        private IIntegrationAdapter GetAdapterFromSelect()
        {
            string[]            split   = this.ddl_Adapter.SelectedValue.Split(new string[] { "||||" }, StringSplitOptions.RemoveEmptyEntries);
            IIntegrationAdapter adapter = null;

            if (split.Length == 1)
            {
                adapter = IntegrationAdapterFactory.Instance.GetAdapter(split[0]);
            }
            else
            {
                adapter = IntegrationAdapterFactory.Instance.GetAdapter(split[0], new Version(split[1]));
            }
            return(adapter);
        }
        public IIntegrationAdapter GetAdapterConfigured(ConfigurationInfo configInfo)
        {
            IIntegrationAdapter adapter = null;

            if (configInfo.AdapterVersion != null)
            {
                adapter = this.GetAdapter(configInfo.AdapterUniqueId, configInfo.AdapterVersion);
            }
            else
            {
                adapter = this.GetAdapter(configInfo.AdapterUniqueId);
            }
            adapter.Init(configInfo);
            return(adapter);
        }
        static void Main(string[] args)
        {
            var assemblyPath = ConfigurationManager.AppSettings["AssemblyPath"];
            var clientName   = ConfigurationManager.AppSettings["ClientName"];

            IIntegrationAdapter integrationAdapter = IIntegrationAdapter.CreateInstance(assemblyPath, clientName);

            var student = new Student
            {
                FirstName = "Ramil",
                LastName  = "Aliyev",
                Phone     = "+994 94 994 94 94"
            };

            integrationAdapter.ProcessData(student);
        }
        private void toolStripButtonStopAdapter_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem item in listViewIntegrations.SelectedItems)
            {
                // Make sure to pass item as parameter, otherwise the value is in foreach and chages before the thread starts.
                GeneralHelper.FireAndForget(delegate(ListViewItem itemValue)
                {
                    IIntegrationAdapter adapter = (IIntegrationAdapter)itemValue.Tag;
                    System.Diagnostics.Trace.WriteLine(adapter.Name);
                    string operationResultMessage;
                    adapter.Stop(out operationResultMessage);

                    WinFormsHelper.BeginManagedInvoke(this, UpdateUI);
                }, item);
            }
        }
Example #11
0
 protected void ddl_Adapter_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.ddl_Adapter.SelectedValue))
     {
         this.dg_Config.Visible       = false;
         this.tr_AdapterDescr.Visible = false;
     }
     else
     {
         this.tr_AdapterDescr.Visible = true;
         IIntegrationAdapter adapter = GetAdapterFromSelect();
         this.ConfigurationInfo = adapter.ConfigurationInfo;
         this.AdapterInfo       = adapter.AdapterInfo;
         BindDgConfig();
     }
 }
Example #12
0
        private void LoadAdapterIcon()
        {
            string oggettoId            = Request["oggettoId"];
            string type                 = Request["type"];
            string adapterId            = Request["adapterId"];
            string adapterVersion       = Request["adapterVersion"];
            string position             = Request["position"];
            IIntegrationAdapter adapter = GetIntegrationAdapter(oggettoId, type, adapterId, adapterVersion, position);
            Bitmap image                = adapter.Icon;

            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            image.Save(stream, System.Drawing.Imaging.ImageFormat.Gif);
            stream.Position = 0;
            byte[] data = new byte[stream.Length];
            stream.Read(data, 0, (int)stream.Length);
            Response.ContentType = "image/gif";
            Response.BinaryWrite(data);
        }
Example #13
0
 protected void ddl_Adapter_SelectedIndexChanged(object sender, EventArgs e)
 {
     try {
         if (string.IsNullOrEmpty(this.ddl_Adapter.SelectedValue))
         {
             this.dg_Config.Visible       = false;
             this.tr_AdapterDescr.Visible = false;
         }
         else
         {
             this.tr_AdapterDescr.Visible = true;
             IIntegrationAdapter adapter = GetAdapterFromSelect();
             this.ConfigurationInfo = adapter.ConfigurationInfo;
             this.AdapterInfo       = adapter.AdapterInfo;
             BindDgConfig();
         }
     }
     catch (System.Exception ex)
     {
         UIManager.AdministrationManager.DiagnosticError(ex);
         return;
     }
 }
 void Adapters_ItemOperationalStatusChangedEvent(GenericContainer <IIntegrationAdapter> keeper, IIntegrationAdapter item)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
        void Adapters_ItemRemovedEvent(GenericContainer <IIntegrationAdapter> keeper, IIntegrationAdapter adapter)
        {
            string operationResultMessage;

            adapter.Stop(out operationResultMessage);
            if (Arbiter != null)
            {
                Arbiter.RemoveClient(adapter);
            }
            adapter.PersistenceDataUpdateEvent -= new IntegrationAdapterUpdateDelegate(adapter_PersistenceDataUpdateEvent);
            adapter.Dispose();

            if (OperationalState != OperationalStateEnum.Unknown)
            {
                RaisePersistenceDataUpdatedEvent();
            }
        }
 void adapter_PersistenceDataUpdateEvent(IIntegrationAdapter adapter)
 {
     if (OperationalState != OperationalStateEnum.Unknown)
     {
         RaisePersistenceDataUpdatedEvent();
     }
 }
        void SetItemAsAdapter(ListViewItem item, IIntegrationAdapter adapter)
        {
            item.Text = adapter.IsStarted.ToString();
            item.SubItems[1].Text = adapter.OperationalState.ToString();
            item.SubItems[2].Text = adapter.Name;

            if (adapter.IsStarted == false)
            {
                item.ForeColor = SystemColors.GrayText;
            }
            else
            {
                if (adapter.OperationalState == OperationalStateEnum.Initializing)
                {
                    item.ForeColor = Color.Blue;
                }
                else if (adapter.OperationalState != OperationalStateEnum.Operational)
                {
                    item.ForeColor = Color.Red;
                }
                else
                {
                    item.ForeColor = SystemColors.WindowText;
                }
            }

            item.Tag = adapter;
        }
        void Adapters_ItemRemovedEvent(GenericContainer<IIntegrationAdapter> keeper, IIntegrationAdapter adapter)
        {
            string operationResultMessage;
            adapter.Stop(out operationResultMessage);
            if (Arbiter != null)
            {
                Arbiter.RemoveClient(adapter);
            }
            adapter.PersistenceDataUpdateEvent -= new IntegrationAdapterUpdateDelegate(adapter_PersistenceDataUpdateEvent);
            adapter.Dispose();

            if (OperationalState != OperationalStateEnum.Unknown)
            {
                RaisePersistenceDataUpdatedEvent();
            }
        }
 void Adapters_ItemRemovedEvent(GenericContainer<IIntegrationAdapter> keeper, IIntegrationAdapter item)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
        void Adapters_ItemAddedEvent(GenericContainer<IIntegrationAdapter> keeper, IIntegrationAdapter adapter)
        {
            adapter.PersistenceDataUpdateEvent += new IntegrationAdapterUpdateDelegate(adapter_PersistenceDataUpdateEvent);
            if (Arbiter != null)
            {
                Arbiter.AddClient(adapter);
            }

            if (OperationalState != OperationalStateEnum.Unknown)
            {
                RaisePersistenceDataUpdatedEvent();
            }
        }