Exemplo n.º 1
0
        public static Sec_UserLogin GetInforFormCookie(string name, string key)
        {
            Sec_UserLogin ses = new Sec_UserLogin();

            try
            {
                string token = HttpContext.Current.Request.Cookies[name].Value;
                if (token != null)
                {
                    string infor = DisplayUtils.Decrypt(token, key);
                    var    rs    = JsonConvert.DeserializeObject <Sec_UserLogin>(infor);
                    if (rs != null)
                    {
                        ses.UserID      = rs.UserID;
                        ses.UserName    = rs.UserName;
                        ses.RoleId      = rs.RoleId;
                        ses.DisplayName = rs.DisplayName;
                        return(ses);
                    }
                }
                return(ses);
            }catch (Exception e)
            {
                Trace.WriteLine(e.Message);
                return(ses);
            }
        }
Exemplo n.º 2
0
    private void InitRods()
    {
        if (rodTypesToInitialize != null && rodTypesToInitialize.Length > 0 && rodTypesToInitialize.Length.Equals(rodCategories.Length))
        {
            for (int i = 0; i < rodTypesToInitialize.Length; i++)
            {
                GameObject textLabel = DisplayUtils.AddContentToParentObject(titleLabelRodPrefab, rodsToSelectTransform);
                textLabel.GetComponent <TextMeshProUGUI>().text = rodCategories[i];
                GameObject gridPanel = DisplayUtils.AddContentToParentObject(rodGridPrefab, rodsToSelectTransform);
                for (int j = 0; j < rodTypesToInitialize[i]; j++)
                {
                    GameObject     singleRodObject = DisplayUtils.AddContentToParentObject(singleRodPrefab, gridPanel.transform);
                    SingleRodPanel singleRodPanel  = singleRodObject.GetComponent <SingleRodPanel>();

                    // always select first rod
                    if (j == 0)
                    {
                        singleRodPanel.IsRodSelected = true;
                        singleRodPanel.SelectedPanel.gameObject.SetActive(true);
                        spawnedObject = ObjectPooler.Instance.SpawnFromPool(singleRodPanel.SelectedRodModel);
                    }

                    int randomIcon        = Random.Range(0, rodIcons.Length);
                    int randomFrame       = Random.Range(0, rodFrames.Length);
                    int randomName        = Random.Range(0, rodNames.Length);
                    int randomModel       = Random.Range(0, rodModelsCount);
                    int randomSliderValue = j == 0 ? 100 : Random.Range(0, 100);
                    singleRodPanel.Create(rodIcons[randomIcon], rodFrames[randomFrame], rodNames[randomName], randomModel, randomSliderValue);
                    createdRods.Add(singleRodPanel);
                }
            }
        }
    }
Exemplo n.º 3
0
        public string GetPlaceDisplayName(IReadOnlyDbContext db)
        {
            var passive = db.FindById <Passive>(PatchPanel);
            var rack    = db.FindById <Rack>(passive.Place);
            var room    = db.FindById <Room>(rack.Parent);

            StringBuilder sb = new StringBuilder();

            sb.Append("اتاق/سالن ").Append(room.Name).Append(" &lArr; ")
            .Append("راک ").Append(rack.Name).Append(" &lArr; ");
            if (passive.Type == Passive.PassiveTypeEnum.PatchPanel)
            {
                sb.Append("پچ پنل ");
            }
            else if (passive.Type == Passive.PassiveTypeEnum.Transmissional)
            {
                sb.Append("تجهیز انتقال ")
                .Append(DisplayUtils.DisplayName(passive.TransmissionType))
                .Append(" ");
            }
            else
            {
                throw new NotImplementedException();
            }
            sb.Append(passive.Name);

            return(sb.ToString());
        }
Exemplo n.º 4
0
        public string ComputePartTwo(string[] input)
        {
            stopWatch = new Stopwatch();
            stopWatch.Start();

            var inputList = RepeatInput(input[0], 10000);
            var offset    = CalculateOffset(inputList);

            inputList = inputList.Substring(offset);

            // return $"{offset} - length: {inputList.Length} - generatePattern substring: {string.Join("", GeneratePattern(inputList.Length, offset)).Substring(offset-8, 48)}";

            Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - BeforeOutput");
            var outputList = CalculateOutputPartTwo(inputList);

            Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - Generated output");
            var phase = 1;

            Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - Calculated offset");
            // Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - AppliedPhase {phase} - {inputList}");

            while (phase < 100)
            {
                // Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - Applied phase {phase} - {outputList.Substring(outputList.Length-20), 20}");
                phase++;
                outputList = CalculateOutputPartTwo(outputList);
            }
            Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - Applied phase {phase}");

            return(outputList.Substring(0, 8));
        }
        public override string GetPopupText()
        {
            string txt = DisplayUtils.MachineDisplay(MachineName);

            txt += DisplayUtils.PowerDisplay(_machinePower);
            if (IsOperating())
            {
                txt += DisplayUtils.StorageDisplay(_machineStorage);
            }

            if (_anotherControllerDetected)
            {
                txt = "ANOTHER CONTROLLER DETECTED - ONLY ONE CONTROLLER CAN BE PRESENT\n";
            }

            txt += "Q to ";
            txt += _notifications ? "disable" : "enable";
            txt += " notifications.\n";

            if (Input.GetButtonDown("Interact") && (UIManager.AllowInteracting))
            {
                UIManager.ForceNGUIUpdate = 0.1f;
                AudioHUDManager.instance.HUDIn();
            }

            if (Input.GetKeyDown(KeyCode.Q))
            {
                ToggleNotifications();
            }

            return(txt);
        }
        public override string GetPopupText()
        {
            var txt = DisplayUtils.MachineDisplay(MachineName);
            var quantumStorageController = StorageIoService.GetStorageController();

            if (quantumStorageController != null && quantumStorageController.IsOperating())
            {
                txt += DisplayUtils.StorageDisplay(quantumStorageController.GetMachineStorage());
            }
            if (ControllerPos[0] == 0 && ControllerPos[1] == 0 && ControllerPos[2] == 0 ||
                quantumStorageController == null)
            {
                txt += "QUANTUM STORAGE CONTROLLER NOT FOUND.\n";
            }

            if (quantumStorageController != null && !quantumStorageController.HasPower())
            {
                txt += "QUANTUM STORAGE CONTROLLER HAS NO POWER.\n";
            }

            if (Input.GetButtonDown("Interact") && UIManager.AllowInteracting)
            {
                UIManager.ForceNGUIUpdate = 0.1f;
                AudioHUDManager.instance.HUDIn();
            }

            return(txt);
        }
    // Update is called once per frame
    void Update()
    {
        if (DisplayUtils.IsMouseOnScreen() && !EventSystem.current.IsPointerOverGameObject())
        {
            camControl.HandleCameraControls();

            SelectGridPos();
        }
    }
Exemplo n.º 8
0
    public void ShowMino(Mino mino)
    {
        List <Vector2Int> l = Field.GetAllCoordinates(mino);

        foreach (Vector2Int v in l)
        {
            DisplayUtils.InstChild(MinoTiles[mino.GetIdInt() - 1], new Vector3(v.x, v.y, 0), MinoParent);
        }
    }
Exemplo n.º 9
0
        public override string ToString()
        {
            var disp = DisplayUtils.DisplayName(Type) + " " + Model;

            if (!string.IsNullOrWhiteSpace(Address))
            {
                disp += " (" + Address + ")";
            }
            return(disp);
        }
Exemplo n.º 10
0
    private void UpdateHoldDisplay()
    {
        int holdid = game.GetHoldId();

        DestroyAllChild(HoldArea);
        if (holdid != 0)
        {
            DisplayUtils.InstChild(Minoes[holdid - 1], Vector3Int.zero, HoldArea);
        }
    }
Exemplo n.º 11
0
    public void ShowMino(int minoID, int x, int y, int rotation)
    {
        Mino mino           = new Mino(minoID, x, y, rotation);
        List <Vector2Int> l = Field.GetAllCoordinates(mino);

        foreach (Vector2Int v in l)
        {
            DisplayUtils.InstChild(MinoTiles[mino.GetIdInt() - 1], new Vector3(v.x, v.y, 0), MinoParent);
        }
    }
Exemplo n.º 12
0
        public string SetAuthCookie(HttpContext httpContext, string authenticationTicket, string cookieName, string key, DateTime Expiration)
        {
            var encryptedTicket = DisplayUtils.Encrypt(authenticationTicket, key);
            var cookie          = new HttpCookie(cookieName, encryptedTicket)
            {
                HttpOnly = true,
                Expires  = Expiration
            };

            httpContext.Response.Cookies.Add(cookie);
            return(encryptedTicket);
        }
        /**
         * Called when the user has stopped scrolling on the gallery's ScrollViewer. This will figure out which
         * images are in view of the user and load them.
         */
        private void ScrollChangedStopped(object sender, EventArgs e)
        {
            // Must stop the timer from repeating infinitely
            _scrollChangedTimer.Stop();

            // Get a list of the current images in view
            ListBox lb = _scrollViewer.Content as ListBox;
            List <ImageViewModel> list = DisplayUtils.GetVisibleItemsFromListBox(lb, Application.Current.MainWindow).Cast <ImageViewModel>().ToList();

            // Load the images in view, and once this is done, continue loading the rest of the images in the gallery.
            LoadPriorityImagesThenAll(list);
        }
Exemplo n.º 14
0
        public Dictionary <PropertyInfo, string> CreateDataTableColumns <T>(DataTable table, bool convertDateToPersian = true, bool includeTimeInDates = true,
                                                                            bool addIndexColumn = false, string[] excludeColumns = null)
        {
            PropertyInfo[] props = typeof(T).GetProperties();
            Dictionary <PropertyInfo, string> displayNames = new Dictionary <PropertyInfo, string>();

            if (addIndexColumn && !table.Columns.Contains(INDEX_COLUMN))
            {
                table.Columns.Add(INDEX_COLUMN, typeof(int));
            }

            foreach (PropertyInfo p in props)
            {
                if (excludeColumns != null && excludeColumns.Contains(p.Name))
                {
                    continue;
                }
                string dispName = DisplayUtils.DisplayName(p);
                displayNames.Add(p, dispName);
                if (table.Columns.Contains(dispName))
                {
                    continue;
                }

                Type propType = p.PropertyType;
                if (propType.IsEquivalentTo(typeof(ObjectId)) || propType.IsEnum || p.PropertyType.GetInterfaces().Contains(typeof(IEnumerable)))
                {
                    propType = typeof(string);
                }
                else if (propType == typeof(DateTime) && (!includeTimeInDates || convertDateToPersian))
                {
                    propType = typeof(string);
                }
                else
                {
                    Type undelying = Nullable.GetUnderlyingType(propType);
                    if (undelying != null)
                    {
                        propType = undelying;
                        if (propType == typeof(DateTime) && (!includeTimeInDates || convertDateToPersian))
                        {
                            propType = typeof(string);
                        }
                    }
                }
                DataColumn col = new DataColumn(dispName, propType);
                table.Columns.Add(col);
            }
            return(displayNames);
        }
        /// <summary>
        /// POST: api/Messages
        /// Receive a message from a user and reply to it
        /// </summary>
        public async Task <Message> Post([FromBody] Message message)
        {
            if (message.Type == "Message")
            {
                if (message.Text.ToLowerInvariant() == "testui")
                {
                    var reply = message.CreateReplyMessage();
                    await DisplayUtils.AddActionsToMessage(reply, new BotFlow("Hi!", null)
                    {
                        Options = new List <DialogOption>()
                        {
                            new DialogOption("Option A")
                        }
                    });

                    return(reply);
                }
                else if (message.Text.ToLowerInvariant() == "countchars")
                {
                    // calculate something for us to return
                    int length = (message.Text ?? string.Empty).Length;

                    // return our reply to the user
                    return(message.CreateReplyMessage($"You sent {length} characters"));
                }
                else if (message.Text.ToLowerInvariant() == "testdialog")
                {
                    return(await Conversation.SendAsync(message, () => new OptionsDialog(new BotFlow("Hello", null)
                    {
                        Options = new List <DialogOption>()
                        {
                            new DialogOption("dog")
                        }
                    })));
                }
                else
                {
                    // calculate something for us to return
                    int length = (message.Text ?? string.Empty).Length;

                    // return our reply to the user
                    return(message.CreateReplyMessage($"You sent {length} characters"));
                }
            }
            else
            {
                return(HandleSystemMessage(message));
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            iconView   = FindViewById(Resource.Id.icon);
            citysView  = FindViewById(Resource.Id.citys);
            infoLayout = FindViewById(Resource.Id.infoLayout);

            View button = FindViewById <Button>(Resource.Id.button1);

            button.Click += (sender, e) => {
                GuideHelper guideHelper = new GuideHelper(this);

                View test = guideHelper.Inflate(Resource.Layout.custom_view_show);
                guideHelper.AddPage(new TipData(test, (int)GravityFlags.Center));

                TipData tipData1 = new TipData(Resource.Drawable.tip1, (int)(GravityFlags.Right | GravityFlags.Bottom), iconView);
                tipData1.SetLocation(0, -DisplayUtils.DipToPix(ApplicationContext, 50));
                guideHelper.AddPage(tipData1);

                TipData tipData2 = new TipData(Resource.Drawable.tip2, citysView);
                guideHelper.AddPage(tipData2);

                TipData tipData3 = new TipData(Resource.Drawable.tip3, infoLayout);
                TipData tipData4 = new TipData(Resource.Drawable.next, (int)(GravityFlags.Bottom | GravityFlags.CenterHorizontal));
                tipData4.SetLocation(0, -DisplayUtils.DipToPix(ApplicationContext, 100));
                tipData4.SetOnClickListener(new tipData4OnClickListener(guideHelper));
                guideHelper.AddPage(false, tipData3, tipData4);

                guideHelper.AddPage(tipData1, tipData2, tipData3);

                //add custom view
                View testView = guideHelper.Inflate(Resource.Layout.custom_view_with_close);
                testView.FindViewById <ImageButton>(Resource.Id.guide_close).Click += (sender2, e2) => {
                    guideHelper.Dismiss();
                };
                TipData tipDataCustom = new TipData(testView, (int)GravityFlags.Center);
                guideHelper.AddPage(false, tipDataCustom);

                guideHelper.Show(false);
            };
        }
Exemplo n.º 17
0
    private void UpdateActiveMinoDisplay()
    {
        DestroyAllChild(ActiveMinoParent);
        Mino tmpMino = game.GetActiveMino();

        //方块
        List <Vector2Int> l = Field.GetAllCoordinates(game.activeMino);
        int ghostDist       = tmpMino.GetPosition().y - game.GetGhostY();

        foreach (Vector2Int v in l)
        {
            DisplayUtils.InstChild(MinoTiles[tmpMino.GetIdInt() - 1], new Vector3(v.x, v.y, 0), ActiveMinoParent);
            if (game.Playing())
            {
                DisplayUtils.InstChild(MinoTiles[tmpMino.GetIdInt() - 1], new Vector3(v.x, v.y - ghostDist, 0), ActiveMinoParent, 1, 0.5f);
            }
        }
    }
Exemplo n.º 18
0
        public IActionResult UploadImages(string currentFolder, ICollection <IFormFile> files)
        {
            try
            {
                foreach (var file in files.Where(f => DisplayUtils.IsImageFile(f.FileName)))
                {
                    imageProcessor.SaveImage(file, env, currentFolder);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.StackTrace);
                return(View(new Folder {
                    CurrentFolder = currentFolder
                }));
            }

            return(RedirectToAction("Index", "Home", new { path = currentFolder }));
        }
        public string getPopupText()
        {
            var    storageController = QuantumOutputPortMachine.StorageIoService.GetStorageController();
            string txt = DisplayUtils.MachineDisplay(QuantumOutputPortMachine.MachineName);

            if ((QuantumOutputPortMachine.ControllerPos[0] == 0 && QuantumOutputPortMachine.ControllerPos[1] == 0 && QuantumOutputPortMachine.ControllerPos[2] == 0) ||
                storageController == null)
            {
                txt += "QUANTUM STORAGE CONTROLLER NOT FOUND.\n";
            }
            if (storageController != null && !storageController.HasPower())
            {
                txt += "QUANTUM STORAGE CONTROLLER HAS NO POWER.\n";
            }
            txt += "\nOutput status: ";
            if (!QuantumOutputPortMachine.Enabled)
            {
                txt += "disabled\n";
            }
            else
            {
                txt += "enabled\n";
            }

            txt += "Output item: ";
            if (QuantumOutputPortMachine.Exemplar != null)
            {
                txt += ItemManager.GetItemName(QuantumOutputPortMachine.Exemplar);
            }
            else
            {
                txt += "none";
            }

            if (Input.GetButtonDown("Interact") && (UIManager.AllowInteracting))
            {
                UIManager.ForceNGUIUpdate = 0.1f;
                AudioHUDManager.instance.HUDIn();
            }

            return(txt);
        }
Exemplo n.º 20
0
 protected void Application_authenticateRequest(object sender, EventArgs e)
 {
     try
     {
         var    authCookie = HttpContext.Current.Request.Cookies["_NVOAUTH"];
         string encTicket  = authCookie?.Value;
         if (!String.IsNullOrEmpty(encTicket))
         {
             var encryptedTicket = DisplayUtils.Decrypt(encTicket, "keyauthen");
             var loginToken      = new FormsAuthenticationTicket(1, "_NVOAUTH", DateTime.Now, authCookie.Expires,
                                                                 true, encryptedTicket);
             var acc = new UserIdentity(loginToken);
             HttpContext.Current.User = acc;
         }
     }
     catch (Exception ex)
     {
         return;
     }
 }
Exemplo n.º 21
0
        private void btnRunSA_Click(object sender, EventArgs e)
        {
            EnableRunButtons(false);
            try
            {
                _watch.Restart();
                _watch.Start();

                var loopCount = txtSALoopCount.Text.ToInt();
                var sa        = new SimulatedAnnealingAlgo
                {
                    NumOfJobs = InputData.NumOfJobs,
                    LoopCount = loopCount
                };
                sa.StartSimulating();

                var initText = DisplayUtils.DisplayText(sa.InitJobs.Cmax, sa.InitJobs.JobsPermutation,
                                                        sa.InitJobs.JobsAssignment);

                var cMax           = sa.ResultCmax;
                var jobPermutation = sa.ResultJobPermutation;
                var jobAssignment  = sa.ResultJobAssignment;
                var resultText     = DisplayUtils.DisplayText(cMax, jobPermutation, jobAssignment);

                txtResultSA.Text = $"--- CHOSEN INIT JOBS ---\r\n{initText}\r\n\r\n" +
                                   $"--- RESULT JOBS ---\r\n{resultText}";

                _watch.Stop();
                var time = TimeSpan.FromMilliseconds(_watch.ElapsedMilliseconds).Humanize(4);
                MessageBox.Show($@"Execution time: {time}.", "Success", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                EnableRunButtons();
            }
        }
Exemplo n.º 22
0
    public void UpdateFieldDisplay()
    {
        DestroyAllChild(ParentField);
        int[,] field = game.GetFieldArray();



        //InstChild(Minoes[activeMinoId-1], tmp, ParentField,1,0.6f);

        //场地
        for (int x = 0; x < 10; x++)
        {
            for (int y = 0; y < 20; y++)
            {
                if (1 <= field[x, y] && field[x, y] <= 7)
                {
                    DisplayUtils.InstChild(MinoTiles[field[x, y] - 1], new Vector3(x, y, 0), ParentField);
                }
            }
        }
    }
Exemplo n.º 23
0
        public static SpriteObject ImageFileToSprite(string filename, string spriteName, bool isEmbeddedResource = false)
        {
            Texture2D texture = ImageFileToTexture(filename, isEmbeddedResource);

            if (texture == null)
            {
                return(null);
            }

            GameObject spriteGameObject = tk2dSprite.CreateFromTexture(
                texture,
                tk2dSpriteCollectionSize.ForResolution(GameCamera.SCREEN_DEFAULT_HEIGHT_HALF, GameCamera.SCREEN_DEFAULT_WIDTH, GameCamera.SCREEN_DEFAULT_HEIGHT),
                new Rect(0f, 0f, texture.width, texture.height),
                Vector2.zero);

            tk2dSprite sprite = spriteGameObject.GetComponent <tk2dSprite>();

            sprite.CurrentSprite.name = spriteName;

            return(DisplayUtils.CreateSpriteObject(sprite.Collection, spriteName));
        }
Exemplo n.º 24
0
        private void btnRunBruteForce_Click(object sender, EventArgs e)
        {
            EnableRunButtons(false);
            try
            {
                _watch.Restart();
                _watch.Start();

                var jobHelper = new JobHelper();
                jobHelper.GeneratePermutation();
                var cMax           = jobHelper.ResultCmax;
                var jobPermutation = jobHelper.ResultJobPermutation;
                var jobAssignment  = jobHelper.ResultJobAssignments;

                var displayResultText            = DisplayUtils.DisplayText(cMax, jobPermutation, jobAssignment);
                var displayAlternativeResultText =
                    $"\r\n--- ALTERNATIVE RESULTS --- Found {jobHelper.Results.Count} ---\r\n";
                for (var i = 0; i < jobHelper.Results.Count; ++i)
                {
                    var result = jobHelper.Results[i];
                    displayAlternativeResultText += $"\r\n=== ({i + 1}) ===\r\n" + result.DisplayText();
                }


                txtResultBF.Text = displayResultText + displayAlternativeResultText;

                _watch.Stop();
                var time = TimeSpan.FromMilliseconds(_watch.ElapsedMilliseconds).Humanize(4);
                MessageBox.Show($@"Execution time: {time}.", "Success", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                EnableRunButtons();
            }
        }
Exemplo n.º 25
0
        public IActionResult Index(string path)
        {
            string root = conf["gallery"];

            Folder rootFolder = new Folder();

            if (String.IsNullOrEmpty(path))
            {
                rootFolder.SubFolders    = DisplayUtils.GetFolders(env, root);
                rootFolder.Images        = DisplayUtils.GetDisplayImages(env, root);
                rootFolder.CurrentFolder = root;
            }
            else
            {
                string        dirPath = Path.Combine(env.WebRootPath, path);
                DirectoryInfo dirInfo = new DirectoryInfo(dirPath);

                string rootName = dirInfo.Name;
                string parent   = "";
                if (!rootName.Equals(root))
                {
                    string directoryName = Path.GetDirectoryName(dirPath);
                    parent     = directoryName.Substring(directoryName.IndexOf(root));
                    rootFolder = new Folder(rootName, parent);
                }
                else
                {
                    rootFolder = new Folder()
                    {
                        Name          = rootName,
                        CurrentFolder = rootName
                    };
                }

                rootFolder.SubFolders = DisplayUtils.GetFolders(env, path);
                rootFolder.Images     = DisplayUtils.GetDisplayImages(env, path);
            }
            return(View(rootFolder));
        }
Exemplo n.º 26
0
 private void UpdateNextDisplay()
 {
     DestroyAllChild(NextArea);
     int[] nextSeq = game.GetNextSeq();
     for (int i = 0; i < MAX_NEXT; i++)
     {
         int     id     = nextSeq[i];
         Vector3 offset = Vector3.zero;
         if (id == Mino.NameToId("J"))
         {
             offset.x = -0.5f;
         }
         else if (id == Mino.NameToId("I"))
         {
             offset.x = 0.5f;
         }
         else if (id == Mino.NameToId("O"))
         {
             offset.y = 0.5f;
         }
         DisplayUtils.InstChild(Minoes[nextSeq[i] - 1], new Vector3(0, -2.5f * i, 0) + offset, NextArea, 0.8f);
     }
 }
Exemplo n.º 27
0
        public string GetPlaceDisplay(IReadOnlyDbContext db)
        {
            StringBuilder sb = new StringBuilder();

            if (PlaceType == DevicePlaceType.Rack)
            {
                var rack     = db.FindById <Rack>(Place);
                var room     = db.FindById <Room>(rack.Parent);
                var building = db.FindById <Building>(room.Parent);
                var center   = db.FindById <CommCenter>(building.Parent);
                var city     = db.FindById <City>(center.City);

                sb.Append(city.Name).Append(" &lArr; ")
                .Append("مرکز ").Append(center.Name).Append(" &lArr; ")
                .Append("ساختمان ").Append(building.Name).Append(" &lArr; ")
                .Append("اتاق/سالن ").Append(room.Name).Append(" &lArr; ")
                .Append("راک ").Append(rack.Name).Append(" &lArr; ")
                .Append("دستگاه ").Append(ToString());
            }
            else if (PlaceType == DevicePlaceType.Kafu)
            {
                var kafu   = db.FindById <Kafu>(Place);
                var center = db.FindById <CommCenter>(kafu.CommCenter);
                var city   = db.FindById <City>(center.City);

                sb.Append(city.Name).Append(" &lArr; ")
                .Append("مرکز ").Append(center.Name).Append(" &lArr; ")
                .Append("کافو ").Append(DisplayUtils.DisplayName(kafu.Type))
                .Append(" \"").Append(kafu.Name).Append("\"");
            }
            else
            {
                throw new NotImplementedException();
            }

            return(sb.ToString());
        }
Exemplo n.º 28
0
 public override string GetPopupText()
 {
     return(DisplayUtils.MachineDisplay(MachineName + " " + _maxCapacity / 1024 + "k"));
 }
Exemplo n.º 29
0
 public override string ToString()
 {
     return(DisplayUtils.DisplayName(Type) + " " + Model);
 }
Exemplo n.º 30
0
 public override string ToString()
 {
     return(DisplayUtils.DisplayName(Type) + " " + Current.ToString());
 }