コード例 #1
0
        public bool LckHostConnected()
        {
            // Check for WCF communication. if not present, notify user then close application
            try
            {
                // Case: try saved endpoint
                List <StoreWPF> check         = new List <StoreWPF>();
                string          savedEndpoint = Settings.EndpointAddress;
                if ((savedEndpoint != "") && (savedEndpoint != null))
                {
                    lck_Comm = new LCK_WCFcommunication(savedEndpoint);
                    check    = lck_Comm.GetAllStores();
                    if (check != null)
                    {
                        return(true);
                    }
                }
                // try multiple endpoints until one works
                // Case: localHost [endpoint_localhost]
                lck_Comm = new LCK_WCFcommunication(@"endpoint_localhost");
                check    = lck_Comm.GetAllStores();
                if (check != null)
                {
                    Settings.EndpointAddress = @"endpoint_localhost";
                    SaveSettings(settingsFilename);
                    return(true);
                }

                // Case: local IP
                lck_Comm = new LCK_WCFcommunication(@"endpoint_localIP");
                check    = lck_Comm.GetAllStores();
                if (check != null)
                {
                    Settings.EndpointAddress = @"endpoint_localIP";
                    SaveSettings(settingsFilename);
                    return(true);
                }

                // Case DDNS address
                lck_Comm = new LCK_WCFcommunication(@"endpoint_ddns");
                check    = lck_Comm.GetAllStores();
                if (check != null)
                {
                    Settings.EndpointAddress = @"endpoint_ddns";
                    SaveSettings(settingsFilename);
                    return(true);
                }

                return(false);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #2
0
 public NewOrdersManager(LCK_WCFcommunication lck_comm)
 {
     local_lckComm = lck_comm;
 }