void DisplayButtons()
        {
            if (!ShowNewWeaponDetails) {
                if (GUILayout.Button("Create Weapon")) {
                    tempWeapon = new ISWeapon();
                    ShowNewWeaponDetails = true;
                    state = DisplayState.DETAILS;
                }
            }
            else {
                GUI.SetNextControlName("SaveButton");
                if (GUILayout.Button("Save")) {
                    if(_selectedIndex == -1)
                        database.Add(tempWeapon);
                    else
                        database.Replace(_selectedIndex, tempWeapon);

                    ShowNewWeaponDetails = false;
                    tempWeapon = null;
                    _selectedIndex = -1;
                    state = DisplayState.NONE;
                    GUI.FocusControl("SaveButton");
                }

                if(_selectedIndex != -1) {
                    if (GUILayout.Button("Delete")) {

                        if (EditorUtility.DisplayDialog("Delete Weapon",
                                                        "Are you sure that you want to delete " + database.Get(_selectedIndex).Name + " from the database?",
                                                        "Delete",
                                                        "Cancel")) {

                            database.Remove(_selectedIndex);

                            ShowNewWeaponDetails = false;
                            tempWeapon = null;
                            _selectedIndex = -1;
                            state = DisplayState.NONE;

                            GUI.FocusControl("DeleteButton");
                        }
                    }
                }

                if (GUILayout.Button("Cancel")) {
                    ShowNewWeaponDetails = false;
                    tempWeapon = null;
                    _selectedIndex = -1;
                    state = DisplayState.NONE;
                    GUI.FocusControl("CancelButton");
                }
            }
        }
Esempio n. 2
0
 public virtual void SetDisplayState(DisplayState displayState)
 {
     switch (displayState)
     {
         case DisplayState.Maximized:
             SetDisplayState(MaximizeButton);
             break;
         case DisplayState.Minimized:
             SetDisplayState(MinimizeButton);
             break;
         case DisplayState.Restored:
             SetDisplayState(RestoreButton);
             break;
     }
 }
Esempio n. 3
0
 public static extern int DeviceDisplayGetState(out DisplayState state);
 private void ResetState()
 {
     canvasGroup.alpha = 0;
     _state            = DisplayState.Hiding;
 }
Esempio n. 5
0
        public void onPairingStateChanged(PairableDevice pairableDevice)
        {
            //Dispatch UI Changes to Main Thread
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                //Set device border to appropriate colour
                InnerBorder.BorderBrush = DrawingResources.GetBrushFromPairingState(pairableDevice.PairingState);

                //Set the control's owner
                if (pairableDevice.PairingState == PairingState.Paired)
                {
                    // When paired, we move the device to the canvas.
                    this.MyDisplayState = DisplayState.PairedAndOnCanvas;
                }
                else
                {
                    // If we are not paired or in pairing attempt, we go to stackpanel
                    this.MyDisplayState = DisplayState.UnpairedAndOnStackPanel;
                }

            }));
        }
Esempio n. 6
0
 public abstract bool CanUseZoomStateFrom(DisplayState displayStatePrev);
Esempio n. 7
0
 public override bool CanUseZoomStateFrom(DisplayState displayStatePrev)
 {
     var prevSpectrumDisplayState = displayStatePrev as SpectrumDisplayState;
     if (null != prevSpectrumDisplayState)
     {
         return true;
     }
     return false;
 }
Esempio n. 8
0
 //request to display
 public virtual void Open()
 {
     gameObject.SetActive(true);
     displayState        = DisplayState.Entering;
     desiredDisplayState = DisplayState.Entered;
 }
Esempio n. 9
0
 private bool AlreadyInAskedState(DisplayState value)
 {
     return (DisplayState.Maximized == value && !WinPattern.Current.CanMaximize) ||
            (DisplayState.Minimized == value && !WinPattern.Current.CanMinimize);
 }
        void DisplayButtons()
        {
            if (!ShowNewWeaponDetails)
            {
                if (GUILayout.Button("Create Weapon"))
                {
                    tempWeapon           = new ISWeapon();
                    ShowNewWeaponDetails = true;
                    state = DisplayState.DETAILS;
                }
            }
            else
            {
                GUI.SetNextControlName("SaveButton");
                if (GUILayout.Button("Save"))
                {
                    if (_selectedIndex == -1)
                    {
                        database.Add(tempWeapon);
                    }
                    else
                    {
                        database.Replace(_selectedIndex, tempWeapon);
                    }

                    ShowNewWeaponDetails = false;
                    tempWeapon           = null;
                    _selectedIndex       = -1;
                    state = DisplayState.NONE;
                    GUI.FocusControl("SaveButton");
                }

                if (_selectedIndex != -1)
                {
                    if (GUILayout.Button("Delete"))
                    {
                        if (EditorUtility.DisplayDialog("Delete Weapon",
                                                        "Are you sure that you want to delete " + database.Get(_selectedIndex).Name + " from the database?",
                                                        "Delete",
                                                        "Cancel"))
                        {
                            database.Remove(_selectedIndex);

                            ShowNewWeaponDetails = false;
                            tempWeapon           = null;
                            _selectedIndex       = -1;
                            state = DisplayState.NONE;

                            GUI.FocusControl("DeleteButton");
                        }
                    }
                }

                if (GUILayout.Button("Cancel"))
                {
                    ShowNewWeaponDetails = false;
                    tempWeapon           = null;
                    _selectedIndex       = -1;
                    state = DisplayState.NONE;
                    GUI.FocusControl("CancelButton");
                }
            }
        }
Esempio n. 11
0
 private void SetDisplayState(DisplayState state)
 {
     DisplayState = state;
 }
Esempio n. 12
0
 /// <summary>
 /// Sets the tab to be collapsed or expanded
 /// </summary>
 /// <remarks>This method does not work with Microsoft Dynamics CRM for tablets because tabs cannot be collapsed</remarks>
 public void SetDisplayState(DisplayState state)
 {
 }
 /// <summary>
 /// Class constructor that allows to set display state.
 /// </summary>
 /// <param name="displayState">Display state.</param>
 public DisplayStateEventArgs(DisplayState displayState)
 {
     DisplayState = displayState;
 }
Esempio n. 14
0
        private void doIRCModule()
        {
            var       sb   = spriteBatch;
            Rectangle dest = Utils.InsetRectangle(bounds, 2);
            Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y - 1, 18, dest.Height + 2);

            sb.Draw(Utils.white, destinationRectangle, userScreen.moduleColorSolid);
            destinationRectangle.X     += destinationRectangle.Width / 2;
            destinationRectangle.Width /= 2;
            sb.Draw(Utils.white, destinationRectangle, Color.Black * 0.2f);
            dest.X     += 20;
            dest.Width -= 25;
            Rectangle rectangle = new Rectangle(dest.X + 4, dest.Y, dest.Width, 35);

            Hacknet.Gui.TextItem.doFontLabelToSize(rectangle, "Interweb Remote Com", GuiData.font, Color.White, true, true);
            int num  = dest.Width / 4;
            int num2 = 22;

            if (Hacknet.Gui.Button.doButton(37849102, rectangle.X + rectangle.Width - 6 - num, rectangle.Y + rectangle.Height - rectangle.Height / 2 - num2 / 2, num, num2, LocaleTerms.Loc("Exit IRC"), userScreen.moduleColorSolid))
            {
                this.userScreen.Execute("daemon exit");
                this.state = DisplayState.SSH_SESSION;
            }
            rectangle.Y     += rectangle.Height;
            rectangle.X     -= 6;
            dest.Y          += rectangle.Height;
            dest.Height     -= rectangle.Height;
            rectangle.Height = 2;
            sb.Draw(Utils.white, rectangle, userScreen.moduleColorSolid);
            dest.Y      += rectangle.Height + 2;
            dest.Height -= rectangle.Height + 2;
            dest.Height -= 6;
            PatternDrawer.draw(dest, 0.22f, Color.Black * 0.5f, /*flag ?*/ (userScreen.moduleColorSolid * 0.12f) /*: (Utils.AddativeRed * 0.2f)*/, sb, /*flag ? */ PatternDrawer.thinStripe /*: PatternDrawer.warningStripe*/);
            dest.X      += 2;
            dest.Width  -= 4;
            dest.Height -= 4;
            //if (flag)
            //{
            var messages = ((IrcState)userScreen.activeSession.GetState()).GetMessages();

            int _num  = (int)(GuiData.ActiveFontConfig.tinyFontCharHeight + 4f);
            int _num2 = 4;
            int _num3 = (int)((float)dest.Height / (float)_num);
            int _num4 = _num3;
            int _num5 = messages.Count - 1;
            int _num6 = 0;
            int y     = dest.Y;

            while (_num4 > 0 && _num5 >= 0 && dest.Height - _num6 > _num)
            {
                //bool needsNewMessagesLineDraw = this.messagesAddedSinceLastView > 0 && this.messagesAddedSinceLastView < logsFromFile.Count && logsFromFile.Count - num5 == this.messagesAddedSinceLastView;
                _num4  -= this.DrawIRCMessage(messages[_num5], dest, _num, _num4, y /*, needsNewMessagesLineDraw,*/, out dest);
                dest.Y -= _num2;
                _num6  += _num2;
                _num5--;
            }
            if (_num5 <= -1 && _num4 > 1)
            {
                int        _num7      = _num + 8;
                Rectangle  _rectangle = new Rectangle(dest.X, dest.Y + dest.Height - _num7, dest.Width, _num7);
                SpriteFont tinyfont   = GuiData.tinyfont;
                //string text = "--- " + LocaleTerms.Loc("Log Cleared by Administrator") + " ---";
                //Vector2 vector = tinyfont.MeasureString(text);
                //sb.DrawString(tinyfont, text, Utils.ClipVec2ForTextRendering(new Vector2((float)rectangle.X + (float)rectangle.Width / 2f - vector.X / 2f, (float)rectangle.Y + (float)rectangle.Height / 2f - vector.Y / 2f)), Color.Gray);
            }
            //}

            /*else
             * {
             *  int num3 = dest.Height / 4;
             *  Rectangle rectangle2 = new Rectangle(dest.X - 4, dest.Y + dest.Height / 2 - num3 / 2, dest.Width + 6, num3);
             *  sb.Draw(Utils.white, rectangle2, this.userScreen.lockedColor);
             *  rectangle2.Height -= 35;
             *  Hacknet.Gui.TextItem.doCenteredFontLabel(rectangle2, LocaleTerms.Loc("Login To Server"), GuiData.font, Color.White, false);
             *  if (Hacknet.Gui.Button.doButton(84109551, rectangle2.X + rectangle2.Width / 2 - rectangle2.Width / 4, rectangle2.Y + rectangle2.Height - 32, rectangle2.Width / 2, 28, "Login", null))
             *  {
             *      this.userScreen.Execute("login");
             *  }
             * //}*/
        }
Esempio n. 15
0
        private void doLSModule()
        {
            this.x = 5;
            this.y = 5;
            int    num  = this.bounds.Width - 25;
            string text = this.userScreen.activeSession.serverName + " " + LocaleTerms.Loc("File System");

            Hacknet.Gui.TextItem.doFontLabel(new Vector2((float)(this.bounds.X + this.x), (float)(this.bounds.Y + this.y)), text, GuiData.font, new Color?(Color.White), (float)this.bounds.Width - 46f, 60f, false);
            if (Hacknet.Gui.Button.doButton(299999, this.bounds.X + (this.bounds.Width - 41), this.bounds.Y + 12, 27, 29, "<-", null))
            {
                Console.WriteLine(this.userScreen.activeSession.workingPath);
                if (this.userScreen.activeSession.workingPath != "/" && this.userScreen.activeSession.workingPath != "")
                {
                    this.userScreen.Execute("cd ..");
                    this.userScreen.Execute("ls");
                }
                else
                {
                    this.state = DisplayState.SSH_SESSION;
                }
            }
            this.y += 50;
            Rectangle dest = GuiData.tmpRect;

            dest.Width  = this.bounds.Width;
            dest.X      = this.bounds.X;
            dest.Y      = this.bounds.Y + 55;
            dest.Height = this.bounds.Height - 57;

            Hacknet.Gui.TextItem.doFontLabel(new Vector2(dest.X, dest.Y), "Working Directory : " + (userScreen.activeSession.workingPath == "" ? "/" : userScreen.activeSession.workingPath), GuiData.smallfont, new Color?(Color.White), (float)this.bounds.Width - 46f, 60f, false);

            int ButtonHeight = (int)(GuiData.ActiveFontConfig.tinyFontCharHeight + 10f);

            dest.Y += 25;

            int width        = dest.Width - 25;
            var sessionState = (LsState)userScreen.activeSession.GetState();

            for (int i = 0; i < sessionState.files.Count; i++)
            {
                if (sessionState.files[i].GetDisplayName() == "" || sessionState.files[i] == null)
                {
                    continue;
                }

                var activeFile = sessionState.files[i];

                //spriteBatch.Draw(Utils.white, new Rectangle((int)bounds.X+6, (int)dest.Y + 3 + (ButtonHeight + 5) * i, 5, (int)ButtonHeight), activeFile.hasWritePermission ? Color.White : Color.Black);
                if (Hacknet.Gui.Button.doButton(300000 + i, bounds.X + 5 + 5, dest.Y + 2 + (ButtonHeight + 5) * i, width - 5, ButtonHeight, activeFile.GetDisplayName(), null))
                {
                    if (activeFile.IsFolder())
                    {
                        this.userScreen.Execute("cd " + activeFile.GetActualName());
                        this.userScreen.Execute("ls");
                    }
                    else
                    {
                        this.userScreen.Execute("view " + activeFile.GetActualName());
                    }
                }
            }
            ;
            //Hacknet.Gui.Button.DisableIfAnotherIsActive = true;
            //Hacknet.Gui.Button.DisableIfAnotherIsActive = false;
        }
Esempio n. 16
0
 //request to hide
 public virtual void Close()
 {
     displayState        = DisplayState.Exiting;
     desiredDisplayState = DisplayState.Exited;
 }
Esempio n. 17
0
        private void FillNullData(List<Divice> lDivice, DisplayState State, DateTime StartTime, DateTime EndTime)
        {
            if (lDivice == null || lDivice.Count == 0)
            {
                return;
            }
            List<Divice> tmpLDivice = new List<Divice>(); ;
            //根据不同的显示状态对数据进行显示的格式化
            switch (State)
            {
                //根据时间显示
                case DisplayState.TIME:
                    //设置时间下标
                    curve.PSubscript = DisplayDay;
                    //将数据根据小时格式化
                    int minHour = lDivice[0].CreateTime.Hour;
                    int maxHour = lDivice[lDivice.Count - 1].CreateTime.Hour;
                    //根据小时数循环
                    for (int i = 0; i < 24; i++)
                    {

                        //循环所有数据
                        for (int j = 0; j < lDivice.Count; j++)
                        {
                            //若该数据是该时间区域的
                            if (lDivice[j].CreateTime.Hour == i)
                            {
                                tmpLDivice.Add(lDivice[j]);
                            }
                        }
                        //该时间段内的数据为0则增加一个0点数据
                        if (tmpLDivice.Count == 0)
                        {
                            //若最小不如当前时间小, 则增加在头
                            if (minHour > i)
                            {
                                Divice tmpDivice = new Divice();
                                tmpDivice.CreateTime = new DateTime(StartTime.Year, StartTime.Month, StartTime.Day, i, 0, 0);
                                tmpDivice.Hum = 0;
                                tmpDivice.Temperature = 0;
                                tmpDivice.Wo = 0;
                                lDivice.Insert(0, tmpDivice);
                            }
                            else
                                //若最大时间不如当前时间大,则增加在尾.
                                if (maxHour < i)
                                {
                                    Divice tmpDivice = new Divice();
                                    tmpDivice.CreateTime = new DateTime(StartTime.Year, StartTime.Month, StartTime.Day, i, 0, 0);
                                    tmpDivice.Hum = 0;
                                    tmpDivice.Temperature = 0;
                                    tmpDivice.Wo = 0;
                                    lDivice.Add(tmpDivice);
                                }
                                else
                                //否则在中间,需要循环所有数据插入数据
                                //算法:根据时间区间插入0数据
                                {
                                    for (int l = 0; l < lDivice.Count - 1; l++)
                                    {
                                        if (lDivice[l].CreateTime.Hour < i && lDivice[l + 1].CreateTime.Hour > i)
                                        {
                                            Divice tmpDivice = new Divice();
                                            tmpDivice.CreateTime = new DateTime(StartTime.Year, StartTime.Month, StartTime.Day, i, 0, 0);
                                            tmpDivice.Hum = 0;
                                            tmpDivice.Temperature = 0;
                                            tmpDivice.Wo = 0;
                                            lDivice.Insert(l + 1, tmpDivice);
                                        }
                                    }
                                }

                        }
                        else
                            //该时间段内的数据多于1则取一个平均值
                            //可能有问题, 待测试-------------------------------
                            if (tmpLDivice.Count > 1)
                            {
                                int count = tmpLDivice.Count;
                                for (int k = 1; k < tmpLDivice.Count; k++)
                                {
                                    tmpLDivice[0].Hum = (tmpLDivice[0].Hum + tmpLDivice[k].Hum);
                                    tmpLDivice[0].Temperature = (tmpLDivice[0].Temperature + tmpLDivice[k].Temperature);
                                    lDivice.Remove(tmpLDivice[k]);
                                }
                                tmpLDivice[0].Hum = tmpLDivice[0].Hum / count;
                                tmpLDivice[0].Temperature = tmpLDivice[0].Temperature / count;
                            }

                        tmpLDivice.Clear();
                    }
                    break;
                //根据天显示
                case DisplayState.DAY:
                    //设置动态日期的下标
                    //在这里直接操作startTime可能会有问题------------------------------------
                    int days = EndTime.Subtract(StartTime).Days + 1;
                    String[] DisplayDays = new String[days];
                    DateTime tmpDate = new DateTime(StartTime.Year, StartTime.Month, StartTime.Day);
                    //List<Divice> DiviceBackUp = new List<Divice>();
                    //DiviceBackUp.AddRange(lDivice);
                    //将月日加入下标
                    for (int i = 0; i < DisplayDays.Length; i++)
                    {
                        DisplayDays[i] = "" + tmpDate.Month + "-" + tmpDate.Day;
                        tmpDate = tmpDate.AddDays(1);
                    }
                    //第一个加上年份,  若中间有其他年份的日期(跨年)则在这几天的1月1号加上年份
                    DisplayDays[0] = "" + StartTime.Year + "-" + DisplayDays[0];
                    curve.PSubscript = DisplayDays;
                    int daysCount = EndTime.Subtract(StartTime).Days + 1;
                    //将数据根据日格式化
                    for (int i = 1; i <= daysCount; i++)
                    {
                        for (int j = 0; j < lDivice.Count; j++)
                        {
                            DateTime tmpDiviceTime = new DateTime(lDivice[j].CreateTime.Year, lDivice[j].CreateTime.Month, lDivice[j].CreateTime.Day);
                            //若日期等于今天则加入临时list
                            if (tmpDiviceTime.CompareTo(StartTime) == 0)
                            {
                                tmpLDivice.Add(lDivice[j]);
                            }
                        }
                        //若没有数据则补0数据
                        if (tmpLDivice.Count == 0)
                        {
                            int index = 0;
                            for (int l = 0; l < lDivice.Count; l++)
                            {
                                if (lDivice[l].CreateTime.CompareTo(StartTime) < 0 && l < lDivice.Count - 1)//&& lDivice[l + 1].CreateTime.CompareTo(StartTime) > 0)
                                {
                                    index = l;
                                }
                                else
                                    if (l == lDivice.Count - 1)
                                    {
                                        index = l + 1;
                                    }
                                    else
                                    {
                                        break;
                                    }
                            }
                            Divice tmpDivice = new Divice();
                            tmpDivice.CreateTime = new DateTime(StartTime.Year, StartTime.Month, StartTime.Day, 0, 0, 0);
                            tmpDivice.Hum = 0;
                            tmpDivice.Temperature = 0;
                            tmpDivice.Wo = 0;
                            lDivice.Insert(index, tmpDivice);
                            //InsertZeroData(lDivice, index, 0, i, StartTime);
                        }
                        else
                            //循环处理同一天数据
                            if (tmpLDivice.Count > 1)
                            {
                                int count = tmpLDivice.Count;
                                int index = lDivice.IndexOf(tmpLDivice[0], 0);
                                //将同一天数据求平均值存为1条
                                lDivice.Remove(tmpLDivice[0]);
                                for (int k = 1; k < tmpLDivice.Count; k++)
                                {
                                    tmpLDivice[0].Hum = (tmpLDivice[0].Hum + tmpLDivice[k].Hum);
                                    tmpLDivice[0].Temperature = (tmpLDivice[0].Temperature + tmpLDivice[k].Temperature);
                                    lDivice.Remove(tmpLDivice[k]);
                                }
                                //将数据替换为days个数个平均值加入list
                                //tmpLDivice = GetAverByCount(tmpLDivice, days);
                                //lDivice.InsertRange(index, tmpLDivice);
                                tmpLDivice[0].Hum = tmpLDivice[0].Hum / count;
                                tmpLDivice[0].Temperature = tmpLDivice[0].Temperature / count;
                                lDivice.Insert(index, tmpLDivice[0]);
                            }

                        StartTime = StartTime.AddDays(1);
                        tmpLDivice.Clear();
                    }
                    break;
                //根据月显示
                //case DisplayState.MONTH:
                //    //设置动态月下标
                //    int years = EndTime.Year - StartTime.Year;
                //    int year = StartTime.Year;
                //    int months = EndTime.Month - StartTime.Month + (years * 12);
                //    String[] DisplayMonth = new String[months];
                //    for (int i = 0; i < months; i++)
                //    {
                //        DisplayMonth[i] = "";
                //    }
                //    //将数据根据月格式化

                //    break;
            }

            ////由于根据时间进行从小到大排序多以第一个是几点就将几个0数据放入头当空数据
            //Divice firstDivice = lDivice[0];
            ////获得零点时间
            //DateTime date = new DateTime(firstDivice.CreateTime.Year, firstDivice.CreateTime.Month, firstDivice.CreateTime.Day);
            //int hours = firstDivice.CreateTime.Subtract(date).Hours;
            //hours = hours > 0 ? hours - 1 : 0;
            ////根据时间间隔为1小时增加零点数据
            //for (int i = 0; i < hours; i++)
            //{
            //    Divice tmpDivice = new Divice();
            //    tmpDivice.CreateTime = new DateTime(firstDivice.CreateTime.Year, firstDivice.CreateTime.Month, firstDivice.CreateTime.Day, i, 0, 0);
            //    tmpDivice.Hum = 0;
            //    tmpDivice.Temperature = 0;
            //    tmpDivice.Wo = 0;
            //    lDivice.Insert(i, tmpDivice);
            //}

            ////循环数据监测数据间时间的差距, 差距过大插0数据
            //for (int i = 0; i < lDivice.Count - 1; i++)
            //{
            //    Divice divice = lDivice[i];
            //    //若两个数据点在同一个时间段(1小时)内则取平均值
            //    if (lDivice[i].CreateTime.Hour == lDivice[i + 1].CreateTime.Hour)
            //    {
            //        lDivice[i].Hum = (lDivice[i].Hum + lDivice[i + 1].Hum) / 2;
            //        lDivice[i].Temperature = (lDivice[i].Temperature + lDivice[i + 1].Temperature) / 2;
            //        lDivice.Remove(lDivice[i + 1]);
            //    }
            //    //若两个数据点之间的时间超过1个小时(2小时以上)则在中间补0数据
            //    if (lDivice[i].CreateTime.Hour - lDivice[i + 1].CreateTime.Hour > 1)
            //    { }

            //}

            ////由于根据时间进行从小到大排序多以最后一个是几点就将几个0数据放入尾当空数据
            //Divice lastDivice = lDivice[lDivice.Count - 1];
            ////获得零点时间
            //date = new DateTime(firstDivice.CreateTime.Year, firstDivice.CreateTime.Month, firstDivice.CreateTime.Day);
            //hours = lastDivice.CreateTime.Subtract(date).Hours + 1;
            //int count = 24 - hours;
            ////根据时间间隔为1小时增加零点数据
            //for (int i = 0; i < count; i++)
            //{
            //    Divice tmpDivice = new Divice();
            //    tmpDivice.CreateTime = new DateTime(lastDivice.CreateTime.Year, lastDivice.CreateTime.Month, lastDivice.CreateTime.Day, hours + i, 0, 0);
            //    tmpDivice.Hum = 0;
            //    tmpDivice.Temperature = 0;
            //    tmpDivice.Wo = 0;
            //    lDivice.Add(tmpDivice);
            //}
        }
Esempio n. 18
0
 private void OnRevealAnimStart()
 {
     _displayState = DisplayState.Revealing;
 }
Esempio n. 19
0
 public virtual void Focus(DisplayState displayState)
 {
     window.Focus(displayState);
 }
Esempio n. 20
0
 private void OnRevealAnimComplete()
 {
     _displayState = DisplayState.Revealed;
 }
Esempio n. 21
0
        /// <summary>
        /// Sets the display state for the control.
        /// </summary>
        private void SetDisplayState(DisplayState state)
        {
            m_state = state;

            switch (m_state)
            {
                case DisplayState.EditItems:
                {
                    ItemsDV.Visible = true;
                    EventTypePN.Visible = false;
                    EventsCTRL.Visible = false;
                    EventFilterCTRL.Visible = false;
                    SamplingIntervalCH.Visible = true;
                    DiscardOldestCH.Visible = true;
                    DiscardOldestCH.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                    OperationStatusCH.Visible = false;
                    BackBTN.Visible = false;
                    NextBTN.Visible = true;
                    NextBTN.Enabled = true;
                    OkBTN.Visible = false;
                    break;
                }

                case DisplayState.SelectEventType:
                {
                    ItemsDV.Visible = false;
                    EventTypePN.Visible = true;
                    EventsCTRL.Visible = false;
                    EventFilterCTRL.Visible = false;
                    BackBTN.Visible = true;
                    NextBTN.Visible = true;
                    NextBTN.Enabled = true;
                    OkBTN.Visible = false;
                    break;
                }

                case DisplayState.SelectEventFields:
                {
                    ItemsDV.Visible = false;
                    EventTypePN.Visible = false;
                    EventsCTRL.Visible = false;
                    EventFilterCTRL.Visible = true;
                    BackBTN.Visible = true;
                    NextBTN.Visible = true;
                    NextBTN.Enabled = true;
                    OkBTN.Visible = false;
                    break;
                }

                case DisplayState.ApplyChanges:
                {
                    ItemsDV.Visible = true;
                    EventTypePN.Visible = false;
                    EventsCTRL.Visible = false;
                    SamplingIntervalCH.Visible = true;
                    DiscardOldestCH.Visible = true;
                    DiscardOldestCH.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                    OperationStatusCH.Visible = true;
                    BackBTN.Visible = true;
                    NextBTN.Visible = true;
                    NextBTN.Enabled = true;
                    OkBTN.Visible = false;
                    break;
                }

                case DisplayState.ViewUpdates:
                {
                    ItemsDV.Visible = false;
                    EventTypePN.Visible = false;
                    EventsCTRL.Visible = true;
                    BackBTN.Visible = true;
                    NextBTN.Enabled = false;
                    OkBTN.Visible = false;
                    break;
                }
            }
        }
Esempio n. 22
0
        public void SetDisplayState(DisplayState displayState)
        {
            switch (displayState)
            {
                case DisplayState.NO_SCALE:
                    Console.WriteLine("NO_SCALE");

                    isFit = false;

                    this.resizeButton.Image = IGet("488").Img;
                    if (flashMovie != null)
                    {
                        this.flashMovie.Width = defaultSWFWidth;
                        this.flashMovie.Height = defaultSWFHeight;

                    }
                    this.widthTextBox.Enabled = false;
                    this.heightTextBox.Enabled = false;

                    break;
                case DisplayState.EXACT_FIT:
                    Console.WriteLine("EXACT_FIT");
                    isFit = true;

                    this.resizeButton.Image = IGet("489").Img;
                    if (flashMovie != null)
                    {
                        this.flashMovie.Width = this.panel.Width;
                        this.flashMovie.Height = this.panel.Height;

                    }
                    this.widthTextBox.Enabled = false;
                    this.heightTextBox.Enabled = false;

                    break;
                case DisplayState.FREE:
                    Console.WriteLine("FREE");
                    isFit = false;

                    this.resizeButton.Image = IGet("61").Img;
                    if (flashMovie != null)
                    {
                        this.flashMovie.Width = settingObject.SWFWidth;
                        this.flashMovie.Height = settingObject.SWFHeight;

                    }
                    this.widthTextBox.Enabled = true;
                    this.heightTextBox.Enabled = true;
                    break;
            }

            this.settingObject.DisplayState = displayState;
        }
Esempio n. 23
0
        public virtual bool Update(float currentTime, float bpm, ref bool[] button, MarkResults results, bool auto, ref int soundType, MarkManager.EvaluateEffectHandler effectCallback)
        {
            if (fixedBPM >= 0)
            {
                bpm = fixedBPM;
            }
            bool ret = false;

            if (!auto)
            {
                if (ProcessPressedButton(button) && state < State.Cool)
                {
                    Logger.Instance.AddLog("Update:{0}, {1}, {2}", Time, currentTime, adjustGapTime);
                    var pressEval = EvaluateImpl(Time, currentTime - adjustGapTime);
                    Logger.Instance.AddLog("Evaluate:{0}", pressEval);
                    if (pressEval > EffectType.Worst)
                    {
                        UnsetPressedButton(button);
                    }
                    switch (pressEval)
                    {
                    case EffectType.Cool:
                        state = State.Cool;
                        OnPrcessEvaluate(false, false, EffectType.Cool, effectCallback);
                        results.Add(EffectType.Cool);
                        ret = true;
                        break;

                    case EffectType.Fine:
                        state = State.Fine;
                        OnPrcessEvaluate(false, false, EffectType.Fine, effectCallback);
                        results.Add(EffectType.Fine);
                        ret = true;
                        break;

                    case EffectType.Safe:
                        state = State.Safe;
                        OnPrcessEvaluate(false, false, EffectType.Safe, effectCallback);
                        results.Add(EffectType.Safe);
                        ret = true;
                        break;

                    case EffectType.Sad:
                        state = State.Sad;
                        OnPrcessEvaluate(false, false, EffectType.Sad, effectCallback);
                        results.Add(EffectType.Sad);
                        ret = true;
                        break;

                    case EffectType.Worst:
                        state = State.Worst;
                        OnPrcessEvaluate(false, false, EffectType.Worst, null);
                        results.Add(EffectType.Worst);
                        ret = true;
                        break;

                    case 0:
                        break;
                    }
                }
            }
            else
            {
                //when auto
                if (currentTime - Time >= -AutoWidth && state < State.Cool)
                {
                    state = State.Cool;
                    OnPrcessEvaluate(false, false, EffectType.Cool, effectCallback);
                    soundType = (int)ButtonType;
                    results.Add(EffectType.Cool);
                    ret         = true;
                    Hidden      = false;
                    ColorHidden = false;
                }
            }
            if (currentTime - Time >= eval[3] && state < State.Cool)
            {
                OnPrcessEvaluate(false, false, EffectType.Worst, null);
                results.Add(EffectType.Worst);
                ret = true;
            }
            if (state < State.Cool)
            {
                if (state == State.Moving && currentTime - Time >= 0)
                {
                    state = State.Disappering;
                }
                if (state == State.Disappering)
                {
                    mark.Scale = axis.Scale = colorMarkInfo.ColorMark.Scale = new Vector2((eval[3] + Time - currentTime) / eval[3]);
                    if (mark.Scale.X <= 0)
                    {
                        mark.Scale = axis.Scale = colorMarkInfo.Scale = Vector2.Zero;
                    }
                }
                float scale = (float)bpm / DefaultBpm;
                if (Hidden)
                {
                    if (Time - currentTime <= 0.5f / scale)
                    {
                        if (displayState == DisplayState.Sudden)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback);
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                        }
                    }
                    else if (Time - currentTime <= 2 / scale)
                    {
                        if (displayState == DisplayState.Normal || displayState == DisplayState.Hidden || displayState == DisplayState.HiddenColor || displayState == DisplayState.SuddenColor)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback);
                            ColorHidden |= displayState == DisplayState.SuddenColor;
                        }
                    }
                }
                else
                {
                    if (Time - currentTime <= 0.25f / scale)
                    {
                        if (displayState == DisplayState.Hidden)
                        {
                            displayState = (DisplayState)(-1);
                            Hidden       = true;
                        }
                        else
                        {
                            ColorHidden |= displayState == DisplayState.HiddenColor;
                        }
                    }
                    else if (Time - currentTime <= 0.5f / scale)
                    {
                        if (ColorHidden && displayState == DisplayState.SuddenColor)
                        {
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                            ColorHidden = false;
                        }
                    }
                }
                if (state == State.Appearing && !Hidden)
                {
                    float sx = mark.Scale.X + 0.05f;
                    mark.Scale = new Vector2(sx, sx);
                    //uzu.Scale = new Vector2(sx / 4f, sx / 4f);
                    if (mark.Scale.X > 1.2f)
                    {
                        mark.Scale = Vector2.One;
                        state      = State.Moving;
                    }
                }
                UpdateColorPosition(currentTime, bpm);
                axis.Rotation = -1 * (float)Math.PI * (Time - currentTime) * scale;
                if (axis.Rotation >= 0)
                {
                    axis.Rotation = 0;
                }
            }
            colorMarkInfo.DrawTrace        = state == State.Moving || state == State.Appearing;
            mark.Hidden                    = axis.Hidden = !(state < State.Cool);
            colorMarkInfo.ColorMark.Hidden = ColorHidden || !(state < State.Cool);
            colorMarkInfo.Hidden           = ColorHidden;
            return(ret);
        }
Esempio n. 24
0
    private static void CreateCategoryPage(KeyValuePair <string, Dictionary <string, MelonPrefs.MelonPreference> > category)
    {
        WipeScroller();
        displayState = DisplayState.Prefs;
        var categoryHeader = modMenuOM.AddHeader(0, category.Key);

        modMenuOM.scrollable.AddRow(categoryHeader);

        int buttonIndex = 0;

        Il2CppGeneric.List <GameObject> row = new Il2CppGeneric.List <GameObject>();
        foreach (var pref in category.Value)
        {
            switch (pref.Value.Type)
            {
            case MelonPrefs.MelonPreferenceType.INT:
                MinMaxStepDefaultInt rangesInt = ParseMinMaxStepInt(pref.Value.DisplayText);
                if (rangesInt.Equals(default(MinMaxStepDefaultInt)))
                {
                    break;
                }
                var intSlider = modMenuOM.AddSlider(buttonIndex % 2,
                                                    AddWhitespace(pref.Key),
                                                    null,
                                                    new Action <float>((amount) =>
                {
                    int currentVal = MelonPrefs.GetInt(category.Key, pref.Key);
                    int increment  = (int)amount * rangesInt.step;
                    int newVal     = currentVal + increment;
                    if (newVal > rangesInt.max)
                    {
                        MelonPrefs.SetInt(category.Key, pref.Key, rangesInt.max);
                    }
                    else if (newVal < rangesInt.min)
                    {
                        MelonPrefs.SetInt(category.Key, pref.Key, rangesInt.min);
                    }
                    else
                    {
                        MelonPrefs.SetInt(category.Key, pref.Key, newVal);
                    }
                }),
                                                    new Func <float>(() => { return((float)MelonPrefs.GetInt(category.Key, pref.Key)); }),
                                                    new Action(() => { MelonPrefs.SetFloat(category.Key, pref.Key, rangesInt.prefDefault); }),
                                                    RemoveTags(pref.Value.DisplayText),
                                                    new Func <float, string>((amount) => { return(amount.ToString()); }));
                buttonIndex++;
                row.Add(intSlider.gameObject);
                break;

            case MelonPrefs.MelonPreferenceType.BOOL:
                var checkbox = modMenuOM.AddButton(buttonIndex % 2,
                                                   AddWhitespace(pref.Key),
                                                   new Action(() =>
                {
                    bool currentVal = MelonPrefs.GetBool(category.Key, pref.Key);
                    MelonPrefs.SetBool(category.Key, pref.Key, !currentVal);
                }),
                                                   new Func <bool>(() => { return(MelonPrefs.GetBool(category.Key, pref.Key)); }),
                                                   pref.Value.DisplayText);

                row.Add(checkbox.gameObject);
                buttonIndex++;
                break;

            case MelonPrefs.MelonPreferenceType.FLOAT:
                MinMaxStepDefault rangesFloat = ParseMinMaxStep(pref.Value.DisplayText);
                if (rangesFloat.Equals(default(MinMaxStepDefault)))
                {
                    break;
                }
                var customSpecifier = GetFormatSpecifier(pref.Value.DisplayText);
                if (customSpecifier == "")
                {
                    customSpecifier = "N2";                            //Default to N2 if specifier is missing
                }
                var floatSlider = modMenuOM.AddSlider(buttonIndex % 2,
                                                      AddWhitespace(pref.Key),
                                                      "N2",
                                                      new Action <float>((amount) =>
                {
                    float currentVal = MelonPrefs.GetFloat(category.Key, pref.Key);
                    float increment  = rangesFloat.step * amount;        //(amount * Mathf.Floor(currentVal * 10f));
                    float newVal     = currentVal + increment;
                    if (newVal > rangesFloat.max)
                    {
                        MelonPrefs.SetFloat(category.Key, pref.Key, rangesFloat.max);
                    }
                    else if (newVal < rangesFloat.min)
                    {
                        MelonPrefs.SetFloat(category.Key, pref.Key, rangesFloat.min);
                    }
                    else
                    {
                        MelonPrefs.SetFloat(category.Key, pref.Key, currentVal + increment);
                    }
                }),
                                                      new Func <float>(() => { return(MelonPrefs.GetFloat(category.Key, pref.Key)); }),
                                                      new Action(() => { MelonPrefs.SetFloat(category.Key, pref.Key, rangesFloat.prefDefault); }),
                                                      RemoveTags(pref.Value.DisplayText),
                                                      new Func <float, string>((amount) => { return(amount.ToString(customSpecifier)); }));
                row.Add(floatSlider.gameObject);
                buttonIndex++;
                break;

            case MelonPrefs.MelonPreferenceType.STRING:

                if (pref.Value.DisplayText.ToLower().Contains("[header]"))
                {
                    if (row.Count == 1)
                    {
                        modMenuOM.scrollable.AddRow(row[0]);
                        row.Clear();
                    }
                    var header = modMenuOM.AddHeader(0, RemoveTags(pref.Value.DisplayText));
                    modMenuOM.scrollable.AddRow(header);
                    buttonIndex = 0;
                }
                break;

            default:
                break;
            }
            if (row.Count == 2)
            {
                //This is the dumbest code I've ever wrote.
                Il2CppGeneric.List <GameObject> tempRow = new Il2CppGeneric.List <GameObject>();
                tempRow.Add(row[0]);
                tempRow.Add(row[1]);
                modMenuOM.scrollable.AddRow(tempRow);
                row.Clear();
            }
            else if (buttonIndex == category.Value.Count && buttonIndex % 2 == 1) // This might be obsolete
            {
                modMenuOM.scrollable.AddRow(row[0]);
                row.Clear();
            }
        }
    }
Esempio n. 25
0
 public override bool CanUseZoomStateFrom(DisplayState displayStatePrev)
 {
     return false;
 }
Esempio n. 26
0
 private bool AlreadyInAskedState(DisplayState value)
 {
     return((DisplayState.Maximized == value && !WinPattern.Current.CanMaximize) ||
            (DisplayState.Minimized == value && !WinPattern.Current.CanMinimize));
 }
Esempio n. 27
0
 /// <summary>
 /// Returns unified display state, common for all supported platform.
 /// </summary>
 /// <param name="displayState">Platform depended display state.</param>
 /// <returns>Common for all supported platform display state.</returns>
 public static Model.Display.DisplayState DisplayStateMapper(DisplayState displayState)
 {
     return(DisplayStateDictionary[displayState]);
 }
Esempio n. 28
0
 public virtual void Focus(DisplayState displayState)
 {
     DisplayState = displayState;
     base.Focus();
 }
Esempio n. 29
0
        public void onLocationChanged(Device device)
        {
            PairableDevice pairableDevice = (PairableDevice)device;

            //Dispatch UI Changes to Main Thread
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                if (pairableDevice.Location.HasValue)
                {
                    if (iaDevice.SupportedRoutes.Contains(Routes.GetLocationRoute))
                    {
                        MyDisplayState = DisplayState.LocatedAndOnStackPanel;
                    }

                    Point newPoint = DrawingResources.ConvertFromMetersToDisplayCoordinates(pairableDevice.Location.Value, MainWindow.SharedCanvas);

                    // InnerBorder.Width / 2 is to make it so that the point that the DeviceControl is drawn at is actually the center of the Border
                    Canvas.SetLeft(this, newPoint.X - (InnerBorder.Width / 2));
                    Canvas.SetTop(this, newPoint.Y - (InnerBorder.Height / 2));
                }
                else if (iaDevice.SupportedRoutes.Contains(Routes.GetLocationRoute))
                {
                    MyDisplayState = DisplayState.UnlocatedAndOnStackPanel;
                }
            }));
        }
Esempio n. 30
0
        public int ExUpdate(float ctime, float bp, DisplayState dstate, NoteType noteType, float slideScale, bool releasesound, int sameTimingMarks)
        {
            NoteType   = noteType;
            SlideScale = slideScale;
            UpdateSameTimingMarks(sameTimingMarks);
            int ret = 0;

            if (noteType == NoteType.AC || (noteType == NoteType.ACFT && !IsScratch))
            {
                if (!Hidden && ctime - this.time >= -autowidth)
                {
                    ret = 1;
                }
                if (ctime - this.time >= -autowidth)
                {
                    Hidden = true;
                    return(ret);
                }
            }
            else
            {
                if (!Hidden && ctime - this.Time >= -autowidth && lasttime < this.Time && !played)
                {
                    ret    = 1;
                    played = true;
                }
            }
            lasttime = ctime;
            if (ctime - this.EndTime >= -autowidth)
            {
                Hidden = true;
                if (played && (releasesound || noteType == NoteType.ACFT) && ctime - this.EndTime >= -autowidth)
                {
                    ret = 1;
                }
                played = false;
                return(ret);
            }
            float scale = (float)bp / defaultbpm;

            if (this.Time - ctime <= 2 / scale)
            {
                if (dstate == DisplayState.Normal || dstate == DisplayState.Hidden)
                {
                    Hidden = false;
                }
            }
            else
            {
                Hidden = true;
            }
            if (this.Time - ctime <= 0.5f / scale)
            {
                Hidden &= dstate != DisplayState.Sudden;
            }
            if (this.Time - ctime <= 0.25f / scale)
            {
                if (dstate == DisplayState.Hidden)
                {
                    Hidden = true;
                }
            }
            Hidden &= this.Time - ctime > 0;
            if (this.EndTime - ctime <= 0.25f / scale)
            {
                if (dstate == DisplayState.Hidden)
                {
                    Hidden = true;
                }
            }
            if (ctime <= this.Time)
            {
                markc.Position = CalcurateMarkCPosition(Position, markc, this.time, ctime, scale, m);
            }
            else
            {
                markc.Position = new Vector2(x - markc.Width / 2, y - markc.Height / 2);
            }
            if (exMarksc != null)
            {
                for (int i = 0; i < exMarksc.Length; i++)
                {
                    var markTime = this.time + ExFrameSec / slideScale * (i + 1);
                    exMarksc[i].Position = CalcurateMarkCPosition(exMarks[i].Position,
                                                                  exMarksc[i], markTime, ctime, scale);
                    exMarksc[i].Hidden = exMarks[i].Hidden = ctime >= markTime;
                }
                mark.Hidden = markc.Hidden = ctime >= time;
            }


            jiku.Rotation = -1 * (float)Math.PI * (this.Time - ctime) * scale;
            if (jiku.Rotation >= 0)
            {
                jiku.Rotation = 0;
            }
            outjiku.Rotation = -2 * (float)Math.PI * (this.Time - ctime) / Length;

            return(ret);
        }
Esempio n. 31
0
        protected void UpdateDisplayState(DisplayState state)
        {
            decimal auditid = 0;

            try
            {
                auditid = Convert.ToDecimal(SessionManager.ReturnRecordID);
            }
            catch
            {
                auditid = 0;
            }

            switch (state)
            {
            case DisplayState.AuditList:
                SearchAudits();
                uclAssessmentForm.Visible = false;
                //rbNew.Visible = true;
                break;

            case DisplayState.AuditNotificationNew:
                //divAuditList.Visible = false;
                //uclAssessmentForm.Visible = true;
                //uclAssessmentForm.IsEditContext = false;
                //uclAssessmentForm.ClearControls();
                ////rbNew.Visible = false;
                //uclAssessmentForm.CheckForSingleType();
                SessionManager.ClearReturns();
                SessionManager.ReturnRecordID = 0;
                SessionManager.ReturnStatus   = true;
                SessionManager.ReturnObject   = state;
                Response.Redirect("/EHS/EHS_AssessmentForm.aspx");
                break;

            case DisplayState.AuditNotificationEdit:
                //divAuditList.Visible = false;
                //uclAssessmentForm.CurrentStep = 0;
                //uclAssessmentForm.IsEditContext = true;
                //uclAssessmentForm.Visible = true;
                ////rbNew.Visible = false;
                //uclAssessmentForm.BuildForm(); // we already built the form
                SessionManager.ClearReturns();
                SessionManager.ReturnRecordID = auditid;
                SessionManager.ReturnStatus   = true;
                SessionManager.ReturnObject   = state;
                Response.Redirect("/EHS/EHS_AssessmentForm.aspx");
                break;

            case DisplayState.AuditNotificationDisplay:
            case DisplayState.AuditNotificationClosed:
                //divAuditList.Visible = false;
                //uclAssessmentForm.CurrentStep = 1;
                //uclAssessmentForm.IsEditContext = false;
                ////rbNew.Visible = false;
                //uclAssessmentForm.Visible = true;
                ////uclAuditForm.BuildForm();
                SessionManager.ClearReturns();
                SessionManager.ReturnRecordID = auditid;
                SessionManager.ReturnStatus   = true;
                SessionManager.ReturnObject   = state;
                Response.Redirect("/EHS/EHS_AssessmentForm.aspx");
                break;
            }

            // for now, we will only let 'admin' create audits
            //if (!SessionManager.UserContext.Person.SSO_ID.ToLower().Equals("admin"))
            //	rbNew.Visible = false;

            SessionManager.ClearReturns();
        }
Esempio n. 32
0
 public NormalExMark(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, MarkImagePathsBase filenames, ExMarkData emd, ButtonType type, float[] eval,
                     float gap, Vector2[] circlepoints, DisplayState dState, NoteType noteType, int sameTimingMarks, KeyValuePair <string, string>[] parameters, PostDrawManager postDrawManager)
     : base(device, resourceManager, filenames, emd, type, eval, gap, dState, noteType, sameTimingMarks, parameters, postDrawManager)
 {
     this.circlePoints = circlepoints;
 }
Esempio n. 33
0
 private void ShowDisplay(DisplayState state)
 {
     switch (state)
     {
         case DisplayState.Intro:
             IntroPanel.Visibility = Visibility.Visible;
             ProcessingPanel.Visibility = Visibility.Collapsed;
             FinishedPanel.Visibility = Visibility.Collapsed;
             EnableApplicationBar(true);
             break;
         case DisplayState.Processing:
             ProcessingPanel.Visibility = Visibility.Visible;
             IntroPanel.Visibility = Visibility.Collapsed;
             FinishedPanel.Visibility = Visibility.Collapsed;
             EnableApplicationBar(false);
             break;
         case DisplayState.Finished:
             ProcessingPanel.Visibility = Visibility.Collapsed;
             IntroPanel.Visibility = Visibility.Collapsed;
             FinishedPanel.Visibility = Visibility.Visible;
             EnableApplicationBar(true);
             break;
         default:
             throw new ArgumentOutOfRangeException("state");
     }
 }
Esempio n. 34
0
 /// <summary>
 /// Sets the tab to be collapsed or expanded
 /// </summary>
 /// <remarks>This method does not work with Microsoft Dynamics CRM for tablets because tabs cannot be collapsed</remarks>
 public void SetDisplayState(DisplayState state)
 {
 }
        /// <summary>
        /// Sets the display state for the control.
        /// </summary>
        private void SetDisplayState(DisplayState state)
        {
            m_state = state;

            switch (m_state)
            {
                case DisplayState.EditItems:
                {
                    SamplingIntervalCH.Visible = true;
                    QueueSizeCH.Visible = true;
                    DiscardOldestCH.Visible = true;
                    FilterCH.Visible = true;
                    OperationStatusCH.Visible = false;
                    DataTypeCH.Visible = false;
                    ValueCH.Visible = false;
                    StatusCodeCH.Visible = false;
                    SourceTimestampCH.Visible = false;
                    ServerTimestampCH.Visible = false;
                    break;
                }

                case DisplayState.ApplyChanges:
                {
                    SamplingIntervalCH.Visible = true;
                    QueueSizeCH.Visible = true;
                    DiscardOldestCH.Visible = true;
                    FilterCH.Visible = false;
                    OperationStatusCH.Visible = true;
                    DataTypeCH.Visible = false;
                    ValueCH.Visible = false;
                    StatusCodeCH.Visible = false;
                    SourceTimestampCH.Visible = false;
                    ServerTimestampCH.Visible = false;
                    break;
                }

                case DisplayState.ViewUpdates:
                {
                    SamplingIntervalCH.Visible = false;
                    QueueSizeCH.Visible = false;
                    DiscardOldestCH.Visible = false;
                    FilterCH.Visible = false;
                    OperationStatusCH.Visible = false;
                    DataTypeCH.Visible = true;
                    ValueCH.Visible = true;
                    StatusCodeCH.Visible = true;
                    SourceTimestampCH.Visible = true;
                    ServerTimestampCH.Visible = true;
                    break;
                }
            }
        }
Esempio n. 36
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            // 1つめのキーを押した状態の場合、KeyPressイベントで処理する
            if (firstKeyCode != Keys.None)
            {
                return;
            }

            // 認証済の場合のみ許可される操作
            if (oauth.IsAuthorized())
            {
                if (e.KeyCode == Keys.T)
                {
                    ActivateTweetTextBox();
                    KumaHodaiToolStripStatusLabel.Text = "T : ツイート";

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.R)
                {
                    KumaHodaiToolStripStatusLabel.Text = "R : 返信(宛先を指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    // これがないと、即座にKeyPressイベントが発生して、Rが選択されたことになってしまう?
                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.B)
                {
                    KumaHodaiToolStripStatusLabel.Text = "B : 人力Bot支援(宛先を指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.E)
                {
                    KumaHodaiToolStripStatusLabel.Text = "E : 引用(宛先を指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.W)
                {
                    KumaHodaiToolStripStatusLabel.Text = "W : リツイート(宛先を指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.Y)
                {
                    KumaHodaiToolStripStatusLabel.Text = "Y : お気に入りに追加(ツイートを指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.Q && randomTweetEnabled)
                {
                    ActivateTweetTextBox();

                    KumaHodaiToolStripStatusLabel.Text = "Q : ランダムツイート ";
                    TweetTextBox.Text = GetRandom();

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.K)
                {
                    ActivateTweetTextBox();

                    KumaHodaiToolStripStatusLabel.Text = "K : なるほどクマじゃねーの";
                    TweetTextBox.Text = "なるほどクマじゃねーの";

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.Oemtilde)
                {
                    KumaHodaiToolStripStatusLabel.Text = "@ : やりましょう(宛先を指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.OemPeriod) // ブラウザで開く
                {
                    KumaHodaiToolStripStatusLabel.Text = ". : ブラウザで開く(対象ツイートを指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.Oemcomma) // ブラウザで開く
                {
                    KumaHodaiToolStripStatusLabel.Text = ", : ツイートを表示(対象ツイートを指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.A) // home timeline
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        currentPageNumber = 1;
                        displayState = DisplayState.HomeTimeline;

                        allTweets = oauth.GetHomeTimeline();
                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();

                        e.SuppressKeyPress = true;
                    }
                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー: タイムラインの取得に失敗しました。";
                    }
                }
                else if (e.KeyCode == Keys.S) // mentions
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        currentPageNumber = 1;
                        displayState = DisplayState.Mentions;

                        allTweets = oauth.GetMentions();
                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();

                        e.SuppressKeyPress = true;
                    }
                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー: 返信の取得に失敗しました。";
                    }
                }
                else if (e.KeyCode == Keys.D) // direct messages
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        currentPageNumber = 1;
                        displayState = DisplayState.Favorites;

                        allTweets = oauth.GetFavorites();
                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();

                        e.SuppressKeyPress = true;
                    }
                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー: お気に入り一覧の取得に失敗しました。";
                    }
                }
                else if (e.KeyCode == Keys.F) // user timeline
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        currentPageNumber = 1;
                        displayState = DisplayState.MyTimeline;

                        allTweets = oauth.GetMyUserTimeline();
                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();

                        e.SuppressKeyPress = true;
                    }
                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "マイツイート一覧の取得に失敗しました。";
                    }
                }
                else if (e.KeyCode == Keys.G) // 指定ユーザのuser timeline
                {
                    KumaHodaiToolStripStatusLabel.Text = "G : ツイート一覧(ユーザを指定) " + SelectableCharacterString();
                    firstKeyCode = e.KeyCode;

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.X) // retweeted to me
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        currentPageNumber = 1;
                        displayState = DisplayState.RetweetedToMe;

                        allTweets = oauth.GetRetweetedToMe();
                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();

                        e.SuppressKeyPress = true;
                    }
                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー: リツイート一覧の取得に失敗しました。";
                    }
                }
                else if (e.KeyCode == Keys.C) // retweeted by me
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        currentPageNumber = 1;
                        displayState = DisplayState.RetweetedByMe;

                        allTweets = oauth.GetRetweetedByMe();
                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();

                        e.SuppressKeyPress = true;
                    }

                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー: リツイート一覧の取得に失敗しました。";
                    }
                }
                else if (e.KeyCode == Keys.V) // retweets of me
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        currentPageNumber = 1;
                        displayState = DisplayState.RetweetsOfMe;

                        allTweets = oauth.GetRetweetsOfMe();
                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();

                        e.SuppressKeyPress = true;
                    }

                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー: リツイート一覧の取得に失敗しました。";
                    }
                }
                else if (e.KeyCode >= Keys.D1 && e.KeyCode <= Keys.D9) // リスト
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        currentPageNumber = 1;
                        displayState = DisplayState.List;

                        int index = e.KeyCode - Keys.D1;
                        if (this.config.ListScreenNames[index] != "" && this.config.ListNames[index] != "")
                        {
                            allTweets = oauth.GetUserList(this.config.ListScreenNames[index], this.config.ListNames[index]);
                            nowOnDisplayTweets = GetPartialTweets();

                            currentDisplayList = (index + 1).ToString() + " : リスト " + this.config.ListScreenNames[index] + "/" + this.config.ListNames[index];
                            ReloadNowOnDisplay();
                        }
                        else
                        {
                            KumaHodaiToolStripStatusLabel.Text = (index+1).ToString() + " : リストが設定されていません。";
                        }
                        e.SuppressKeyPress = true;
                    }

                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー : リストの取得に失敗しました。";
                    }

                }
                else if (e.KeyCode == Keys.L) // next page
                {
                    if (currentPageNumber * tweetsPerPage < allTweets.Count)
                    {
                        currentPageNumber += 1;

                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();
                    }

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.H) // previous page
                {
                    if (currentPageNumber > 1)
                    {
                        currentPageNumber -= 1;

                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();
                    }

                    e.SuppressKeyPress = true;
                }
                else if (e.KeyCode == Keys.D0)
                {
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "API残数 : " + oauth.getRateLimitStatus();

                        e.SuppressKeyPress = true;
                    }
                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー: API残り回数の取得に失敗しました。";
                    }
                }
            }
            // 未認証状態でも出来る操作
            if (e.KeyCode == Keys.O)
            {
                KumaHodaiConfDialog dialog = new KumaHodaiConfDialog(oauth, config);
                DialogResult result = dialog.ShowDialog(this);

                e.SuppressKeyPress = true;
            }
            else if (e.KeyCode == Keys.Escape)
            {
                // ウィンドウを最小化する
                this.WindowState = FormWindowState.Minimized;
            }
            else if (e.KeyCode == Keys.Z)
            {
                KumaHodaiToolStripStatusLabel.Text = "Z : 終了しますか? [y/n]";
                firstKeyCode = e.KeyCode;
                e.SuppressKeyPress = true;
            }
        }
 public ViewModelState(DisplayState state, ErrorType error = ErrorType.None, bool isRefreshed = false)
 {
     Display     = state;
     Error       = error;
     IsRefreshed = isRefreshed;
 }
Esempio n. 38
0
 public void OnExited()
 {
     displayState = DisplayState.Exited;
     gameObject.SetActive(false);
 }
Esempio n. 39
0
        /// <summary>
        /// タイムライン自動更新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AutoRefreshTimer_Tick(object sender, EventArgs e)
        {
            switch (displayState)
            {
                case DisplayState.HomeTimeline:
                    try
                    {
                        KumaHodaiToolStripStatusLabel.Text = "取得中...";
                        System.Windows.Forms.Application.DoEvents();

                        // currentPageNumber = 1;
                        displayState = DisplayState.HomeTimeline;

                        allTweets = oauth.GetHomeTimeline();
                        nowOnDisplayTweets = GetPartialTweets();

                        ReloadNowOnDisplay();

                        KumaNotifyIcon.BalloonTipText = "";
                        if (allTweets.Count > 3)
                        {
                            for (int i = 0; i < 3; i++)
                            {
                                KumaNotifyIcon.BalloonTipTitle = "クマホーダイ: 新着ツイート";
                                KumaNotifyIcon.BalloonTipText += allTweets[i].ScreenName + ": " + allTweets[i].Text + "\n";
                                KumaNotifyIcon.BalloonTipIcon = ToolTipIcon.Info;
                                KumaNotifyIcon.ShowBalloonTip(10000);
                            }
                        }
                    }
                    catch
                    {
                        KumaHodaiToolStripStatusLabel.Text = "エラー: タイムラインの取得に失敗しました。";
                    }
                    break;
                default:
                    break;
            }
        }
 public ViewModelState(DisplayState state, bool isRefreshed)
     : this(state, ErrorType.None, isRefreshed)
 {
 }
Esempio n. 41
0
        /// <summary>
        /// KeyPressイベントでは、主に2つめのキー押下を処理する
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (firstKeyCode != Keys.None)
            {
                char key = e.KeyChar;
                int index = -1;

                if (firstKeyCode == Keys.Z)
                {
                    if (key == 'y')
                    {
                        this.Close();
                    }
                    else
                    {
                        KumaHodaiToolStripStatusLabel.Text = "";
                    }
                    firstKeyCode = Keys.None;
                    e.Handled = true;
                    return;
                }

                // 現在表示されているtweetsPerPage件以内の場合のみReply可能
                if (key >= 'a' && key <= ('a' + tweetsPerPage) && nowOnDisplayTweets != null && (index = (int)(key - 'a')) < nowOnDisplayTweets.Count)
                {
                    TwitterStatus status = nowOnDisplayTweets[index];

                    if (firstKeyCode == Keys.B)
                    {
                        ActivateTweetTextBox();

                        TweetTextBox.Text =  "@" + status.ScreenName + " " + GetRandom();
                        KumaHodaiToolStripStatusLabel.Text = "B : 人力Bot支援 " + status.ScreenName + ": " + status.Text;
                        inReplyToStatusId = status.StatusId;
                        TweetTextBox.SelectionStart = TweetTextBox.Text.Length;
                    }
                    else if (firstKeyCode == Keys.R)
                    {
                        ActivateTweetTextBox();

                        TweetTextBox.Text = "@" + status.ScreenName + " ";
                        KumaHodaiToolStripStatusLabel.Text = "R : 返信 " + status.ScreenName + ": " + status.Text;
                        inReplyToStatusId = status.StatusId;
                        TweetTextBox.SelectionStart = TweetTextBox.Text.Length;
                    }
                    else if (firstKeyCode == Keys.E)
                    {
                        ActivateTweetTextBox();

                        TweetTextBox.Text = " RT @" + status.ScreenName + ": " + status.Text;
                        KumaHodaiToolStripStatusLabel.Text = "E : 引用";
                        inReplyToStatusId = -1;
                        TweetTextBox.SelectionStart = 0;
                    }
                    else if (firstKeyCode == Keys.W)
                    {
                        oauth.RetweetStatus(status.StatusId);
                        KumaHodaiToolStripStatusLabel.Text = "リツイート完了しました。";
                    }
                    else if (firstKeyCode == Keys.Y)
                    {
                        oauth.CreateFavorites(status.StatusId);
                        KumaHodaiToolStripStatusLabel.Text = "お気に入りに追加完了しました。";
                    }
                    else if (firstKeyCode == Keys.G)
                    {
                        try
                        {
                            KumaHodaiToolStripStatusLabel.Text = "取得中...";
                            System.Windows.Forms.Application.DoEvents();

                            currentPageNumber = 1;
                            displayState = DisplayState.UserTimeline;

                            allTweets = oauth.GetUserTimeline(status.ScreenName);
                            nowOnDisplayTweets = GetPartialTweets();

                            currentDisplayScreenName = status.ScreenName;
                            ReloadNowOnDisplay();
                            // KumaHodaiToolStripStatusLabel.Text = "G : @" + status.ScreenName + " のツイート一覧";

                            e.Handled = true;
                        }
                        catch
                        {
                            KumaHodaiToolStripStatusLabel.Text = "エラー: ツイート一覧の取得に失敗しました。";
                        }
                    }
                    else if (firstKeyCode == Keys.OemPeriod)
                    {
                        System.Diagnostics.Process.Start(status.GetStatusUrl());
                    }
                    else if (firstKeyCode == Keys.Oemcomma)
                    {
                        try
                        {
                            KumaHodaiToolStripStatusLabel.Text = "取得中...";
                            System.Windows.Forms.Application.DoEvents();

                            currentPageNumber = 1;
                            displayState = DisplayState.ReplySequence;

                            allTweets = oauth.GetReplySequence(status.StatusId);
                            nowOnDisplayTweets = GetPartialTweets();

                            currentDisplayScreenName = status.ScreenName;
                            ReloadNowOnDisplay();

                            e.Handled = true;
                        }
                        catch
                        {
                            KumaHodaiToolStripStatusLabel.Text = "エラー: ツイートの取得に失敗しました。";
                        }
                    }
                    else if (firstKeyCode == Keys.Oemtilde)
                    {
                        ActivateTweetTextBox();

                        TweetTextBox.Text = "やりましょう。 RT @" + status.ScreenName + ": " + status.Text;
                        KumaHodaiToolStripStatusLabel.Text = "@ : やりましょう";
                        inReplyToStatusId = -1;
                        TweetTextBox.SelectionStart = 0;
                    }

                    e.Handled = true;
                }
                else
                {
                    KumaHodaiToolStripStatusLabel.Text = "";
                }

                firstKeyCode = Keys.None;
            }
        }
Esempio n. 42
0
 public GraphHelper(MSGraphControl msGraphControl)
 {
     GraphControl = msGraphControl;
     _displayState = new ErrorDisplayState();
 }
Esempio n. 43
0
 public virtual void Focus(DisplayState displayState)
 {
     DisplayState = displayState;
     base.Focus();
 }
Esempio n. 44
0
 private void SetDisplayState(DisplayState newDisplayState)
 {
     if (_zoomLocked && _displayState.GetType() == newDisplayState.GetType())
     {
         foreach (var pane in GraphControl.MasterPane.PaneList)
         {
             pane.CurveList.Clear();
             pane.GraphObjList.Clear();
         }
         _displayState.ZoomStateValid = true;
         return;
     }
     while (GraphControl.MasterPane.PaneList.Count > 1)
     {
         // Remove all but the first graph pane so that the zoom state stack is preserved.
         GraphControl.MasterPane.PaneList.RemoveRange(1, GraphControl.MasterPane.PaneList.Count - 1);
         using (var graphics = GraphControl.CreateGraphics())
         {
             GraphControl.MasterPane.SetLayout(graphics, PaneLayout.SingleColumn);
         }
     }
     GraphControl.GraphPane.CurveList.Clear();
     GraphControl.GraphPane.GraphObjList.Clear();
     newDisplayState.ZoomStateValid = newDisplayState.CanUseZoomStateFrom(_displayState);
     newDisplayState.ApplySettingsToGraphPane(GraphControl.GraphPane);
     _displayState = newDisplayState;
 }
Esempio n. 45
0
 public override bool CanUseZoomStateFrom(DisplayState displayStatePrev)
 {
     var prevChromDisplayState = displayStatePrev as ChromDisplayState;
     if (null != prevChromDisplayState)
     {
         if (Equals(AutoZoomChrom, prevChromDisplayState.AutoZoomChrom) &&
             Equals(MinIntensity, prevChromDisplayState.MinIntensity) &&
             Equals(MaxIntensity, prevChromDisplayState.MaxIntensity) &&
             Equals(TimeRange, prevChromDisplayState.TimeRange) &&
             Equals(PeakRelativeTime, prevChromDisplayState.PeakRelativeTime) &&
             _proteinSelected == prevChromDisplayState._proteinSelected)
         {
             return ArrayUtil.ReferencesEqual(TransitionGroups, prevChromDisplayState.TransitionGroups);
         }
     }
     return false;
 }
Esempio n. 46
0
 public DisplayStateMessage(DisplayHook sender, DisplayState state) : base(sender)
 {
     State = state;
 }