コード例 #1
0
        public static IGraphType CreateGraphType(IConnectionType connectionType)
        {
            var graphType = Substitute.For <IGraphType>();

            graphType.FindConnectionType(Arg.Any <Type>(), Arg.Any <Type>()).ReturnsForAnyArgs(connectionType);
            return(graphType);
        }
コード例 #2
0
 // The constructor creates a Connection from the source to the destination
 public Connection(IConnectable source, string sourceOutput, IConnectable destination, string destinationInput, Color typeColor)
 {
     Source           = source;
     SourceOutput     = sourceOutput;
     Destination      = destination;
     DestinationInput = destinationInput;
     ConnectionType   = ConnectionTypeFactory.GetType(typeColor);
 }
コード例 #3
0
        public static void RegisterType(Color color, IConnectionType type)
        {
            if (m_types.ContainsKey(color))
            {
                throw new TypeAlreadyRegisteredException(color, m_types[color], type);
            }

            m_types.Add(color, type);
        }
コード例 #4
0
        public static Color GetColor(IConnectionType type)
        {
            var color = m_types.FirstOrDefault(kvp => kvp.Value == type).Key;

            if (color == default(Color))
            {
                throw new NoSuchTypeException(type);
            }

            return(color);
        }
コード例 #5
0
ファイル: QueryAsync.cs プロジェクト: maniepiedi/KSociety.Com
 public QueryAsync
 (
     ILoggerFactory loggerFactory,
     IConnectionType s7ConnectionTypeRepository,
     ICpuType s7CpuTypeRepository,
     IArea s7AreaRepository,
     IWordLen s7WordLenRepository,
     IConnection s7ConnectionRepository
 )
 {
     _logger = loggerFactory.CreateLogger <QueryAsync>();
     _s7ConnectionTypeRepository = s7ConnectionTypeRepository;
     _s7CpuTypeRepository        = s7CpuTypeRepository;
     _s7AreaRepository           = s7AreaRepository;
     _s7WordLenRepository        = s7WordLenRepository;
     _s7ConnectionRepository     = s7ConnectionRepository;
 }
コード例 #6
0
        /// <summary>
        /// Prüft anhand der XML - Datei, ob eine neue Version verfügbar ist
        /// </summary>
        /// <param name="xmlLink"></param> URL or path of the xml file that contains information about latest version of the application.
        public static async void Start(string xmlLink)
        {
            try
            {
                XmlLink = new Uri(xmlLink);
                UpdateInfoEventArgs updateInfo = null;
                if (XmlLink.Scheme.Equals(Uri.UriSchemeHttp) || XmlLink.Scheme.Equals(Uri.UriSchemeHttps))
                {
                    connectionType = new ConnectionTypeWeb();
                }
                else if (XmlLink.Scheme.Equals(Uri.UriSchemeFile))
                {
                    connectionType = new ConnectionTypeFile();
                }

                updateInfo = await connectionType.ReadXmlFileAsync(XmlLink);

                bool IsUpdateAvailable = CheckForUpdate(updateInfo);

                // TODO: Wollen Sie das Update durchführen?

                Uri downloadLink = new Uri(updateInfo.DownloadURL);
                if (downloadLink.Scheme.Equals(Uri.UriSchemeHttp) || downloadLink.Scheme.Equals(Uri.UriSchemeHttps))
                {
                    connectionType = new ConnectionTypeWeb();
                }
                else if (downloadLink.Scheme.Equals(Uri.UriSchemeFile))
                {
                    connectionType = new ConnectionTypeFile();
                }

                connectionType.DownloadProgressChanged += DownloadUpdateProgressChanged;

                await connectionType.StartDownloadAsync(updateInfo.DownloadURL, Path.GetFullPath(updateInfo.DownloadFileName));

                Console.WriteLine($"***** {updateInfo.DownloadURL} *****");
            }
            catch (Exception exception)
            {
                ShowError(exception);
            }
        }
コード例 #7
0
 public IConnection Connect(IConnectable destination, string outputName, string inputName, IConnectionType type)
 {
     return(Connect(destination, outputName, inputName, ConnectionTypeFactory.GetColor(type)));
 }
コード例 #8
0
 public IConnection Connect(IConnectable destination, string outputName, string inputName, IConnectionType type)
 {
     return(NullConnection.Instance);
 }
コード例 #9
0
 public TypeAlreadyRegisteredException(Color color, IConnectionType existingType, IConnectionType newType)
     : base(string.Format("Color \"{0}\" has already been registered by type \"{1} ({2})\" and cannot be registered by type \"{3} ({4})\"", color.ToString(), (existingType as IJavaType).Name, (existingType as ICPPType).Name, (newType as IJavaType).Name, (newType as ICPPType).Name))
 {
 }
コード例 #10
0
 public NoSuchTypeException(IConnectionType type)
     : base(string.Format("No color is associated to connection type \"{0} ({1})\"", (type as IJavaType).Name, (type as ICPPType).Name))
 {
 }