コード例 #1
0
		private BusinessObjects()
		{
			ScheduleManager = new ScheduleManager();
			HelpManager = new HelpManager();
			OutputManager = new OutputManager();
			ThemeManager = new ThemeManager();
		}
コード例 #2
0
 public SingleDepthNavigator(INodeService nodeService, ThemeManager themeManagementObject, Guid domainId)
     : this()
 {
     DomainId = domainId;
     NodeService = nodeService;
     NodeService.GetRelatedNodesByIdCompleted += new EventHandler<ReturnedNodesEventArgs>(OnGetRelatedNodesByIdCompleted);
     ThemeManagementObject = themeManagementObject;
 }
コード例 #3
0
 public MapDepthNavigator(INodeService nodeService, ThemeManager themeManagementObject, Guid domainId)
     : this()
 {
     DomainId = domainId;
     NodeService = nodeService;
     NodeService.GetMapsNodesCompleted += new EventHandler<ReturnedNodesEventArgs>(OnGetMapsNodesCompletedNodeArgs);
     NodeService.AddNodeCompleted += new EventHandler<AddedNodeEventArgs>(OnAddNodeCompletedNodeArgs);
     NodeService.PasteNodeCloneCompleted += new EventHandler<AddedNodeEventArgs>(OnPasteNodeCloneCompletedNodeArgs);
     NodeService.UpdateNodeMetadataCompleted += new EventHandler<ReturnedNodesEventArgs>(OnUpdateNodeMetadataCompletedNodeArgs);
     NodeService.ConnectNodesCompleted += new EventHandler<ConnectedNodesEventArgs>(OnConnectNodesCompletedNodeArgs);
     NodeService.DeleteNodeCompleted += new EventHandler<DeleteEventArgs>(OnDeleteNodeCompletedNodeArgs);
     NodeService.DeleteRelationshipCompleted += new EventHandler<DeleteEventArgs>(OnDeleteRelationshipCompleted);
     ThemeManagementObject = themeManagementObject;
 }
コード例 #4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                if (MainV2.joystick == null || MainV2.joystick.enabled == false)
                {
                    //Console.WriteLine(DateTime.Now.Millisecond + " start ");
                    Joystick joy = MainV2.joystick;
                    if (joy == null)
                    {
                        joy = new Joystick(() => MainV2.comPort);
                        for (int a = 1; a <= maxaxis; a++)
                        {
                            var config = joy.getChannel(a);

                            joy.setChannel(a, config.axis, config.reverse, config.expo);
                        }

                        joy.elevons = CHK_elevons.Checked;

                        joy.AcquireJoystick(CMB_joysticks.Text);

                        joy.name = CMB_joysticks.Text;

                        noButtons = joy.getNumButtons();

                        noButtons = Math.Min(16, noButtons);

                        SuspendLayout();

                        MainV2.joystick = joy;

                        var maxctl = Controls.Find("axis" + 1, false).FirstOrDefault();

                        for (int f = 0; f < noButtons; f++)
                        {
                            string name = (f).ToString();

                            doButtontoUI(name, maxctl.Right + 100, maxctl.Top + f * maxctl.Height);

                            var config = joy.getButton(f);

                            joy.setButton(f, config);
                        }

                        ResumeLayout();

                        ThemeManager.ApplyThemeTo(this);

                        CMB_joysticks.SelectedIndex = CMB_joysticks.Items.IndexOf(joy.name);
                    }

                    MainV2.joystick.elevons = CHK_elevons.Checked;

                    MainV2.comPort.MAV.cs.rcoverridech1  = joy.getValueForChannel(1, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech2  = joy.getValueForChannel(2, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech3  = joy.getValueForChannel(3, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech4  = joy.getValueForChannel(4, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech5  = joy.getValueForChannel(5, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech6  = joy.getValueForChannel(6, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech7  = joy.getValueForChannel(7, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech8  = joy.getValueForChannel(8, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech9  = joy.getValueForChannel(9, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech10 = joy.getValueForChannel(10, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech11 = joy.getValueForChannel(11, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech12 = joy.getValueForChannel(12, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech13 = joy.getValueForChannel(13, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech14 = joy.getValueForChannel(14, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech15 = joy.getValueForChannel(15, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech16 = joy.getValueForChannel(16, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech17 = joy.getValueForChannel(17, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech18 = joy.getValueForChannel(18, CMB_joysticks.Text);

                    //Console.WriteLine(DateTime.Now.Millisecond + " end ");
                }
            }
            catch (SharpDX.SharpDXException ex)
            {
                ex.ToString();
                if (MainV2.joystick != null && MainV2.joystick.enabled == true)
                {
                    BUT_enable_Click(null, null);
                }

                if (ex.Message.Contains("DIERR_NOTACQUIRED"))
                {
                    MainV2.joystick = null;
                }
            }
            catch
            {
            }

            try
            {
                for (int f = 0; f < noButtons; f++)
                {
                    string name = (f).ToString();

                    var items = this.Controls.Find("hbar" + name, false);

                    if (items.Length > 0)
                    {
                        ((HorizontalProgressBar)items[0]).Value =
                            MainV2.joystick.isButtonPressed(f) ? 100 : 0;
                    }
                }
            }
            catch
            {
            } // this is for buttons - silent fail
        }
コード例 #5
0
 void Validate()
 {
     instance = this;
 }
コード例 #6
0
ファイル: JoystickSetup.cs プロジェクト: jhp0303/BuildPlanner
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                if (MainV2.joystick == null || MainV2.joystick.enabled == false)
                {
                    //Console.WriteLine(DateTime.Now.Millisecond + " start ");
                    Joystick joy = MainV2.joystick;
                    if (joy == null)
                    {
                        joy = new Joystick(() => MainV2.comPort);
                        if (CMB_CH1.Text != "")
                        {
                            joy.setChannel(1,
                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), CMB_CH1.Text),
                                           revCH1.Checked, int.Parse(expo_ch1.Text));
                        }
                        if (CMB_CH2.Text != "")
                        {
                            joy.setChannel(2,
                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), CMB_CH2.Text),
                                           revCH2.Checked, int.Parse(expo_ch2.Text));
                        }
                        if (CMB_CH3.Text != "")
                        {
                            joy.setChannel(3,
                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), CMB_CH3.Text),
                                           revCH3.Checked, int.Parse(expo_ch3.Text));
                        }
                        if (CMB_CH4.Text != "")
                        {
                            joy.setChannel(4,
                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), CMB_CH4.Text),
                                           revCH4.Checked, int.Parse(expo_ch4.Text));
                        }
                        if (CMB_CH5.Text != "")
                        {
                            joy.setChannel(5,
                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), CMB_CH5.Text),
                                           revCH5.Checked, int.Parse(expo_ch5.Text));
                        }
                        if (CMB_CH6.Text != "")
                        {
                            joy.setChannel(6,
                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), CMB_CH6.Text),
                                           revCH6.Checked, int.Parse(expo_ch6.Text));
                        }
                        if (CMB_CH7.Text != "")
                        {
                            joy.setChannel(7,
                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), CMB_CH7.Text),
                                           revCH7.Checked, int.Parse(expo_ch7.Text));
                        }
                        if (CMB_CH8.Text != "")
                        {
                            joy.setChannel(8,
                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), CMB_CH8.Text),
                                           revCH8.Checked, int.Parse(expo_ch8.Text));
                        }

                        joy.setChannel(9, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(10, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(11, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(12, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(13, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(14, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(15, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(16, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(17, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);
                        joy.setChannel(18, (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), "None"), false, 0);

                        joy.elevons = CHK_elevons.Checked;

                        joy.AcquireJoystick(CMB_joysticks.Text);

                        joy.name = CMB_joysticks.Text;

                        noButtons = joy.getNumButtons();

                        noButtons = Math.Min(15, noButtons);

                        SuspendLayout();

                        MainV2.joystick = joy;

                        for (int f = 0; f < noButtons; f++)
                        {
                            string name = (f).ToString();

                            doButtontoUI(name, 10, CMB_CH8.Bottom + 20 + f * 25);

                            var config = joy.getButton(f);

                            joy.setButton(f, config);
                        }

                        ResumeLayout();

                        ThemeManager.ApplyThemeTo(this);

                        CMB_joysticks.SelectedIndex = CMB_joysticks.Items.IndexOf(joy.name);
                    }

                    MainV2.joystick.elevons = CHK_elevons.Checked;

                    MainV2.comPort.MAV.cs.rcoverridech1  = joy.getValueForChannel(1, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech2  = joy.getValueForChannel(2, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech3  = joy.getValueForChannel(3, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech4  = joy.getValueForChannel(4, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech5  = joy.getValueForChannel(5, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech6  = joy.getValueForChannel(6, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech7  = joy.getValueForChannel(7, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech8  = joy.getValueForChannel(8, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech9  = joy.getValueForChannel(9, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech10 = joy.getValueForChannel(10, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech11 = joy.getValueForChannel(11, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech12 = joy.getValueForChannel(12, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech13 = joy.getValueForChannel(13, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech14 = joy.getValueForChannel(14, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech15 = joy.getValueForChannel(15, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech16 = joy.getValueForChannel(16, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech17 = joy.getValueForChannel(17, CMB_joysticks.Text);
                    MainV2.comPort.MAV.cs.rcoverridech18 = joy.getValueForChannel(18, CMB_joysticks.Text);

                    //Console.WriteLine(DateTime.Now.Millisecond + " end ");
                }
            }
            catch (SharpDX.SharpDXException ex)
            {
                ex.ToString();
                if (MainV2.joystick != null && MainV2.joystick.enabled == true)
                {
                    BUT_enable_Click(null, null);
                }

                if (ex.Message.Contains("DIERR_NOTACQUIRED"))
                {
                    MainV2.joystick = null;
                }
            }
            catch
            {
            }

            progressBarRoll.Value     = MainV2.comPort.MAV.cs.rcoverridech1;
            progressBarPith.Value     = MainV2.comPort.MAV.cs.rcoverridech2;
            progressBarThrottle.Value = MainV2.comPort.MAV.cs.rcoverridech3;
            progressBarRudder.Value   = MainV2.comPort.MAV.cs.rcoverridech4;
            ProgressBarCH5.Value      = MainV2.comPort.MAV.cs.rcoverridech5;
            ProgressBarCH6.Value      = MainV2.comPort.MAV.cs.rcoverridech6;
            ProgressBarCH7.Value      = MainV2.comPort.MAV.cs.rcoverridech7;
            ProgressBarCH8.Value      = MainV2.comPort.MAV.cs.rcoverridech8;

            try
            {
                if (MainV2.joystick != null)
                {
                    progressBarRoll.maxline     = MainV2.joystick.getRawValueForChannel(1);
                    progressBarPith.maxline     = MainV2.joystick.getRawValueForChannel(2);
                    progressBarThrottle.maxline = MainV2.joystick.getRawValueForChannel(3);
                    progressBarRudder.maxline   = MainV2.joystick.getRawValueForChannel(4);
                    ProgressBarCH5.maxline      = MainV2.joystick.getRawValueForChannel(5);
                    ProgressBarCH6.maxline      = MainV2.joystick.getRawValueForChannel(6);
                    ProgressBarCH7.maxline      = MainV2.joystick.getRawValueForChannel(7);
                    ProgressBarCH8.maxline      = MainV2.joystick.getRawValueForChannel(8);
                }
            }
            catch
            {
                //Exception Error in the application. -2147024866 (DIERR_INPUTLOST)
            }

            try
            {
                for (int f = 0; f < noButtons; f++)
                {
                    string name = (f).ToString();

                    var items = this.Controls.Find("hbar" + name, false);

                    if (items.Length > 0)
                    {
                        ((HorizontalProgressBar)items[0]).Value =
                            MainV2.joystick.isButtonPressed(f) ? 100 : 0;
                    }
                }
            }
            catch
            {
            } // this is for buttons - silent fail
        }
コード例 #7
0
        public static void Show()
        {
            var l1 = "Your board has a Critical service bulletin";
            var l2 = "To send us a report about your board, and to find out about this safety issue. Click bellow";

            Form frm = new Form()
            {
                Width = 250, Height = 250, AutoSize = true
            };
            FlowLayoutPanel flp = new FlowLayoutPanel()
            {
                Dock = DockStyle.Fill, FlowDirection = FlowDirection.TopDown
            };
            Label lb1 = new Label()
            {
                Text = l1, AutoSize = true
            };
            Label link = new Label()
            {
                Text = l2, AutoSize = true
            };


            Label nameLabel = new Label()
            {
                Text = "Enter your name (optional): ", AutoSize = true
            };
            TextBox nameTextBox = new TextBox()
            {
                Width = TextRenderer.MeasureText("thisismyname andmysurname", frm.Font).Width
            };
            Label emailLabel = new Label()
            {
                Text = "Enter your email (optional): ", AutoSize = true
            };
            TextBox emailTextBox = new TextBox()
            {
                Width = TextRenderer.MeasureText("*****@*****.**", frm.Font).Width
            };
            MyButton submitButton = new MyButton()
            {
                Text = "Service Bulletin"
            };

            frm.Controls.Add(flp);

            flp.Controls.Add(lb1);

            flp.Controls.Add(nameLabel);
            flp.Controls.Add(nameTextBox);
            flp.Controls.Add(emailLabel);
            flp.Controls.Add(emailTextBox);

            flp.Controls.Add(link);

            flp.Controls.Add(submitButton);

            submitButton.Click += (sender, args) =>
            {
                var url = String.Format(
                    "https://discuss.cubepilot.org:444/CubeSB?BRD_TYPE={0}&SerialNo={1}&INS_ACC_ID={2}&INS_ACC2_ID={3}&INS_ACC3_ID={4}&INS_GYR_ID={5}&INS_GYR2_ID={6}&INS_GYR3_ID={7}&Baro1={8}&Baro2={9}&Name={10}&Email={11}",
                    MainV2.comPort.MAV.param["BRD_TYPE"], MainV2.comPort.MAV.SerialString,
                    MainV2.comPort.MAV.param["INS_ACC_ID"], MainV2.comPort.MAV.param["INS_ACC2_ID"],
                    MainV2.comPort.MAV.param["INS_ACC3_ID"],
                    MainV2.comPort.MAV.param["INS_GYR_ID"], MainV2.comPort.MAV.param["INS_GYR2_ID"],
                    MainV2.comPort.MAV.param["INS_GYR3_ID"],
                    MainV2.comPort.MAV.cs.press_abs, MainV2.comPort.MAV.cs.press_abs2, nameTextBox.Text,
                    emailTextBox.Text);

                System.Diagnostics.Process.Start(url);
            };

            ThemeManager.ApplyThemeTo(frm);

            frm.Show();
        }
コード例 #8
0
        internal static void LoadContentForModExtensionListener(OSLoadContentEvent e)
        {
            if (Extension.Handler.ActiveInfo == null)
            {
                return;
            }
            e.IsCancelled = true;
            var os = e.OS;

            if (os.canRunContent)
            {
                // setup for proper game function
                Settings.slowOSStartup     = false;
                Settings.initShowsTutorial = false;
                os.initShowsTutorial       = false;
                // replacing OS.LoadContent
                os.delayer = new ActionDelayer();
                ComputerLoader.init(os);
                os.content  = e.OS.ScreenManager.Game.Content;
                os.username = (os.SaveUserAccountName ?? (Settings.isConventionDemo ? Settings.ConventionLoginName : Environment.UserName));
                os.username = FileSanitiser.purifyStringForDisplay(os.username);
                var compLocation = new V2(0.1f, 0.5f);
                if (os.multiplayer && !os.isServer)
                {
                    compLocation = new V2(0.8f, 0.8f);
                }
                os.ramAvaliable         = os.totalRam;
                os.thisComputer         = new Computer(os.username + " PC", Utility.GenerateRandomIP(), compLocation, 5, 4, os);
                os.thisComputer.adminIP = os.thisComputer.ip;
                os.thisComputer.idName  = "playerComp";
                os.thisComputer.Memory  = new MemoryContents();
                os.GibsonIP             = Utility.GenerateRandomIP();
                UserDetail value = os.thisComputer.users[0];
                value.known = true;
                os.thisComputer.users[0] = value;
                os.defaultUser           = new UserDetail(os.username, "password", 1)
                {
                    known = true
                };
                ThemeManager.setThemeOnComputer(os.thisComputer, OSTheme.HacknetBlue);
                if (os.multiplayer)
                {
                    os.thisComputer.addMultiplayerTargetFile();
                    os.sendMessage("newComp #" + os.thisComputer.ip + "#" + compLocation.X +
                                   "#" + compLocation.Y + "#" + 5 + "#" + os.thisComputer.name);
                    os.multiplayerMissionLoaded = false;
                }
                if (!OS.WillLoadSave)
                {
                    People.init();
                }
                os.modules  = new List <Module>();
                os.exes     = new List <ExeModule>();
                os.shells   = new List <ShellExe>();
                os.shellIPs = new List <string>();
                Viewport viewport = os.ScreenManager.GraphicsDevice.Viewport;
                int      num2     = 205;
                var      num3     = (int)((viewport.Width - RamModule.MODULE_WIDTH - 6) * 0.44420000000000004);
                var      num4     = (int)((viewport.Width - RamModule.MODULE_WIDTH - 6) * 0.5558);
                int      height   = viewport.Height - num2 - OS.TOP_BAR_HEIGHT - 6;
                os.terminal = new Terminal(new Rect(viewport.Width - 2 - num3,
                                                    OS.TOP_BAR_HEIGHT,
                                                    num3,
                                                    viewport.Height - OS.TOP_BAR_HEIGHT - 2), os)
                {
                    name = "TERMINAL"
                };
                os.modules.Add(os.terminal);
                os.netMap = new NetworkMap(new Rect(RamModule.MODULE_WIDTH + 4,
                                                    viewport.Height - num2 - 2,
                                                    num4 - 1,
                                                    num2), os)
                {
                    name = "netMap v1.7"
                };
                os.modules.Add(os.netMap);
                os.display = new DisplayModule(new Rect(RamModule.MODULE_WIDTH + 4,
                                                        OS.TOP_BAR_HEIGHT,
                                                        num4 - 2,
                                                        height), os)
                {
                    name = "DISPLAY"
                };
                os.modules.Add(os.display);
                os.ram = new RamModule(new Rect(2,
                                                OS.TOP_BAR_HEIGHT,
                                                RamModule.MODULE_WIDTH,
                                                os.ramAvaliable + RamModule.contentStartOffset), os)
                {
                    name = "RAM"
                };
                os.modules.Add(os.ram);
                foreach (var m in os.modules.ToArray())
                {
                    m.LoadContent();
                }
                if (os.allFactions == null)
                {
                    os.allFactions = new AllFactions();
                    os.allFactions.init();
                }
                bool flag = false;
                if (!OS.WillLoadSave)
                {
                    os.netMap.nodes.Insert(0, os.thisComputer);
                    os.netMap.visibleNodes.Add(0);
                    MusicManager.loadAsCurrentSong(os.IsDLCConventionDemo ? "Music\\out_run_the_wolves" : "Music\\Revolve");
                    os.LanguageCreatedIn = Settings.ActiveLocale;
                }
                else
                {
                    os.loadSaveFile();
                    flag = true;
                    Settings.initShowsTutorial = false;
                    SaveFixHacks.FixSavesWithTerribleHacks(os);
                }
                var computer = new Computer("JMail Email Server", Utility.GenerateRandomIP(), new V2(0.8f, 0.2f), 6, 1, os)
                {
                    idName = "jmail"
                };
                computer.daemons.Add(new MailServer(computer, "JMail", os));
                MailServer.shouldGenerateJunk = false;
                computer.users.Add(new UserDetail(os.defaultUser.name, "mailpassword", 2));
                computer.initDaemons();
                os.netMap.nodes.Add(computer);
                os.netMap.mailServer = computer;
                os.topBar            = new Rect(0, 0, viewport.Width, OS.TOP_BAR_HEIGHT - 1);
                os.crashModule       = new CrashModule(new Rect(0, 0, os.ScreenManager.GraphicsDevice.Viewport.Width, os.ScreenManager.GraphicsDevice.Viewport.Height), os);
                os.crashModule.LoadContent();
                Settings.IsInExtensionMode = false; // little hack to prevent intro text module ctor from throwing nullref
                os.introTextModule         = new IntroTextModule(new Rect(0, 0, os.ScreenManager.GraphicsDevice.Viewport.Width, os.ScreenManager.GraphicsDevice.Viewport.Height), os)
                {
                    complete = true,
                    text     = new string[] { "" }
                };
                os.introTextModule.LoadContent();
                Settings.IsInExtensionMode = true; // hack end
                os.traceTracker            = new TraceTracker(os);
                os.IncConnectionOverlay    = new IncomingConnectionOverlay(os);
                os.scanLines           = os.content.Load <Texture2D>("ScanLines");
                os.cross               = os.content.Load <Texture2D>("Cross");
                os.cog                 = os.content.Load <Texture2D>("Cog");
                os.saveIcon            = os.content.Load <Texture2D>("SaveIcon");
                os.beepSound           = os.content.Load <SoundEffect>("SFX/beep");
                os.mailicon            = new MailIcon(os, new V2(0f, 0f));
                os.mailicon.pos.X      = viewport.Width - os.mailicon.getWidth() - 2;
                os.hubServerAlertsIcon = new HubServerAlertsIcon(os.content, "dhs",
                                                                 new string[] { "@channel", "@" + os.defaultUser.name }
                                                                 );
                os.hubServerAlertsIcon.Init(os);
                if (os.HasLoadedDLCContent)
                {
                    os.AircraftInfoOverlay = new AircraftInfoOverlay(os);
                }
                SAChangeAlertIcon.UpdateAlertIcon(os);
                os.introTextModule.complete |= (flag || !Settings.slowOSStartup);
                if (!flag)
                {
                    MusicManager.playSong();
                }
                os.inputEnabled        = true;
                os.isLoaded            = true;
                os.fullscreen          = new Rect(0, 0, os.ScreenManager.GraphicsDevice.Viewport.Width, os.ScreenManager.GraphicsDevice.Viewport.Height);
                os.TraceDangerSequence = new TraceDangerSequence(os.content, os.ScreenManager.SpriteBatch, os.fullscreen, os);
                os.endingSequence      = new EndingSequenceModule(os.fullscreen, os);
                if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed)
                {
                    os.BootAssitanceModule = new BootCrashAssistanceModule(os.fullscreen, os);
                }
                if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed && HostileHackerBreakinSequence.IsInBlockingHostileFileState(os))
                {
                    os.rebootThisComputer();
                    os.BootAssitanceModule.ShouldSkipDialogueTypeout = true;
                }
                else
                {
                    if (Settings.EnableDLC && HostileHackerBreakinSequence.IsFirstSuccessfulBootAfterBlockingState(os))
                    {
                        HostileHackerBreakinSequence.ReactToFirstSuccesfulBoot(os);
                        os.rebootThisComputer();
                    }
                    if (!OS.TestingPassOnly)
                    {
                        os.runCommand("connect " + os.thisComputer.ip);
                    }
                    var folder2 = os.thisComputer.files.root.searchForFolder("sys");
                    if (folder2.searchForFile("Notes_Reopener.bat") != null)
                    {
                        os.runCommand("notes");
                    }
                }
                if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed && os.HasLoadedDLCContent)
                {
                    bool flag4 = false;
                    if (!os.Flags.HasFlag("AircraftInfoOverlayDeactivated"))
                    {
                        flag4 |= os.Flags.HasFlag("AircraftInfoOverlayActivated");
                        if (!flag4)
                        {
                            var  c       = Programs.getComputer(os, "dair_crash");
                            var  folder3 = c.files.root.searchForFolder("FlightSystems");
                            bool flag5   = false;
                            for (int i = 0; i < folder3.files.Count; i++)
                            {
                                flag5 |= folder3.files[i].name == "747FlightOps.dll";
                            }
                            var aircraftDaemon = (AircraftDaemon)c.getDaemon(typeof(AircraftDaemon));
                            if (!flag5 && !os.Flags.HasFlag("DLC_PlaneResult"))
                            {
                                flag4 = true;
                            }
                        }
                    }
                    if (flag4)
                    {
                        var c = Programs.getComputer(os, "dair_crash");
                        var aircraftDaemon = (AircraftDaemon)c.getDaemon(typeof(AircraftDaemon));
                        aircraftDaemon.StartReloadFirmware();
                        aircraftDaemon.StartUpdating();
                        os.AircraftInfoOverlay.Activate();
                        os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = true;
                        MissionFunctions.runCommand(0, "playAirlineCrashSongSequence");
                    }
                }
            }
            else if (os.multiplayer)
            {
                os.initializeNetwork();
            }
            os.Flags.AddFlag("FirstAlertComplete");
            os.IsInDLCMode       = false;
            os.ShowDLCAlertsIcon = false;

            if (OS.WillLoadSave)
            {
                Stream stream = null;
                if (e.OS.ForceLoadOverrideStream != null && OS.TestingPassOnly)
                {
                    stream = e.OS.ForceLoadOverrideStream;
                }
                else
                {
                    stream = SaveFileManager.GetSaveReadStream(e.OS.SaveGameUserName);
                }
                Extension.Handler.LoadExtension(Extension.Handler.ActiveInfo.Id);
                Extension.Handler.ActiveInfo.OnLoad(e.OS, stream);
            }
            else
            {
                Extension.Handler.CanRegister = true;
                Extension.Handler.ActiveInfo.OnConstruct(e.OS);
                Extension.Handler.CanRegister = false;
            }
        }
コード例 #9
0
        public MainWindow(SplashScreen sc)
        {
            InitializeComponent();
            if (Program.OptionsObject.Program_AccentColor != "Red" || Program.OptionsObject.Program_Theme != "BaseDark")
            {
                ThemeManager.ChangeAppStyle(this, ThemeManager.GetAccent(Program.OptionsObject.Program_AccentColor), ThemeManager.GetAppTheme(Program.OptionsObject.Program_Theme));
            }
            ObjectBrowserColumn.Width = new GridLength(Program.OptionsObject.Program_ObjectbrowserWidth, GridUnitType.Pixel);
            var heightDescriptor = DependencyPropertyDescriptor.FromProperty(ColumnDefinition.WidthProperty, typeof(ItemsControl));

            heightDescriptor.AddValueChanged(EditorObjectBrowserGrid.ColumnDefinitions[1], EditorObjectBrowserGridRow_WidthChanged);
            FillConfigMenu();
            CompileButton.ItemsSource   = compileButtonDict;
            CompileButton.SelectedIndex = 0;
            CActionButton.ItemsSource   = actionButtonDict;
            CActionButton.SelectedIndex = 0;
            ReplaceButton.ItemsSource   = findReplaceButtonDict;
            ReplaceButton.SelectedIndex = 0;
            if (Program.OptionsObject.UI_ShowToolBar)
            {
                Win_ToolBar.Height = double.NaN;
            }
            this.MetroDialogOptions.AnimateHide = this.MetroDialogOptions.AnimateShow = false;
            BlendOverEffect        = (Storyboard)this.Resources["BlendOverEffect"];
            FadeFindReplaceGridIn  = (Storyboard)this.Resources["FadeFindReplaceGridIn"];
            FadeFindReplaceGridOut = (Storyboard)this.Resources["FadeFindReplaceGridOut"];
            EnableServerAnim       = (Storyboard)this.Resources["EnableServerAnim"];
            DisableServerAnim      = (Storyboard)this.Resources["DisableServerAnim"];
            ChangeObjectBrowserToDirectory(Program.OptionsObject.Program_ObjectBrowserDirectory);
            Language_Translate(true);
#if DEBUG
            TryLoadSourceFile(@"C:\Users\Jelle\Desktop\scripting\AeroControler.sp", false);
#endif
            if (Program.OptionsObject.LastOpenFiles != null)
            {
                for (int i = 0; i < Program.OptionsObject.LastOpenFiles.Length; ++i)
                {
                    TryLoadSourceFile(Program.OptionsObject.LastOpenFiles[i], false, true, false);
                }
            }
            string[] args = Environment.GetCommandLineArgs();
            for (int i = 0; i < args.Length; ++i)
            {
                if (!args[i].EndsWith("exe"))
                {
                    TryLoadSourceFile(args[i], false, true, (i == 0));
                }
            }
            sc.Close(TimeSpan.FromMilliseconds(500.0));
            StartBackgroundParserThread();
            FullyInitialized = true;
        }
コード例 #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            var eventUploadIntent = new Intent(this, typeof(EventUploadReceiver));

            _eventUploadPendingIntent = PendingIntent.GetBroadcast(this, 0, eventUploadIntent,
                                                                   PendingIntentFlags.UpdateCurrent);
            var clearClipboardIntent = new Intent(this, typeof(ClearClipboardAlarmReceiver));

            _clearClipboardPendingIntent = PendingIntent.GetBroadcast(this, 0, clearClipboardIntent,
                                                                      PendingIntentFlags.UpdateCurrent);

            var policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build();

            StrictMode.SetThreadPolicy(policy);

            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _messagingService    = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _broadcasterService  = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _userService         = ServiceContainer.Resolve <IUserService>("userService");
            _appIdService        = ServiceContainer.Resolve <IAppIdService>("appIdService");
            _storageService      = ServiceContainer.Resolve <IStorageService>("storageService");
            _eventService        = ServiceContainer.Resolve <IEventService>("eventService");

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            UpdateTheme(ThemeManager.GetTheme(true));
            base.OnCreate(savedInstanceState);
            if (!CoreHelpers.InDebugMode())
            {
                Window.AddFlags(Android.Views.WindowManagerFlags.Secure);
            }

#if !FDROID
            var appCenterHelper = new AppCenterHelper(_appIdService, _userService);
            var appCenterTask   = appCenterHelper.InitAsync();
#endif

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            Xamarin.Forms.Forms.Init(this, savedInstanceState);
            _appOptions = GetOptions();
            LoadApplication(new App.App(_appOptions));

            _broadcasterService.Subscribe(_activityKey, (message) =>
            {
                if (message.Command == "startEventTimer")
                {
                    StartEventAlarm();
                }
                else if (message.Command == "stopEventTimer")
                {
                    var task = StopEventAlarmAsync();
                }
                else if (message.Command == "finishMainActivity")
                {
                    Xamarin.Forms.Device.BeginInvokeOnMainThread(() => Finish());
                }
                else if (message.Command == "listenYubiKeyOTP")
                {
                    ListenYubiKey((bool)message.Data);
                }
                else if (message.Command == "updatedTheme")
                {
                    RestartApp();
                }
                else if (message.Command == "exit")
                {
                    ExitApp();
                }
                else if (message.Command == "copiedToClipboard")
                {
                    var task = ClearClipboardAlarmAsync(message.Data as Tuple <string, int?, bool>);
                }
            });
        }
コード例 #11
0
ファイル: MainWindow.xaml.cs プロジェクト: Thraxs/launcher
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (Settings.ConfigExists())
            {
                Settings.Read();
            }
            else
            {
                if (!Settings.ReadPath())
                {
                    this.ShowMessageAsync("Ruta de ejecución", "La ruta de ejecución no ha sido autodetectada, indicala manualmente en la ventana de opciones antes de empezar a utilizar la aplicación");
                }

                //Create default profile
                Profiles.CreateDefault();

                //Save settings
                Settings.Write();
            }

            //Add local addons
            Configuration.Addons.ReadAddons();
            foreach (string addon in Configuration.Addons.LocalAddons)
            {
                Addons.Add(new Addon()
                {
                    Enabled = false, Name = addon
                });
            }
            listBox_addons.ItemsSource = Addons;

            //Add available memory allocators
            Settings.ReadAllocators();
            foreach (string allocator in Settings.Allocators)
            {
                comboBox_malloc.Items.Add(allocator);
            }

            //Add profiles
            UpdateProfiles();
            comboBox_profiles.SelectedIndex = comboBox_profiles.Items.IndexOf(Profiles.DefaultProfile); //Select default profile

            //Set accent
            ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(Settings.Accents[Settings.Accent]), ThemeManager.GetAppTheme("BaseLight"));

            //Set groupboxes preferences
            groupBox_servers.IsExpanded    = Settings.ServersGroupBox;
            groupBox_repository.IsExpanded = Settings.RepositoryGroupBox;

            //If just updated, remove updater and show notification
            if (Updater.Updated)
            {
                Updater.RemoveUpdater();
                this.ShowMessageAsync("Aplicación actualizada", "La aplicación ha sido actualizada con éxito");
            }

            //Notify if update failed
            if (Updater.UpdateFailed)
            {
                Updater.RemoveUpdater();
                this.ShowMessageAsync("Error al actualizar", "Se ha producido un error al actualizar la aplicación, vuelve a intentarlo más tarde");
            }

            //Check Java presence
            Repository.CheckJava();

            //Check Arma3Sync configuration
            if ((Repository.JavaVersion != "" || Settings.JavaPath != "") && Settings.Arma3SyncPath != "" && Settings.Arma3SyncRepository != "")
            {
                image_arma3Sync.Source           = new BitmapImage(new Uri("pack://application:,,,/Resources/a3sEnabled.png"));
                image_arma3Sync.ToolTip          = "Arma3Sync está configurado. Click para iniciar";
                tile_repositoryStatus.IsEnabled  = true;
                tile_repositoryStatus.Background = new SolidColorBrush(Colors.Orange);
                tile_repositoryStatus.ToolTip    = "Click para comprobar estado";
            }

            //Check repository for updates
            if (Settings.CheckRepository)
            {
                tile_repositoryStatus.IsEnabled = false;
                new Thread(Repository.CheckRepository).Start();
            }

            //Check servers status
            if (Settings.CheckServers)
            {
                new Thread(Servers.CheckServers).Start();
            }

            //Check for updates
            if (Settings.CheckUpdates)
            {
                new Thread(() => Updater.CheckVersion(false)).Start();
            }

            //Check local game version against server version
            label_gameVersion.Content = Settings.GetGameVersion();
            new Thread(Servers.CompareServerVersion).Start();
        }
コード例 #12
0
        private void OnStartup(object sender, StartupEventArgs e)
        {
            Log.Info("On Startup.", GetType());

            // Fix for .net 3.1.19 making PowerToys Run not adapt to DPI changes.
            PowerLauncher.Helper.NativeMethods.SetProcessDPIAware();
            var bootTime = new System.Diagnostics.Stopwatch();

            bootTime.Start();
            Stopwatch.Normal("App.OnStartup - Startup cost", () =>
            {
                var textToLog = new StringBuilder();
                textToLog.AppendLine("Begin PowerToys Run startup ----------------------------------------------------");
                textToLog.AppendLine($"Runtime info:{ErrorReporting.RuntimeInfo()}");

                RegisterAppDomainExceptions();
                RegisterDispatcherUnhandledException();

                _themeManager = new ThemeManager(this);
                ImageLoader.Initialize(_themeManager.GetCurrentTheme());

                _settingsVM = new SettingWindowViewModel();
                _settings   = _settingsVM.Settings;
                _settings.StartedFromPowerToysRunner = e.Args.Contains("--started-from-runner");

                _stringMatcher         = new StringMatcher();
                StringMatcher.Instance = _stringMatcher;
                _stringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision;

                _mainVM         = new MainViewModel(_settings);
                _mainWindow     = new MainWindow(_settings, _mainVM);
                API             = new PublicAPIInstance(_settingsVM, _mainVM, _themeManager);
                _settingsReader = new SettingsReader(_settings, _themeManager);
                _settingsReader.ReadSettings();

                PluginManager.InitializePlugins(API);

                Current.MainWindow       = _mainWindow;
                Current.MainWindow.Title = Constant.ExeFileName;

                // main windows needs initialized before theme change because of blur settings
                HttpClient.Proxy = _settings.Proxy;

                RegisterExitEvents();

                _settingsReader.ReadSettingsOnChange();

                _mainVM.MainWindowVisibility = Visibility.Visible;
                _mainVM.ColdStartFix();
                _themeManager.ThemeChanged += OnThemeChanged;
                textToLog.AppendLine("End PowerToys Run startup ----------------------------------------------------  ");

                bootTime.Stop();

                Log.Info(textToLog.ToString(), GetType());
                PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent()
                {
                    BootTimeMs = bootTime.ElapsedMilliseconds
                });

                // [Conditional("RELEASE")]
                // check update every 5 hours

                // check updates on startup
            });
        }
コード例 #13
0
 private void AppearanceAdjustments()
 {
     Window?.SetStatusBarColor(ThemeHelpers.NavBarBackgroundColor);
     Window?.DecorView.SetBackgroundColor(ThemeHelpers.BackgroundColor);
     ThemeHelpers.SetAppearance(ThemeManager.GetTheme(), ThemeManager.OsDarkModeEnabled());
 }
コード例 #14
0
ファイル: Common.cs プロジェクト: xiaohu98/MissionPlanner
        public static DialogResult MessageShowAgain(string title, string promptText)
        {
            Form form = new Form();

            System.Windows.Forms.Label label = new System.Windows.Forms.Label();
            CheckBox chk = new CheckBox();

            Controls.MyButton buttonOk = new Controls.MyButton();
            System.ComponentModel.ComponentResourceManager resources =
                new System.ComponentModel.ComponentResourceManager(typeof(MainV2));
            try
            {
                form.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            } catch {}

            string link     = "";
            string linktext = "";


            Regex linkregex = new Regex(@"(\[link;([^\]]+);([^\]]+)\])", RegexOptions.IgnoreCase);
            Match match     = linkregex.Match(promptText);

            if (match.Success)
            {
                link       = match.Groups[2].Value;
                linktext   = match.Groups[3].Value;
                promptText = promptText.Replace(match.Groups[1].Value, "");
            }

            form.Text  = title;
            label.Text = promptText;

            chk.Tag      = ("SHOWAGAIN_" + title.Replace(" ", "_").Replace('+', '_'));
            chk.AutoSize = true;
            chk.Text     = Strings.ShowMeAgain;
            chk.Checked  = true;
            chk.Location = new Point(9, 80);

            if (Settings.Instance.ContainsKey((string)chk.Tag) && Settings.Instance.GetBoolean((string)chk.Tag) == false)
            // skip it
            {
                form.Dispose();
                chk.Dispose();
                buttonOk.Dispose();
                label.Dispose();
                return(DialogResult.OK);
            }

            chk.CheckStateChanged += new EventHandler(chk_CheckStateChanged);

            buttonOk.Text         = Strings.OK;
            buttonOk.DialogResult = DialogResult.OK;
            buttonOk.Location     = new Point(form.Right - 100, 80);

            label.SetBounds(9, 9, 372, 13);

            label.AutoSize = true;

            form.Controls.AddRange(new Control[] { label, chk, buttonOk });

            if (link != "" && linktext != "")
            {
                Size textSize2 = TextRenderer.MeasureText(linktext, SystemFonts.DefaultFont);
                var  linklbl   = new LinkLabel
                {
                    Left     = 9,
                    Top      = label.Bottom,
                    Width    = textSize2.Width,
                    Height   = textSize2.Height,
                    Text     = linktext,
                    Tag      = link,
                    AutoSize = true
                };
                linklbl.Click += (sender, args) =>
                {
                    try
                    {
                        System.Diagnostics.Process.Start(((LinkLabel)sender).Tag.ToString());
                    }
                    catch (Exception)
                    {
                        CustomMessageBox.Show("Failed to open link " + ((LinkLabel)sender).Tag.ToString());
                    }
                };

                form.Controls.Add(linklbl);

                form.Width = Math.Max(form.Width, linklbl.Right + 16);
            }

            form.ClientSize = new Size(396, 107);

            form.ClientSize      = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition   = FormStartPosition.CenterScreen;
            form.MinimizeBox     = false;
            form.MaximizeBox     = false;

            ThemeManager.ApplyThemeTo(form);

            DialogResult dialogResult = form.ShowDialog();

            form.Dispose();

            form = null;

            return(dialogResult);
        }
コード例 #15
0
 private void BUT_themecustom_Click(object sender, EventArgs e)
 {
     ThemeManager.StartThemeEditor();
 }
コード例 #16
0
ファイル: ConfigWindow.xaml.cs プロジェクト: z4cH3r/Spedit
 public ConfigWindow()
 {
     InitializeComponent();
     Language_Translate();
     if (Program.OptionsObject.Program_AccentColor != "Red" || Program.OptionsObject.Program_Theme != "BaseDark")
     {
         ThemeManager.ChangeAppStyle(this, ThemeManager.GetAccent(Program.OptionsObject.Program_AccentColor), ThemeManager.GetAppTheme(Program.OptionsObject.Program_Theme));
     }
     for (int i = 0; i < Program.Configs.Length; ++i)
     {
         ConfigListBox.Items.Add(new ListBoxItem()
         {
             Content = Program.Configs[i].Name
         });
     }
     ConfigListBox.SelectedIndex = Program.SelectedConfig;
 }
コード例 #17
0
        private void BUT_writePIDS_Click(object sender, EventArgs e)
        {
            if (Common.MessageShowAgain("Write Raw Params", "Are you Sure?") != DialogResult.OK)
            {
                return;
            }

            // sort with enable at the bottom - this ensures params are set before the function is disabled
            var temp = new List <string>();

            foreach (var item in _changes.Keys)
            {
                temp.Add((string)item);
            }

            temp.SortENABLE();

            foreach (string value in temp)
            {
                try
                {
                    _can.SetParameter(_node, value, _changes[value]);

                    try
                    {
                        // set control as well
                        var textControls = Controls.Find(value, true);
                        if (textControls.Length > 0)
                        {
                            ThemeManager.ApplyThemeTo(textControls[0]);
                        }
                    }
                    catch
                    {
                    }

                    try
                    {
                        // set param table as well
                        foreach (DataGridViewRow row in Params.Rows)
                        {
                            if (row.Cells[0].Value.ToString() == value)
                            {
                                row.Cells[1].Style.BackColor = ThemeManager.ControlBGColor;
                                _changes.Remove(value);
                                break;
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                catch
                {
                    CustomMessageBox.Show("Set " + value + " Failed");
                }
            }

            CustomMessageBox.Show("Parameters successfully saved.", "Saved");
        }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ThemedListBoxEx"/> control.
 /// </summary>
 public ThemedListBoxEx()
 {
     ThemeManager.ApplyTo(this);
 }
 private void KcbTheme_SelectedIndexChanged(object sender, EventArgs e)
 {
     ThemeManager.SetTheme(kcbTheme.Text, kMan);
 }
コード例 #20
0
        private void Rtcm3_ObsMessage(object sender, EventArgs e)
        {
            if (MainV2.instance.IsDisposed)
            {
                threadrun = false;
            }

            MainV2.instance.BeginInvoke((MethodInvoker) delegate
            {
                List <rtcm3.ob> obs = sender as List <rtcm3.ob>;

                if (obs.Count == 0)
                {
                    return;
                }

                // get system controls
                Func <char, List <VerticalProgressBar2> > ctls = delegate(char sys)
                {
                    return(panel1.Controls.OfType <VerticalProgressBar2>()
                           .Where(ctl => { return ctl.Label.StartsWith(sys + ""); }).ToList());
                };

                // we need more ctls for this system
                while (ctls.Invoke(obs[0].sys).Count() < obs.Count)
                {
                    panel1.Controls.Add(new VerticalProgressBar2()
                    {
                        Height = panel1.Height - 30,
                        Label  = obs[0].sys + ""
                    });
                }

                // we need to remove ctls for this system
                while (ctls.Invoke(obs[0].sys).Count() > obs.Count)
                {
                    var list = ctls.Invoke(obs[0].sys);
                    panel1.Controls.Remove(list.First());
                }

                int width = panel1.Width / panel1.Controls.OfType <VerticalProgressBar2>().Count();

                var tmp  = ctls('G');
                var tmp2 = ctls('R');
                var tmp3 = ctls('B');
                var tmp4 = ctls('E');

                var start = 0;

                if (obs[0].sys == 'G')
                {
                    start = 0;
                }
                if (obs[0].sys == 'R')
                {
                    start = tmp.Count;
                }
                if (obs[0].sys == 'B')
                {
                    start = tmp.Count + tmp2.Count;
                }
                if (obs[0].sys == 'E')
                {
                    start = tmp.Count + tmp2.Count + tmp3.Count;
                }

                // if G 0, if R = G.count (2 system support)
                var a = start;

                var sysctls = ctls.Invoke(obs[0].sys);
                var cnt     = 0;
                foreach (var ob in obs)
                {
                    var vpb   = sysctls[cnt];
                    vpb.Value = (int)ob.snr;
                    //vpb.Text = ob.snr.ToString();
                    vpb.Label     = ob.sys + ob.prn.ToString();
                    vpb.Location  = new Point(width * (a + cnt), 0);
                    vpb.DrawLabel = true;
                    vpb.Width     = width;
                    vpb.Height    = panel1.Height - 30;
                    vpb.Minimum   = 25;
                    vpb.Maximum   = 55;
                    vpb.minline   = 40;
                    vpb.maxline   = 99;
                    cnt++;
                }

                ThemeManager.ApplyThemeTo(panel1);
            }
                                        );
        }
コード例 #21
0
 public static Accent GetAppAccent() => string.IsNullOrEmpty(Config.Instance.AccentName)
                                                                                           ? ThemeManager.DetectAppStyle().Item2 : ThemeManager.Accents.First(a => a.Name == Config.Instance.AccentName);
コード例 #22
0
 private void BUT_themecustom_Click(object sender, EventArgs e)
 {
     ThemeManager.CustomColor();
     CMB_theme.Text = "Custom";
 }
コード例 #23
0
        public static void CreateAppStyleBy(Color color, bool changeImmediately = false)
        {
            // create a runtime accent resource dictionary

            var resourceDictionary = new ResourceDictionary();

            resourceDictionary.Add("HighlightColor", color);
            resourceDictionary.Add("AccentBaseColor", color);
            resourceDictionary.Add("AccentColor", Color.FromArgb((byte)(204), color.R, color.G, color.B));
            resourceDictionary.Add("AccentColor2", Color.FromArgb((byte)(153), color.R, color.G, color.B));
            resourceDictionary.Add("AccentColor3", Color.FromArgb((byte)(102), color.R, color.G, color.B));
            resourceDictionary.Add("AccentColor4", Color.FromArgb((byte)(51), color.R, color.G, color.B));

            resourceDictionary.Add("HighlightBrush", GetSolidColorBrush((Color)resourceDictionary["HighlightColor"]));
            resourceDictionary.Add("AccentBaseColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentBaseColor"]));
            resourceDictionary.Add("AccentColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("AccentColorBrush2", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"]));
            resourceDictionary.Add("AccentColorBrush3", GetSolidColorBrush((Color)resourceDictionary["AccentColor3"]));
            resourceDictionary.Add("AccentColorBrush4", GetSolidColorBrush((Color)resourceDictionary["AccentColor4"]));

            resourceDictionary.Add("WindowTitleColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));

            resourceDictionary.Add("ProgressBrush", new LinearGradientBrush(
                                       new GradientStopCollection(new[]
            {
                new GradientStop((Color)resourceDictionary["HighlightColor"], 0),
                new GradientStop((Color)resourceDictionary["AccentColor3"], 1)
            }),
                                       // StartPoint="1.002,0.5" EndPoint="0.001,0.5"
                                       startPoint: new Point(1.002, 0.5), endPoint: new Point(0.001, 0.5)));

            resourceDictionary.Add("CheckmarkFill", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("RightArrowFill", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));

            resourceDictionary.Add("IdealForegroundColor", IdealTextColor(color));
            resourceDictionary.Add("IdealForegroundColorBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));
            resourceDictionary.Add("IdealForegroundDisabledBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"], 0.4));
            resourceDictionary.Add("AccentSelectedColorBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));

            resourceDictionary.Add("MetroDataGrid.HighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("MetroDataGrid.HighlightTextBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));
            resourceDictionary.Add("MetroDataGrid.MouseOverHighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor3"]));
            resourceDictionary.Add("MetroDataGrid.FocusBorderBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("MetroDataGrid.InactiveSelectionHighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"]));
            resourceDictionary.Add("MetroDataGrid.InactiveSelectionHighlightTextBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));

            resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.OnSwitchBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.OnSwitchMouseOverBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"]));
            resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.ThumbIndicatorCheckedBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));

            // applying theme to MahApps

            var resDictName = string.Format("ApplicationAccent_{0}.xaml", color.ToString().Replace("#", string.Empty));
            var fileName    = Path.Combine(Path.GetTempPath(), resDictName);

            using (var writer = System.Xml.XmlWriter.Create(fileName, new System.Xml.XmlWriterSettings {
                Indent = true
            }))
            {
                System.Windows.Markup.XamlWriter.Save(resourceDictionary, writer);
                writer.Close();
            }

            resourceDictionary = new ResourceDictionary()
            {
                Source = new Uri(fileName, UriKind.Absolute)
            };

            var newAccent = new Accent {
                Name = resDictName, Resources = resourceDictionary
            };

            ThemeManager.AddAccent(newAccent.Name, newAccent.Resources.Source);

            if (changeImmediately)
            {
                var application = Application.Current;
                //var applicationTheme = ThemeManager.AppThemes.First(x => string.Equals(x.Name, "BaseLight"));
                // detect current application theme
                Tuple <AppTheme, Accent> applicationTheme = ThemeManager.DetectAppStyle(application);
                ThemeManager.ChangeAppStyle(application, newAccent, applicationTheme.Item1);
            }
        }
コード例 #24
0
        private void timer_Tick(object sender, EventArgs e)
        {
            try
            {
                MainV2.comPort.MAV.cs.UpdateCurrentSettings(currentStateBindingSource);
            }
            catch
            {
            }

            float pwm = 0;

            if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane ||
                MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduRover ||
                MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.Ateryx) // APM
            {
                if (MainV2.comPort.MAV.param.ContainsKey("FLTMODE_CH") ||
                    MainV2.comPort.MAV.param.ContainsKey("MODE_CH"))
                {
                    var sw = 0;
                    if (MainV2.comPort.MAV.param.ContainsKey("FLTMODE_CH"))
                    {
                        sw = (int)MainV2.comPort.MAV.param["FLTMODE_CH"].Value;
                    }
                    else
                    {
                        sw = (int)MainV2.comPort.MAV.param["MODE_CH"].Value;
                    }

                    switch (sw)
                    {
                    case 5:
                        pwm = MainV2.comPort.MAV.cs.ch5in;
                        break;

                    case 6:
                        pwm = MainV2.comPort.MAV.cs.ch6in;
                        break;

                    case 7:
                        pwm = MainV2.comPort.MAV.cs.ch7in;
                        break;

                    case 8:
                        pwm = MainV2.comPort.MAV.cs.ch8in;
                        break;

                    default:

                        break;
                    }

                    if (MainV2.comPort.MAV.param.ContainsKey("FLTMODE_CH"))
                    {
                        LBL_flightmodepwm.Text = MainV2.comPort.MAV.param["FLTMODE_CH"] + ": " + pwm;
                    }
                    else
                    {
                        LBL_flightmodepwm.Text = MainV2.comPort.MAV.param["MODE_CH"] + ": " + pwm;
                    }
                }
            }

            if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2
            {
                pwm = MainV2.comPort.MAV.cs.ch5in;
                LBL_flightmodepwm.Text = "5: " + MainV2.comPort.MAV.cs.ch5in;
            }

            Control[] fmodelist = { CMB_fmode1, CMB_fmode2, CMB_fmode3, CMB_fmode4, CMB_fmode5, CMB_fmode6 };

            foreach (var ctl in fmodelist)
            {
                ThemeManager.ApplyThemeTo(ctl);
            }

            var no = readSwitch(pwm);

            fmodelist[no].BackColor = Color.Green;
        }
コード例 #25
0
 public GeneralSettings()
 {
     ThemeManager.AddAccent("CorsairYellow", new Uri("pack://application:,,,/Styles/Accents/CorsairYellow.xaml"));
     ApplyAutorun();
 }
コード例 #26
0
#pragma warning disable 1998
        public static async void Initialize()
#pragma warning restore 1998
        {
            LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en-US");
            _startUpTime = DateTime.UtcNow;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            Config.Load();
            Log.Info($"HDT: {Helper.GetCurrentVersion()}, Operating System: {Helper.GetWindowsVersion()}, .NET Framework: {Helper.GetInstalledDotNetVersion()}");
            var splashScreenWindow = new SplashScreenWindow();

#if (SQUIRREL)
            if (Config.Instance.CheckForUpdates)
            {
                var updateCheck = Updater.StartupUpdateCheck(splashScreenWindow);
                while (!updateCheck.IsCompleted)
                {
                    await Task.Delay(500);

                    if (splashScreenWindow.SkipUpdate)
                    {
                        break;
                    }
                }
            }
#endif
            splashScreenWindow.ShowConditional();
            Log.Initialize();
            Reflection.Exception += e => Log.Warn("HearthMirror Exception: " + e);
            ConfigManager.Run();
            LocUtil.UpdateCultureInfo();
            var newUser = ConfigManager.PreviousVersion == null;
            LogConfigUpdater.Run().Forget();
            LogConfigWatcher.Start();
            UITheme.InitializeTheme().Forget();
            ThemeManager.Run();
            ResourceMonitor.Run();
            Game = new GameV2();
            Game.SecretsManager.OnSecretsChanged += cards => Overlay.ShowSecrets(cards);
            MainWindow = new MainWindow();
            MainWindow.LoadConfigSettings();
            MainWindow.Show();
            splashScreenWindow.Close();

            if (Config.Instance.DisplayHsReplayNoteLive && ConfigManager.PreviousVersion != null && ConfigManager.PreviousVersion < new Version(1, 1, 0))
            {
                MainWindow.FlyoutHsReplayNote.IsOpen = true;
            }

            if (ConfigManager.UpdatedVersion != null)
            {
#if (!SQUIRREL)
                Updater.Cleanup();
#endif
                MainWindow.FlyoutUpdateNotes.IsOpen = true;
                MainWindow.UpdateNotesControl.SetHighlight(ConfigManager.PreviousVersion);
#if (SQUIRREL && !DEV)
                if (Config.Instance.CheckForDevUpdates && !Config.Instance.AllowDevUpdates.HasValue)
                {
                    MainWindow.ShowDevUpdatesMessage();
                }
#endif
                CheckForHearthstoneUpdate();
            }
            DataIssueResolver.Run();

#if (!SQUIRREL)
            Helper.CopyReplayFiles();
#endif
            BackupManager.Run();

            if (Config.Instance.PlayerWindowOnStart)
            {
                Windows.PlayerWindow.Show();
            }
            if (Config.Instance.OpponentWindowOnStart)
            {
                Windows.OpponentWindow.Show();
            }
            if (Config.Instance.TimerWindowOnStartup)
            {
                Windows.TimerWindow.Show();
            }

            PluginManager.Instance.LoadPluginsFromDefaultPath();
            MainWindow.Options.OptionsTrackerPlugins.Load();
            PluginManager.Instance.StartUpdateAsync();

            UpdateOverlayAsync();

            if (Config.Instance.ShowCapturableOverlay)
            {
                Windows.CapturableOverlay = new CapturableOverlayWindow();
                Windows.CapturableOverlay.Show();
            }

            if (LogConfigUpdater.LogConfigUpdateFailed)
            {
                MainWindow.ShowLogConfigUpdateFailedMessage().Forget();
            }
            else if (LogConfigUpdater.LogConfigUpdated && Game.IsRunning)
            {
                ShowRestartRequiredMessageAsync().Forget();
                Overlay.ShowRestartRequiredWarning();
            }
            LogWatcherManger.Start(Game).Forget();

            RemoteConfig.Instance.Loaded += CheckForCardImageUpdate;
            RemoteConfig.Instance.Load();
            HotKeyManager.Load();

            if (Helper.HearthstoneDirExists && Config.Instance.StartHearthstoneWithHDT && !Game.IsRunning)
            {
                HearthstoneRunner.StartHearthstone().Forget();
            }

            HSReplayNetHelper.UpdateAccount().Forget();

            AssetDownloaders.SetupAssetDownloaders();

            Initialized = true;

            Influx.OnAppStart(
                Helper.GetCurrentVersion(),
                newUser,
                HSReplayNetOAuth.IsFullyAuthenticated,
                HSReplayNetOAuth.AccountData?.IsPremium ?? false,
                (int)(DateTime.UtcNow - _startUpTime).TotalSeconds,
                PluginManager.Instance.Plugins.Count
                );
        }
コード例 #27
0
        internal void processToScreen()
        {
            toolTip1.RemoveAll();

            disableNumericUpDownControls(this);

            // process hashdefines and update display
            foreach (string value in MainV2.comPort.MAV.param.Keys)
            {
                if (value == null || value == "")
                {
                    continue;
                }

                string    name = value;
                Control[] text = this.Controls.Find(name, true);
                foreach (Control ctl in text)
                {
                    try
                    {
                        if (ctl.GetType() == typeof(NumericUpDown))
                        {
                            float numbervalue = (float)MainV2.comPort.MAV.param[value];

                            MAVLinkInterface.modifyParamForDisplay(true, value, ref numbervalue);

                            NumericUpDown thisctl = ((NumericUpDown)ctl);
                            thisctl.Maximum   = 9000;
                            thisctl.Minimum   = -9000;
                            thisctl.Value     = (decimal)numbervalue;
                            thisctl.Increment = (decimal)0.001;
                            if (thisctl.Name.EndsWith("_P") || thisctl.Name.EndsWith("_I") || thisctl.Name.EndsWith("_D") ||
                                thisctl.Name.EndsWith("_LOW") || thisctl.Name.EndsWith("_HIGH") || thisctl.Value == 0 ||
                                thisctl.Value.ToString("0.###", new System.Globalization.CultureInfo("en-US")).Contains("."))
                            {
                                thisctl.DecimalPlaces = 3;
                            }
                            else
                            {
                                thisctl.Increment     = (decimal)1;
                                thisctl.DecimalPlaces = 1;
                            }

                            if (thisctl.Name.EndsWith("_IMAX"))
                            {
                                thisctl.Maximum = 180;
                                thisctl.Minimum = -180;
                            }

                            thisctl.Enabled = true;
                            try
                            {
                                thisctl.Parent.Visible = true;
                            }
                            catch { }

                            ThemeManager.ApplyThemeTo(thisctl);

                            thisctl.Validated += null;
                            if (tooltips[value] != null)
                            {
                                try
                                {
                                    toolTip1.SetToolTip(ctl, ((paramsettings)tooltips[value]).desc);
                                }
                                catch { }
                            }
                            thisctl.Validated += new EventHandler(EEPROM_View_float_TextChanged);
                        }
                        else if (ctl.GetType() == typeof(ComboBox))
                        {
                            ComboBox thisctl = ((ComboBox)ctl);

                            thisctl.SelectedIndex = (int)(float)MainV2.comPort.MAV.param[value];

                            thisctl.Validated += new EventHandler(ComboBox_Validated);

                            ThemeManager.ApplyThemeTo(thisctl);
                        }
                    }
                    catch { }
                }
                if (text.Length == 0)
                {
                    //Console.WriteLine(name + " not found");
                }
            }
        }
コード例 #28
0
ファイル: ThemeManager.cs プロジェクト: Irdis/VSTalk
 /// <summary>
 /// Gets an instance of the <see cref="ThemeManager"/> class.
 /// </summary>
 /// <param name="package">The hosting package.</param>
 /// <returns>An instance of the <see cref="ThemeManager"/> class.</returns>
 internal static ThemeManager GetInstance(VSTalkPackage package)
 {
     return _instance ?? (_instance = new ThemeManager(package));
 }
コード例 #29
0
 public static void SetAccentColor(string color)
 {
     Properties.Settings.Default.Accent = color;
     Properties.Settings.Default.Save();
     ThemeManager.ChangeAppStyle(App, ThemeManager.GetAccent(color), ThemeManager.GetAppTheme(GetTheme()));
 }
コード例 #30
0
ファイル: TodoList.cs プロジェクト: wonrst/nui-demo
    void Initialize()
    {
        var root         = NUIApplication.GetDefaultWindow();
        var resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource;

        // Load and apply theme from xaml file.
        themeCommon = new Theme(resourcePath + "Theme/Common.xaml");
        themeGreen  = new Theme(resourcePath + "Theme/Green.xaml");
        ThemeManager.ApplyTheme(themeCommon);


        var themeChangeButton = new Button()
        {
            WidthResizePolicy = ResizePolicyType.FillToParent,
            SizeHeight        = 70,
            Text = "Click to change theme",
        };

        themeChangeButton.Clicked += OnClicked;
        root.Add(themeChangeButton);
        root.BackgroundColor = Color.White;

        root.Add(new TextLabel()
        {
            StyleName = "Title",
            Position  = new Position(30, 120),
            Text      = "TODO List",
        });

        itemContainer = new View()
        {
            StyleName = "Background",
            Position  = new Position(25, 170),
            Layout    = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Vertical
            },
        };
        root.Add(itemContainer);

        var inputs = new View()
        {
            Margin = new Extents(20),
            Layout = new LinearLayout()
            {
                CellPadding = new Size2D(10, 0)
            },
        };

        itemContainer.Add(inputs);

        inputField = new TextField
        {
            StyleName         = "InputField",
            Size              = new Size(300, 40),
            PlaceholderText   = " Next to do...",
            VerticalAlignment = VerticalAlignment.Center,
        };
        inputs.Add(inputField);

        var addButton = new Button
        {
            StyleName = "AddButton",
            Size      = new Size(80, 40),
            Text      = "Add",
        };

        addButton.Clicked += OnClickedAdd;
        inputs.Add(addButton);

        AddItem("Grocery order");
        AddItem("Get tickets for Friday graduation", true);
        AddItem("Call about summer camp enrollment");

        root.KeyEvent += OnKeyEvent;
    }
コード例 #31
0
 public MapDepthNodeRenderer(NavigatorView parentNavigatorView, INodeProxy nodeProxy, ThemeManager themeManager, string skinName)
     : base(parentNavigatorView, nodeProxy, themeManager, skinName)
 {
 }
コード例 #32
0
 public static void SetTheme(string theme)
 {
     Properties.Settings.Default.Theme = theme;
     Properties.Settings.Default.Save();
     ThemeManager.ChangeAppStyle(App, ThemeManager.GetAccent(GetAccent()), ThemeManager.GetAppTheme(theme));
 }
コード例 #33
0
 private void ExecuteActions()
 {
     ThemeManager.ActivateVariant(ThemeId, VariantId);
 }
コード例 #34
0
 private void ChangeTheme_OnChecked(object sender, RoutedEventArgs e)
 {
     ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Blue"), Theme.Light);
 }