Exemplo n.º 1
0
        private static void SetupUI()
        {
            display        = new Display();
            display.Ready += Display_Ready;

            // Simple Dispatcher and SynchronizationContext do the same job as in a typical GUI:
            // - SynchronizationContext Keeps async code continuations running on the main (UI) thread
            // - Dispatcher allows other threads to invoke Actions on the main (UI) thread
            SynchronizationContext.SetSynchronizationContext(new ConsoleSynchronizationContext(display));
            Dispatcher.Init(display);

            mainDisplayToggler = new AreaToggler();

            scriptDisplay = new ScriptDisplay(display, debugger, new Bounds(0, 0, Length.Percent(60), -2));
            infoDisplay   = new InfoDisplay(display, new Bounds(Length.Percent(60), 0, Length.Percent(40), -2));
            helpDisplay   = new HelpDisplay(display, new Bounds(0, 0, Length.Percent(100), -2));
            prompt        = new Prompt(display, new Bounds(0, -2, Length.Percent(100), 1));
            errorDisplay  = new ErrorDisplay(display, new Bounds(0, -1, Length.Percent(100), 1));

            mainDisplayToggler
            .Add(scriptDisplay)
            .Add(helpDisplay);

            display.Add(scriptDisplay);
            display.Add(helpDisplay);
            display.Add(infoDisplay);
            display.Add(prompt);
            display.Add(errorDisplay);
        }
        public async Task ConnectToRemoteUser(string remoteIpAddress, int remotePortNumber)
        {
            Console.WriteLine("STATUS: Connecting to remote user");
            State  = ConnectionState.Connecting;
            Sender = await NetworkService.ConnectToRemoteAsync(Sender, remoteIpAddress, remotePortNumber);

            if (Sender != null)
            {
                Console.WriteLine($"RESULT: Connection to {((IPEndPoint)Sender.RemoteEndPoint).Address} established");
            }
            else
            {
                Console.WriteLine("RESULT: Connection to remote failed");
                Sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                State  = ConnectionState.Listening;
                InfoDisplay.Show("Could not connect to user");
                return;
            }

            Console.WriteLine("STATUS: Sending request data to remote user");
            NetworkData request = new NetworkData(LocalUser, NetworkDataType.Request);
            bool        sent    = await NetworkService.SendDataAsync(Sender, request);

            if (sent)
            {
                Console.WriteLine("RESULT: Sending of request data successful");
            }
            else
            {
                Console.WriteLine("RESULT: Sending of request data failed");
                Sender.Shutdown(SocketShutdown.Both);
                InfoDisplay.Show("Could not send request to user");
                State = ConnectionState.Listening;
            }
        }
Exemplo n.º 3
0
        private InfoDisplay imageManagement(InfoDisplay newImage = null, string fileType = null)
        {
            switch (fileType.ToUpper())
            {
            case "HEADER":
                if (newImage != null)
                {
                    HeaderImageDisplay = newImage;
                }
                return(HeaderImageDisplay);

            case "LOGO":
                if (newImage != null)
                {
                    LogoImageDisplay = newImage;
                }

                return(LogoImageDisplay);

            case "BILL":
                if (newImage != null)
                {
                    BillImageDisplay = newImage;
                }

                return(BillImageDisplay);
            }

            return(new InfoDisplay());
        }
 public DecoratedInfo(InfoDisplay song, System.Windows.Controls.Label curLabel, string curTitle, string curSongPath, string curImagePath) : base(song)
 {
     label     = curLabel;
     songTitle = curTitle;
     songPath  = curSongPath;
     imagePath = curImagePath;
 }
        private void ProcessResponse(NetworkData networkData)
        {
            Console.WriteLine("STATUS: Processing response");
            Console.WriteLine($"RESULT: Received a response of type {networkData.ResponseType}");

            switch (networkData.ResponseType)
            {
            case ResponseType.Exit:
                ConnectionState tempState = State;
                State = ConnectionState.Listening;
                if (tempState == ConnectionState.Chatting)
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        ExitChat();
                    });
                    InfoDisplay.Show($"{RemoteUser.UserName} left the chat");
                }
                else
                {
                    InfoDisplay.Show($"{RemoteUser.UserName} canceled their chat request");
                }
                break;

            case ResponseType.Accept:
                State = ConnectionState.Chatting;
                InfoDisplay.Show($"{RemoteUser.UserName} accepted your chat request");
                break;

            case ResponseType.Decline:
                State = ConnectionState.Listening;
                InfoDisplay.Show($"{RemoteUser.UserName} declined your chat request");
                break;

            case ResponseType.Buzz:
                if (State == ConnectionState.Chatting)
                {
                    System.Media.SystemSounds.Beep.Play();
                }
                break;

            case ResponseType.Disconnect:
                ConnectionState prevState = State;
                State = ConnectionState.Listening;
                if (prevState == ConnectionState.Chatting)
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        ExitChat();
                    });
                }
                InfoDisplay.Show($"{RemoteUser.UserName} disconnected from application");
                break;

            case ResponseType.None:
                Console.WriteLine("ERROR: Network data is not a response");
                break;
            }
        }
Exemplo n.º 6
0
    void Start()
    {
        instance        = this;
        valuesToDisplay = new List <valueSprite> ();
        valuesToDisplay.Clear();

        StartCoroutine(cyclicIconCollector());
    }
Exemplo n.º 7
0
 void Start()
 {
     if ( obj == null )
         obj = GameObject.Find( "UIDisplay" ).GetComponent<InfoDisplay>();
     SpawnObject = GetComponentInChildren<CountDisplay>();
     MiniGames = GetComponentsInChildren<MiniGameActive>();
     TimeSoFar = 0.0;
 }
Exemplo n.º 8
0
 public InfoDisplay loadImage(InfoDisplay image)
 {
     image.InfoDataList = Bl.BlReferential.searchInfo(new QOBDCommon.Entities.Info {
         Name = image.TxtFileNameWithoutExtension
     }, ESearchOption.AND);
     image.downloadFile();
     return(image);
 }
 /// <summary>
 /// Instantiates the info displays.
 /// And set them to disabled at start
 /// </summary>
 private void CreateInfoDisplay()
 {
     if (this.infoDisplay == null)
     {
         return;
     }
     this.infoDisplayInstance = Instantiate(infoDisplay);
     this.infoDisplayInstance.gameObject.SetActive(false);
 }
Exemplo n.º 10
0
 void Awake()
 {
     if (id == null)
     {
         DontDestroyOnLoad(gameObject);
         id = this;
     }
     else if (id != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 11
0
    public void EnemyDisplay()
    {
        towersButton.GetComponent <Image>().sprite  = unSelectedSprite;
        enemiesButton.GetComponent <Image>().sprite = selectedSprite;
        displayMode = InfoDisplay.Enemy;

        enemyFullDisplay.SetActive(true);
        monsterFullDisplay.SetActive(false);


        StartCoroutine(ShowEnemies());
    }
Exemplo n.º 12
0
 public static InfoDisplay downloadPicture(this InfoDisplay image, string ftpDirectory, string localDirectory, string recordedFileName, string fileName, List <Info> ftpCredentialInfoList)
 {
     if (ftpCredentialInfoList.Count > 0)
     {
         image = image.getPicture(ftpDirectory, localDirectory, recordedFileName, fileName, ftpCredentialInfoList);
         if (image != null)
         {
             image.downloadFile();
         }
     }
     return(image);
 }
Exemplo n.º 13
0
        /// <summary>
        /// downloading picture from the ftp server
        /// </summary>
        /// <param name="image">Image to update</param>
        /// <param name="recordedFileName">The image file name already in the database</param>
        /// <param name="fileName">The new image file name in case of absence of a record</param>
        /// <param name="ftpCredentialInfoList">The ftp credential information list</param>
        /// <returns>Image</returns>
        public static InfoDisplay getPicture(this InfoDisplay image, string ftpDirectory, string localDirectory, string recordedFileName, string fileName, List <Info> ftpCredentialInfoList)
        {
            object _lock = new object();

            lock (_lock)
            {
                Info usernameInfo = ftpCredentialInfoList.Where(x => x.Name == "ftp_login").FirstOrDefault() ?? new Info();
                Info passwordInfo = ftpCredentialInfoList.Where(x => x.Name == "ftp_password").FirstOrDefault() ?? new Info();

                if (ftpCredentialInfoList.Count > 0)
                {
                    Info info = new Info {
                        Name = fileName, Value = fileName
                    };

                    // closing item picture file before update
                    if (image != null)
                    {
                        image.closeImageSource();
                    }
                    else
                    {
                        // image must be created on the IU Thread
                        if (Application.Current != null)
                        {
                            Application.Current.Dispatcher.Invoke(() =>
                            {
                                image = new InfoDisplay(ftpDirectory, localDirectory, usernameInfo.Value, passwordInfo.Value);
                            });
                        }
                    }

                    if (!string.IsNullOrEmpty(recordedFileName) && recordedFileName.Split('.').Count() > 1 && !string.IsNullOrEmpty(recordedFileName.Split('.')[0]))
                    {
                        info.Name  = recordedFileName.Split('.')[0].Replace(' ', '_').Replace(':', '_');
                        info.Value = recordedFileName;
                    }

                    if (image != null)
                    {
                        image.TxtFileNameWithoutExtension = info.Name;
                        image.FilterList = new List <string> {
                            info.Name
                        };
                        image.updateFields(new List <Info> {
                            info
                        });
                    }
                }
                return(image);
            }
        }
Exemplo n.º 14
0
    private void Awake()
    {
        if (Instance != null)
        {
            Debug.LogError("InfoDisplay instance already set!", Instance);
            return;
        }
        Instance  = this;
        textField = GetComponentInChildren <TextMeshProUGUI>();

        toolManager = FindObjectOfType <ToolManager>();

        ClearText();
    }
Exemplo n.º 15
0
        private void createFamily_Click(object sender, EventArgs e)
        {
            InfoDisplay.Clear();
            gezin.Clear();
            string ouder2;
            string ouder1   = parentFirstName.Text + " " + parentLastName.Text;
            bool   isSingle = singleParent.Checked;

            if (isSingle == false)
            {
                ouder2           = secondParentFirstName.Text + " " + secondParentLastName.Text;
                InfoDisplay.Text = ($"ouders:\n{ouder1} en {ouder2}\n\nKinderen:\n");
            }
            else
            {
                InfoDisplay.Text = ($"ouder:\n{ouder1}\n\nKinderen:\n");
            }
        }
    public void ShowInfoDisplay(Icon forSubject)
    {
        CloseToolTip();

        infoDisplayInstance = Instantiate(infoDisplay);

        if (infoDisplayInstance != null)
        {
            audioManager.PlayClip(currentMarker);
            DisableIcons();
            DisablePapers();
            infoDisplayInstance.transform.position = new Vector3(camera.transform.position.x - 2, 2, camera.transform.position.z);
            infoDisplayInstance.Set(forSubject);
        }
        else
        {
            print("Error: Info Display Not Initialized");
        }
    }
Exemplo n.º 17
0
        void Initdata()
        {
            Songlist = App.SearchDataToShow.SearchResult;
            Dictionary <string, string> infoToShow = App.SearchDataToShow.infomation;

            switch (infoToShow["infotype"])
            {
            case "1":        //singer
                if (!infoToShow.ContainsKey("introduce"))
                {
                    infoToShow.Add("introduce", Creeper.GetShortIntro(infoToShow["singerMID"]));
                }
                HolderSinger = infoToShow["singerName"].ToString();
                InfoDisplay.setinfo(infoToShow["singerName"], infoToShow["singerPic"], infoToShow["introduce"]);
                InfoDisplay.setsinger(infoToShow["songNum"], infoToShow["albumNum"], infoToShow["mvNum"]);
                break;

            case "2":        //album
                InfoDisplay.setinfo(infoToShow["albumName"], infoToShow["albumPic"], "发行时间:" + infoToShow["publicTime"]);
                InfoDisplay.setfooter(infoToShow["singerName"]);
                break;

            case "4":        //tv
                InfoDisplay.setinfo(infoToShow["singerName"], infoToShow["singerPic"]);
                break;

            case "8":        //song
                InfoDisplay.setinfo(infoToShow["title"], infoToShow["pic"], "发行时间:" + infoToShow["publish_date"]);
                InfoDisplay.setfooter(infoToShow["desc"]);
                break;

            default:
                InfoDisplay.Visibility = Visibility.Collapsed;
                break;
            }
            if (InfoDisplay.Visibility == Visibility.Visible)
            {
                Thread th = new Thread(StoreHistoryData);
                th.Start();
            }
        }
Exemplo n.º 18
0
        //----------------------------[ Action Commands ]------------------

        /// <summary>
        /// load and save file information into database
        /// </summary>
        /// <param name="obj">object which the file is associated with</param>
        public async void getFileFromLocal(InfoDisplay obj)
        {
            await Task.Factory.StartNew(() =>
            {
                // opening the file explorer for image file choosing
                string imageFile = InfoGeneral.ExecuteOpenFileDialog("Select an image file", new List <string> {
                    "png", "jpeg", "jpg"
                });
                if (!string.IsNullOrEmpty(imageFile))
                {
                    string msg = ConfigurationManager.AppSettings["wait_message"];
                    Singleton.getDialogueBox().showSearch(ConfigurationManager.AppSettings["wait_message"]);
                    obj.TxtChosenFile = imageFile;

                    // upload the image file to the server FTP
                    obj.uploadImage();

                    Singleton.getDialogueBox().IsDialogOpen = false;
                }
            });
        }
Exemplo n.º 19
0
    public void TowerDisplay()
    {
        towersButton.GetComponent <Image>().sprite  = selectedSprite;
        enemiesButton.GetComponent <Image>().sprite = unSelectedSprite;

        displayMode = InfoDisplay.Tower;

        if (monsterDisplaysList.Count > 0)
        {
            foreach (GameObject e in monsterDisplaysList)
            {
                Destroy(e);
            }
        }

        enemyFullDisplay.SetActive(false);
        monsterFullDisplay.SetActive(true);


        LoadYourTowers();
    }
Exemplo n.º 20
0
        private void instances()
        {
            _title            = ConfigurationManager.AppSettings["title_setting_display"];
            _imageList        = new ObservableCollection <InfoDisplay>();
            _cultureInfoArray = CultureInfo.GetCultures(CultureTypes.AllCultures & CultureTypes.NeutralCultures);

            _theme = new InfoDisplay();

            // palette initialization
            //_swatches = new SwatchesProvider().Swatches;

            //------[ Images ]
            _headerImageDisplay = _referential.MainWindowViewModel.ImageCreator.createImage("header_image", new List <string> {
                "header_image", "header_image_width", "header_image_height"
            }, ConfigurationManager.AppSettings["ftp_image_folder"], ConfigurationManager.AppSettings["local_image_folder"], "", "");
            _logoImageDisplay = _referential.MainWindowViewModel.ImageCreator.createImage("logo_image", new List <string> {
                "logo_image", "logo_image_width", "logo_image_height"
            }, ConfigurationManager.AppSettings["ftp_image_folder"], ConfigurationManager.AppSettings["local_image_folder"], "", "");
            _billImageDisplay = _referential.MainWindowViewModel.ImageCreator.createImage("bill_image", new List <string> {
                "bill_image", "bill_image_width", "bill_image_height"
            }, ConfigurationManager.AppSettings["ftp_image_folder"], ConfigurationManager.AppSettings["local_image_folder"], "", "");
        }
Exemplo n.º 21
0
        private async void deleteImage(InfoDisplay obj)
        {
            if (await Singleton.getDialogueBox().showAsync("Do you really want to delete this image [" + obj.TxtFileName + "] ?"))
            {
                Singleton.getDialogueBox().showSearch(ConfigurationManager.AppSettings["delete_message"]);
                var notDeletedInfosList = await Bl.BlReferential.DeleteInfoAsync(obj.InfoDataList);

                var whereImageInfosIDIsZeroList = obj.InfoDataList.Where(x => x.ID == 0 && x.Name.Equals(obj.TxtFileNameWithoutExtension)).ToList();
                if ((notDeletedInfosList.Count == 0 || whereImageInfosIDIsZeroList.Count > 0) && obj.deleteFiles())
                {
                    var credentials = Bl.BlReferential.searchInfo(new Info {
                        Name = "ftp_"
                    }, ESearchOption.AND);
                    if (WPFHelper.deleteFileFromFtpServer(ConfigurationManager.AppSettings["ftp_image_folder"], obj.TxtFileName, credentials))
                    {
                        await Singleton.getDialogueBox().showAsync(obj.TxtFileName + " has been successfully deteleted!");

                        obj.TxtFileFullPath = "";
                    }
                    else
                    {
                        string errorMessage = "Error occurred while deleting the image [" + obj.TxtFileName + "]";
                        Log.error(errorMessage, EErrorFrom.REFERENTIAL);
                        Singleton.getDialogueBox().showSearch(errorMessage);
                    }
                }

                // reset the picture information
                foreach (Info info in obj.InfoDataList)
                {
                    info.ID = 0;
                }

                Singleton.getDialogueBox().IsDialogOpen = false;
            }
        }
Exemplo n.º 22
0
 private void Start()
 {
     Pawn.onPawnReachedFinalTileWithGameObject += onPawnFinalTileReached;
     infoDisplay = InfoPanel.GetComponent <InfoDisplay>();
 }
Exemplo n.º 23
0
 public static void DisplayInfo(string text)
 {
     InfoDisplay?.Invoke(text);
 }
Exemplo n.º 24
0
 private void Start()
 {
     infoDisplay = gameObject.GetComponent <InfoDisplay>();
 }
Exemplo n.º 25
0
    public int shouldRotate = 0;//0=>no, 1=>clockwise -1=>counterclockwise

    // Start is called before the first frame update
    void Start()
    {
        infoDisplay     = gameObject.GetComponent <InfoDisplay>();
        materialDefault = gameObject.transform.GetChild(0).GetComponent <Renderer>().material;
    }
 public LabelDecorator(InfoDisplay song)
 {
     display = song;
 }
Exemplo n.º 27
0
 private bool canDeleteImage(InfoDisplay arg)
 {
     return(true);
 }
Exemplo n.º 28
0
 void Awake()
 {
     _instance = this;
 }
Exemplo n.º 29
0
 private bool canGetFileFromLocal(InfoDisplay arg)
 {
     return(true);
 }
Exemplo n.º 30
0
 public static void AddInfoDisplay(InfoDisplay display)
 {
     _displays.Add(display);
 }