Inheritance: WindowlessControlHost
示例#1
0
 internal ItemCollection(ItemsControl control, WindowlessPanel panel)
 {
     myLayoutControl = panel;
     myControl = control;
 }
示例#2
0
        public MainForm()
        {
            m_Logger = new Logger();
            m_Logger.LogFilePath = Path.Combine(EnvironmentEx.CallingAssemblyDirectory, "TSA.txt");

            m_DevicePowered = false;
            DeviceManagement.ACPowerApplied += DeviceManagement_ACPowerApplied;
            DeviceManagement.ACPowerRemoved += DeviceManagement_ACPowerRemoved;

            ResourceManager.Instance.Culture = new CultureInfo("en_US");

            InitializeComponent();

            //m_SystemState = new SystemState(SystemProperty.PhoneRingerOff);
            //m_SystemState.Changed += SystemState_Changed;
            m_ItemsControl = new ItemsControl();

            VerticalStackPanelHost scrollHost = new VerticalStackPanelHost();
            StackPanel stack = scrollHost.Control;
            stack.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Stretch;
            WindowlessHost.Control.Controls.Add(scrollHost);
            WindowlessHost.AutoScroll = true;

            scrollHost.Control.Controls.Add(m_ItemsControl);

            m_ItemsControl.ContentPresenter = typeof(StationPresenter);
            m_ItemsControl.Control = new StackPanel();

            m_Options = new Options();
            m_Options.UseGps += chkUseGps_Click;
            m_Options.RouteChanged += Options_RouteChanged;
            m_Options.DebugChanged += Options_DebugChanged;

            m_PowerRequirements = IntPtr.Zero;
            m_SMSSent = false;
            m_LocationServiceStarted = false;

            bool _Error = false;

            m_UpdateDataHandler = UpdateData;
            //m_Vibrate = new Vibrate();

            //m_Timer = new Timer();
            //m_Timer.Interval = GetInterval();
            //m_Timer.Tick += Timer_Tick;

            try
            {
                m_SMSSender = new SMSSender();
                m_SMSSender.SMSCompleted += SMSSender_SMSCompleted;
            }
            catch (Exception e)
            {
                _Error = true;
                MessageBox.Show(e.Message);
            }

            if (!_Error)
            {
                //m_Timer.Enabled = chkAlwaysOn.Checked;

                LoadStationList(false);

                if (Options.AutoStartLocationService && !m_LocationServiceStarted)
                {
                    StartLocationService();
                    m_LocationServiceStarted = true;
                }

                menuItem1.Text = (m_LocationServiceStarted ? "Stop" : "Start");

                txtStatus.Text = string.Format("{0} Running on Emulator", !NativeMethods.IsEmulator() ? "Not" : string.Empty).Trim();

                txtStatus.Visible = Options.DebugOn;
            }
            else
            {
                Close();
                Application.Exit();
            }
        }