Пример #1
0
        private static void Connect_Minolta_0()
        {
            m_ICa200 = new Ca200();

            if (m_ICa200 == null)
            {
                MessageBox.Show("Не установлен драйвер для Minolta CA-210.\nБаланс белого не будет доступен.",
                                "Driver Minolta CA210 not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                isConnectedMinolta = false;
                return;
            }
            //write_info("Подключение к Minolta. Ожидайте...");
            try
            {
                m_ICa200.AutoConnect();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка! Не удалось подключиться к Минолте по USB.\nПроверьте USB соединение с Минолтой.\n\n\n\n\n\n" + ex,
                                "Не удается подключить к Минолте по USB", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //this.buttonConnectUSB.Enabled = true;
                isConnectedMinolta = false;
                return;
            }
            Thread.Sleep(50);
            isConnectedMinolta = true;
            m_ICas             = (ICas)m_ICa200.Cas;
            m_ICa     = (ICa)m_ICas.get_ItemOfNumber(1);
            m_IProbe  = (IProbe)m_ICa.SingleProbe;
            m_IMemory = (IMemory)m_ICa.Memory;
            Thread.Sleep(50);
            loopInit_CA210();
            //write_info("Подключение Minolta завершенно.");
        }
 private SystemsRelationships(string npps, string systems, ICa eca)
 {
     this.eca     = eca;
     this.npps    = npps;
     this.systems = systems;
     this.GenerateItems();
 }
Пример #3
0
 public CreateFromEnoviaCorrectionActionBehavior(UpdateContext client, ICa enoviaCorrectionAction)
 {
     behavior = new CreateFromEcaItemsBehavior(client, new List <ICa>()
     {
         enoviaCorrectionAction
     });
 }
Пример #4
0
 private static void Connect_Minolta_0()
 {
     if (PublicData.m_ICa200 == null)
     {
         MessageBox.Show("Не установлен драйвер для Minolta CA-210.\nБаланс белого не будет доступен.",
                         "Driver Minolta CA210 not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
         isConnectedMinolta = false;
         return;
     }
     PublicData.write_info("Подключение к Minolta. Ожидайте...");
     try
     {
         m_ICa200.AutoConnect();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error! Check USB connection please.\n" + ex.Info(),
                         "Can't connect USB CA210", MessageBoxButtons.OK, MessageBoxIcon.Error);
         //this.buttonConnectUSB.Enabled = true;
         isConnectedMinolta = false;
         return;
     }
     Thread.Sleep(50);
     uPowerStatus       = true;
     isConnectedMinolta = true;
     m_ICas             = (ICas)m_ICa200.Cas;
     m_ICa     = (ICa)m_ICas.get_ItemOfNumber(1);
     m_IProbe  = (IProbe)m_ICa.SingleProbe;
     m_IMemory = (IMemory)m_ICa.Memory;
     Thread.Sleep(50);
     loopInit_CA210();
     PublicData.write_info("Подключение Minolta завершенно.");
 }
Пример #5
0
        //var attrName = "A_Obj_Ref_Tbl";
        //var table = tdmsObject.Attributes.FirstOrDefault(a => a.AttributeDefName.Equals(attrName));
        //table.Rows.RemoveAll();
        //var nppsGuids = tdmsCorrectionAction.Npps.ToList();
        //foreach (var nppGuid in nppsGuids) {
        //    var nppFromTdms = app.GetObjectByGUID(nppGuid);
        //    if (nppFromTdms == null) continue;

        //    var nppCode = nppFromTdms.Attributes["A_Object_Code"];
        //    var nppDescription = nppFromTdms.Attributes["A_Desc_ObjPJ"];

        //    var newRow = table.Rows.Create();
        //    newRow.Attributes["A_Object_Code"].Value = nppCode;
        //    newRow.Attributes["A_Desc_ObjPJ"].Value = nppDescription;
        //    newRow.Attributes["A_Object_Ref"].Value = nppFromTdms;
        //}
        //}
        private void FillTableWithAllNpps(TDMSAttribute table, ICa tca)
        {
            if (table == null)
            {
                return;
            }
            var npps = app.GetObjectsByGUIDs(tca.Npps.ToList());

            table.Rows.RemoveAll();
            AddRows(table, npps);
        }
        internal IdMapItemFamily(ICa restoredTdmsCorrectionAction, ICa tdmsCorrectionAction)
        {
            this.oldItem   = restoredTdmsCorrectionAction;
            this.youthItem = tdmsCorrectionAction;

            oldSystems       = oldItem.Systems.ToList();
            youthSystems     = youthItem.Systems.ToList();
            intersectSystems = oldSystems.Intersect(youthSystems).ToList();

            lengthOldSystems       = oldSystems.Count;
            lengthYouthSystems     = youthSystems.Count;
            lengthIntersectSystems = intersectSystems.Count;
        }
Пример #7
0
        public static void Disconnect_CA210()
        {
            try
            {
                m_ICa.RemoteMode = 0;

                m_ICa    = null;
                m_ICa200 = null;
                m_IProbe = null;
                m_ICas   = null;
                m_IProbe = null;
            }
            catch { }
        }
 public Ca(ICa correctionAction)
 {
     this.Buildings       = correctionAction.Buildings;
     this.Description     = correctionAction.Description;
     this.Export          = correctionAction.Export;
     this.Id              = correctionAction.Id;
     this.LongDescription = correctionAction.LongDescription;
     this.Modified        = correctionAction.Modified;
     this.Name            = correctionAction.Name;
     this.Npps            = correctionAction.Npps;
     this.RelationShip3   = correctionAction.RelationShip3;
     this.Systems         = correctionAction.Systems;
     this.Type            = correctionAction.Type;
     this.HasFiles        = correctionAction.HasFiles;
     this.SentToTdms      = correctionAction.SentToTdms;
 }
Пример #9
0
        private void FillTableWithKudanKulamNpps(TDMSAttribute table, ICa tca)
        {
            if (table == null)
            {
                return;
            }
            var kudanKulamGuids    = new KudanKulamNppMaps().Select(nppMap => nppMap.Guid);
            var containsKudanKulam = tca.Npps.ToList().Intersect(kudanKulamGuids);

            if (!containsKudanKulam.Any())
            {
                return;
            }
            var npps = app.GetObjectsByGUIDs(kudanKulamGuids.ToList());

            table.Rows.RemoveAll();
            AddRows(table, npps);
        }
        private void ProcessItem(ICa eca)
        {
            var tdmsObjects    = GetTdmsObjects(eca.Id).ToList();
            var noObjectsFound = (tdmsObjects.Count == 0);

            if (noObjectsFound)
            {
                CreateTdmsObject(eca);
                return;
            }
            var oldItems          = tdmsObjects.Select(t => t.ToRestoredTdmsCorrectionAction()).ToList();
            var noObjectsRestored = (oldItems.Count == 0);

            if (noObjectsRestored)
            {
                CreateTdmsObject(eca);
                return;
            }

            var youthItems = new KudanTcaClient(new TcaClient(new McaClient(new List <ICa>()
            {
                eca
            }))).CreateItems();

            var pairs = new IntersectIdMapItemsFamily(oldItems, youthItems).CreateItems();

            var theVersion = this.GetMaxVersion(tdmsObjects) + 1;

            var itemsToUpdate = pairs.Select(p => p.youthItem);
            var itemsNew      = youthItems.Except(itemsToUpdate, new CaIdAndSystemsEqualityComparer());

            new CreateFromTcaItemsBehavior(client, itemsNew).ProcessItems();

            foreach (var pair in pairs)
            {
                var behavior = new UpdateItemsFromTdmsCorrectionActionsBehavior(client, new List <ICa>()
                {
                    pair.youthItem
                }, ((RestoredTdmsCorrectionAction)pair.oldItem).tdmsObject, theVersion);
                behavior.ProcessItems();
            }
        }
Пример #11
0
        public void InitializeCaFields(TDMSObject tdmsObject, ICa tca)
        {
            var attributes = tdmsObject.Attributes;

            // wtf ????????????
            //if (!string.IsNullOrEmpty(tca.Description)) {
            //    descriptionValue = tca.Description;
            //} else {
            //    if (!string.IsNullOrEmpty(tca.LongDescription)) {
            //        if (tca.LongDescription.Length < 128) {
            //            descriptionValue = tca.LongDescription;
            //        } else {
            //            descriptionValue = tca.LongDescription.Substring(0, 127);
            //        }
            //    } else {
            //        descriptionValue = string.Empty;
            //    }
            //}

            InitializeAttribute(attributes,
                                "A_Name",
                                (string.IsNullOrEmpty(tca.Description)) ? tca.LongDescription.Trim(127) : tca.Description
                                );
            InitializeAttribute(attributes, "A_JSON", tca.LongDescription);
            InitializeAttribute(attributes, "A_System_Code", tca.Systems);
            InitializeAttribute(attributes, "A_Building_Code", tca.Buildings);
            InitializeAttribute(attributes, "A_ObjectGUID", tca.Id);

            InitializeDateAttributeBycicleSilent(attributes, "A_Date", tca.Modified);
            InitializeDateAttributeSilent(attributes, "A_Date1", tca.Export);

            FillTableWithKudanKulamNpps(
                tdmsObject.Attributes.FirstOrDefault(a => a.AttributeDefName.Equals("A_Obj_Ref_Tbl")),
                tca
                );
        }
 public CheckOutFileRequestFactory(ICa eca)
 {
     Eca = eca;
 }
 public McaFactory(ICa eca, SystemsRelationship systemsRelationship)
 {
     this.eca = eca;
     this.systemsRelationship = systemsRelationship;
 }
        public static string Print(ICa searchRootObject)
        {
            var result = $"Id: {searchRootObject.Id}\nАЭС: {searchRootObject.Npps}\nСистемы: {searchRootObject.Systems}\nЗдания: {searchRootObject.Buildings}";

            return(result);
        }
 /// <summary>
 ///  Initializes a new instance of the <see cref="CaController" /> class.
 /// </summary>
 /// <param name="hremployee"></param>
 public CaController(ICa ca)
 {
     _ca = ca;
 }
 public SystemsRelationships(ICa eca) : this(eca.Npps, eca.Systems, eca)
 {
 }
 public TcaFactory(ICa cA) : this(cA, new NppMaps())
 {
 }
Пример #18
0
 public void InitializeCaFields(TDMSObject tdmsObject, ICa tdmsCorrectionAction, DateTime exportDateTime)
 {
     this.InitializeCaFields(tdmsObject, tdmsCorrectionAction);
     InitializeAttribute(tdmsObject.Attributes, "A_Date1", exportDateTime.ToString());
 }
Пример #19
0
 public void InitializeCaFields(TDMSObject tdmsObject, int versionName, ICa tdmsCorrectionAction)
 {
     InitializeCaFields(tdmsObject, tdmsCorrectionAction);
     tdmsObject.VersionName = versionName.ToString();
 }
 private void CreateTdmsObject(ICa enoviaCorrectionAction)
 {
     new CreateFromEnoviaCorrectionActionBehavior(this.client, enoviaCorrectionAction).ProcessItems();
 }
Пример #21
0
 public SystemsRelationship(string systems, string npps, ICa eca)
 {
     this.Systems = systems;
     this.Npps    = npps;
     this.Eca     = eca;
 }
 public TcaFactory(ICa correctionAction,
                   NppMaps NppMaps)
 {
     this.cA      = correctionAction;
     this.NppMaps = NppMaps;
 }