Exemplo n.º 1
0
 /// <summary>
 /// This function is the callback used to execute the command when the menu item is clicked.
 /// See the constructor to see how the menu item is associated with this function using
 /// OleMenuCommandService service and MenuCommand class.
 /// </summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event args.</param>
 private void MenuItemCallback(object sender, EventArgs e)
 {
     // Create the dialog instance without Help support.
     var d = new ConfigDialog(ServiceProvider);
     // Show the dialog.
     var m = d.ShowModal();
 }
Exemplo n.º 2
0
        private void checkMailSettings()
        {
            string userName   = ConfigDialog.Instance.SMTPUserName;
            string smtpServer = ConfigDialog.Instance.SMTPServer;

            if (userName.Length == 0 || smtpServer.Length == 0)
            {
                uploadLog.Text          = "Unable to send mail, please enter your mail settings...\r\n";
                buttonCancel.Text       = "Close";
                buttonUpload.Enabled    = false;
                textDescription.Enabled = false;
                comboMaildrops.Enabled  = false;

                ConfigDialog config = ConfigDialog.Instance;
                if (!config.Visible && !settingsDialogShown)
                {
                    settingsDialogShown = true;
                    config.setMailTabActive();
                    config.ShowDialog();
                }
            }
            else
            {
                uploadLog.Text          = "";
                buttonCancel.Text       = "Cancel";
                textDescription.Enabled = true;
                comboMaildrops.Enabled  = true;
                buttonUpload.Enabled    = comboMaildrops.Text.Length > 0;
            }
        }
Exemplo n.º 3
0
        public void OnConfigDialog()
        {
            ConfigDialog c = new ConfigDialog();

            c.ConfigChanged += new ConfigDialog.ConfigChangedDelegate(ConfigDialog_ConfigChanged);
            c.Show();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Callback for menu item. Open report creating dialog.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateReport(object sender, EventArgs e)
        {
            // Called when the menu item is clicked
            ConfigDialog dialog = new ConfigDialog(m_host);

            dialog.ShowDialog();
        }
    protected virtual void OnDialog(object sender, System.EventArgs e)
    {
        ConfigDialog dlg = new ConfigDialog();

        dlg.Run();
        dlg.Destroy();
    }
Exemplo n.º 6
0
        public bool showConfigDialog(ConfigDialog dialog)
        {
            bool ret = OgrePINVOKE.Root_showConfigDialog(swigCPtr, ConfigDialog.getCPtr(dialog));

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 7
0
 private void OnConfigureClick(object sender, EventArgs e)
 {
     if (m_oDialog == null)
     {
         m_oDialog = new ConfigDialog();
     }
     if (m_oDialog.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     m_bConfigurationChanged = true;
 }
Exemplo n.º 8
0
        public MainWindow()
        {
            InitializeComponent();
            if (null == Application.Current)
            {
                new System.Windows.Application();
            }
            mListBox.ItemsSource      = logs;
            mOpenMenuButton.Click    += mOpenMenuButton_Click;
            mSettingMenuButton.Click += mSettingMenuButton_Click;
            mApplication              = Application.Current;
            XDocument xml = XDocument.Load(Environment.CurrentDirectory + @"\configuration.xml");

            mPorts = (from Port in xml.Descendants("Port")
                      select new RTUSerialPort((from Slave in Port.Descendants("Slave")
                                                select new RTUSlave(byte.Parse(Slave.Attribute("SlaveId").Value), (from Parameter in Slave.Descendants("Parameter")
                                                                                                                   select new Parameter(Parameter.Attribute("Type").Value, ushort.Parse(Parameter.Attribute("Address").Value), Parameter.Attribute("Name").Value)).ToArray <Parameter>(), Slave.Attribute("SlaveName").Value)).ToArray <RTUSlave>(), Port.Attribute("PortName").Value, Port.Attribute("DisplayName").Value)).ToArray <RTUSerialPort>();
            Loaded += delegate
            {
                rowCount    = (int)Math.Floor(mVoltageGrid.ActualHeight / 320);
                columnCount = (int)Math.Floor(mVoltageGrid.ActualWidth / 320);
                PageCount   = 0;
                for (int i = 0; i < mPorts.Count(); i++)
                {
                    for (int j = 0; j < mPorts[i].mSlaves.Count(); j++)
                    {
                        PageCount++;
                    }
                }
                var x = PageCount / (rowCount * columnCount);
                var y = PageCount % (rowCount * columnCount);;
                PageCount = y > 0 ? x + 1 : x;
                for (int i = 0; i < rowCount; i++)
                {
                    mVoltageGrid.RowDefinitions.Add(new RowDefinition());
                }
                for (int i = 0; i < columnCount; i++)
                {
                    mVoltageGrid.ColumnDefinitions.Add(new ColumnDefinition());
                }
                JumpToPage(1);
                ConfigDialog dialog = new ConfigDialog(true);
                dialog.Owner = this;
                if (dialog.ShowDialog() == true)
                {
                    RtuHelper helper = new RtuHelper(mPorts, OnMessage, dialog.mBaudrate, dialog.mParity, dialog.mDataBits, dialog.mStopBit);
                }
                else
                {
                    RtuHelper helper = new RtuHelper(mPorts, OnMessage);
                }
            };
        }
Exemplo n.º 9
0
    // GUI.Buttons.Configuration
    protected void ButtonNew(object sender, EventArgs e)
    {
        ConfigDialog dialog = new ConfigDialog();

        if (dialog.Run() == (int)ResponseType.Ok)
        {
            conf             = dialog.Configuration;
            conf.initialized = true;
            UpdatePerceptron();
        }
        dialog.Destroy();
    }
Exemplo n.º 10
0
        public void ShowConfigDialog()
        {
            ConfigDialog dialog = new ConfigDialog();

            dialog.StartPosition = FormStartPosition.CenterParent;
            dialog.SetConfig(this);
            dialog.ShowDialog();
            if (dialog.Result == ConfigDialogResult.SaveReboot)
            {
                console.forceStopTimer();
                Program.Reboot = true;
                this.Close();
            }
        }
Exemplo n.º 11
0
        private static void OnOpenConfig(object parameter)
        {
            var dialog = new ConfigDialog();

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            if (!MessageService.ShowYesNoQuestion(null, "To take the config changes in account you have to restart the application. Do you want to restart ?"))
            {
                return;
            }

            Process.Start(Application.ResourceAssembly.Location);
            Application.Current.Shutdown();
        }
Exemplo n.º 12
0
    protected void ButtonEdit(object sender, EventArgs e)
    {
        if (!hasPerceptron)
        {
            return;
        }

        ConfigDialog dialog = new ConfigDialog {
            Configuration = conf
        };

        if (dialog.Run() == (int)ResponseType.Ok)
        {
            conf = dialog.Configuration;
            UpdatePerceptron();
        }
        dialog.Destroy();
    }
Exemplo n.º 13
0
        private bool _configure( )
        {
            // instantiate the Root singleton
            engine = new Root( "AxiomDemos.log" );

            _setupResources();

            // HACK: Temporary
            ConfigDialog dlg = new ConfigDialog();
            DialogResult result = dlg.ShowDialog();
			if ( result == DialogResult.Cancel )
			{
				Root.Instance.Dispose();
				engine = null;
				return false;
			}

            return true;
        }
Exemplo n.º 14
0
        protected override MenuList OnGetMenuItems()
        {
            MenuList list = base.OnGetMenuItems();

            if (WeatherController.Weather.Condition != null)
            {
                list[MenuListContainer.Header].Add(new MenuItem(Catalog.GetString("Radar _Map"),
                                                                WeatherController.Weather.Image, (o, a) => WeatherController.Weather.ShowRadar()));
            }


            list.SetContainerTitle(MenuListContainer.Actions, Mono.Unix.Catalog.GetString("Forecasts"));
            for (int i = 0; i < WeatherController.Weather.ForecastDays; i++)
            {
                if (WeatherController.Weather.Forecasts [i].dow != null)
                {
                    list[MenuListContainer.Actions].Add(new ForecastMenuItem(i,
                                                                             string.Format("{0}", WeatherForecast.DayName(WeatherController.Weather.Forecasts [i].dow)), WeatherController.Weather.Forecasts [i].image));
                }
            }

            list[MenuListContainer.CustomOne].Add(new MenuItem(Catalog.GetString("_Settings"), Gtk.Stock.Preferences,
                                                               delegate {
                if (Config == null)
                {
                    Config = new WeatherConfigDialog();
                }
                Config.Show();
            }));

            if (WeatherController.CurrentLocation != "")
            {
                list[MenuListContainer.CustomOne].Add(new MenuItem(Catalog.GetString("Check _Weather"), Gtk.Stock.Refresh,
                                                                   delegate {
                    Status = WeatherDockletStatus.ManualReload;
                    State |= ItemState.Wait;
                    QueueRedraw();
                    WeatherController.ResetTimer();
                }));
            }

            return(list);
        }
Exemplo n.º 15
0
 protected override ClickAnimation OnClicked(uint button, Gdk.ModifierType mod, double xPercent, double yPercent)
 {
     if (button == 1)
     {
         if (WeatherPreferences.Locations.Length == 0)
         {
             if (Config == null)
             {
                 Config = new WeatherConfigDialog();
             }
             Config.Show();
         }
         else
         {
             ShowPainter(painter);
         }
     }
     return(ClickAnimation.None);
 }
Exemplo n.º 16
0
        private void RunInternal()
        {
            Config.Load();
            _configDialog = new ConfigDialog(this);
            var form = Config.Shape.StartsWith("横長") ? (Form) new HorizontalMainForm() : new VerticalMainForm();

            _form         = form;
            _mainBehavior = new MainWindow(this, form);
            _proxyManager = new ProxyManager(_form, Config);
            _proxyManager.UpdatePacFile();
            _errorLog = new ErrorLog(Sniffer);
            Sniffer.RepeatingTimerController = _mainBehavior.Notifier;
            LoadData();
            ApplyConfig();
            ApplySettings();
            HttpProxy.AfterSessionComplete += HttpProxy_AfterSessionComplete;
            _mainTimer.Tick += TimerTick;
            Application.Run(_form);
            Terminate();
        }
Exemplo n.º 17
0
        public async Task OpenConfiguration(
            DataProvider dataProvider, byte selectedTabIndex = 0,
            WindowType hostIdentifier = WindowType.Root)
        {
            try
            {
                var viewModel = new ConfigViewModel(dataProvider)
                {
                    SelectedTabIndex = selectedTabIndex
                };
                var view = new ConfigDialog {
                    ViewModel = viewModel
                };

                await DialogHost.Show(view, Common.GetEnumDescription(hostIdentifier));
            }
            catch (Exception e)
            {
            }
        }
Exemplo n.º 18
0
        private void ShowConfigDialog()
        {
            m_reset = new ManualResetEvent(false);
            Dispatcher.BeginInvoke((Action)(() =>
            {
                Hide();

                var dialog = new ConfigDialog();
                if (!Equals(dialog.ShowDialog(), true))
                {
                    Application.Current.Shutdown();
                }
                else
                {
                    Show();
                    m_reset.Set();
                }
            }));
            m_reset.WaitOne();
        }
Exemplo n.º 19
0
            public override bool OnCommand()
            {
                Log.Debug("Launching the configure tool");

                Config options = (Config)Plugin.Options;
                options.Save();

                ConfigDialog dlg = new ConfigDialog();
                dlg.propertyGrid1.SelectedObject = options;

                if(dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                {
                    Plugin.Options = Config.Load(options.mFileName);
                }
                else
                {
                    options.Save();
                }

                return true;
            }
Exemplo n.º 20
0
            public override bool OnCommand()
            {
                Log.Debug("Launching the configure tool");

                Options options = (Options)Plugin.Options;

                options.Save();

                ConfigDialog dlg = new ConfigDialog();

                dlg.propertyGrid1.SelectedObject = options;

                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                {
                    Plugin.Options = Options.Load(options.mFileName);
                }
                else
                {
                    options.Save();
                }

                return(true);
            }
Exemplo n.º 21
0
        protected override ClickAnimation OnClicked(uint button, Gdk.ModifierType mod, double xPercent, double yPercent)
        {
            if (button == 1)
            {
                if (string.IsNullOrEmpty(GMailPreferences.User) || string.IsNullOrEmpty(GMailPreferences.Password))
                {
                    if (config == null)
                    {
                        config = new GMailConfigDialog();
                    }
                    config.Show();
                }
                else
                {
                    UpdateAttention(false);

                    OpenInbox();
                    return(ClickAnimation.Bounce);
                }
            }

            return(ClickAnimation.None);
        }
Exemplo n.º 22
0
        public Main()
        {
            Log.Debug("Start");

            this.InitializeComponent();

            this._deviceConfigurationHelper = new DeviceConfigurationHelper();
            this._deviceConfiguration       = this._deviceConfigurationHelper.LoadConfig("default");

            using (var dialog = new ConfigDialog(_deviceConfiguration))
            {
                dialog.StartPosition = FormStartPosition.CenterParent;
                var dialogResult = dialog.ShowDialog(this);
                switch (dialogResult)
                {
                case DialogResult.OK:
                    this._deviceConfiguration = dialog.DeviceConfiguration;
                    this._deviceConfigurationHelper.SaveConfig("default", this._deviceConfiguration);
                    break;

                case DialogResult.Cancel:
                case DialogResult.None:
                    Task.Run(() => this.Invoke(o => o.Close()));
                    return;
                }
            }

            this.Text = $"Alturos PanTilt TestUI - v{Application.ProductVersion}";
            this.labelPositionPan.Text  = "Pan: ?,??";
            this.labelPositionTilt.Text = "Tilt: ?,??";

            this.SetConfigurationInfo();

            var startPtHeadCommunication = Task.Run(() => this.StartPanTiltCommunication());

            this.UpdateMousePanel();

            if (this._deviceConfiguration.CameraActive)
            {
                //Live Camera Image
                var url = $"http://{this._deviceConfiguration.CameraIpAddress}{this._deviceConfiguration.CameraJpegUrl}";

                IVideoSource source = new JPEGStream(url);
                ((JPEGStream)source).FrameInterval = 200;

                this._videoSourcePlayer = new Accord.Controls.VideoSourcePlayer
                {
                    VideoSource = source,
                    Dock        = DockStyle.Fill
                };
                this._videoSourcePlayer.Start();
                this.tabPageLiveView.Controls.Add(this._videoSourcePlayer);
            }
            else
            {
                //Visual Map
                this._cameraDrawEngine = new DrawEngine(4);
                this.UpdateCurrentImage();
                this.pictureBox_CameraPos.Visible = true;
            }

            startPtHeadCommunication.Wait();

            if (this._panTiltControl != null)
            {
                this.continiousMovementControl1.SetPanTiltControl(this._panTiltControl);
                this.fastMovementControl1.SetPanTiltControl(this._panTiltControl);
                this.absolutePositionControl1.SetPanTiltControl(this._panTiltControl);
                this.eneoUserControl1.SetPanTiltControl(this._panTiltControl);
                this.alturosUserControl1.SetPanTiltControl(this._panTiltControl);
                this.movementFloodControl1.SetPanTiltControl(this._panTiltControl);
                this.commandSequenceControl1.SetPanTiltControl(this._panTiltControl);
                this.alturosUserControl1.SetDeviceConfiguration(this._deviceConfiguration);
                this.feedbackAnalyzeControl1.SetPanTiltControl(this._panTiltControl);
                this._panTiltControl.PanTiltAbsolute(0, 0);
            }
        }
Exemplo n.º 23
0
 public bool ShowConfigDialog(ICodecConfig currentConfig)
 {
     ConfigDialog dialog = new ConfigDialog(currentConfig);
     dialog.ShowDialog();
     return dialog.Cancelled;
 }
Exemplo n.º 24
0
		void ShowConfig ()
		{
			if (config == null)
				config = new NPRConfigDialog ();
			config.Show ();	
		}
Exemplo n.º 25
0
        /// <summary>
        /// The config button was clicked.
        /// </summary>
        /// <param name="sender">The sending object.</param>
        /// <param name="e">The event.</param>
        private void BtnConfig_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new ConfigDialog();

            dialog.Show();
        }
Exemplo n.º 26
0
        void mSettingMenuButton_Click(object sender, RoutedEventArgs e)
        {
            ConfigDialog dialog = new ConfigDialog(false);

            dialog.ShowDialog();
        }
Exemplo n.º 27
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ConfigDialog obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemplo n.º 28
0
        ///
        /// Run the configuration dialog.
        ///
        protected void _ConfigBtnClick( object sender, EventArgs args )
        {
            try
             {
            _Trace( "[_ConfigBtnClick]" );

            if (PlayerApp.isStandalone)
            {
               // Don't mess with the database while playing!
               _StopPlayback();

               DatabaseConfigDialog configDlg =
                  new DatabaseConfigDialog( _mainWindow,
                                            _settings.connectString,
                                            _settings.mp3RootDir );
               configDlg.Run();
               if (configDlg.isOk)
               {
                  _settings.connectString = configDlg.connectString;
                  _settings.mp3RootDir = configDlg.mp3RootDir;

                  PlayerApp.connectionString = configDlg.connectString;
                  PlayerApp.mp3RootDir = configDlg.mp3RootDir;

                  _settings.Store();

               }
            }
            else
            {
               // Run the client-server config dialog:

               ConfigDialog config =
                  new ConfigDialog( _mainWindow,
                                    _settings.serverName,
                                    _settings.serverPort.ToString() );

               config.Run();
               if (config.isOk)
               {
                  _settings.serverName = config.serverName;
                  _settings.serverPort = config.serverPort;

                  //
                  // Set the new server url
                  //
                  PlayerApp.serverUrl =
                     "tcp://" + _settings.serverName + ":"
                     + _settings.serverPort + "/Engine";

                  // If we got here, nothing threw an exception. Wow!
                  // Save for future generations!
                  _settings.Store();
               }
            }
             }
             catch (Exception e)
             {
            _Complain( "Something went wrong configuring or saving settings",
                       e );
             }
        }
Exemplo n.º 29
0
        private void ServerConfigCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ConfigDialog cd = new ConfigDialog();

            cd.ShowDialog();
        }
Exemplo n.º 30
0
        public Main()
        {
            this.InitializeComponent();

            this._deviceConfigurationHelper = new DeviceConfigurationHelper();
            this._deviceConfiguration       = this._deviceConfigurationHelper.LoadConfig("default");

            using (var dialog = new ConfigDialog(_deviceConfiguration))
            {
                dialog.StartPosition = FormStartPosition.CenterParent;
                var dialogResult = dialog.ShowDialog(this);
                switch (dialogResult)
                {
                case DialogResult.OK:
                    this._deviceConfiguration = dialog.DeviceConfiguration;
                    this._deviceConfigurationHelper.SaveConfig("default", this._deviceConfiguration);
                    break;

                case DialogResult.Cancel:
                case DialogResult.None:
                    Task.Run(() => this.Invoke(o => o.Close()));
                    return;
                }
            }

            this.Text = $"Alturos PanTilt TestUI ({Application.ProductVersion})";
            this.SetConfigurationInfo();

            var startPtHeadCommunication = Task.Run(() => this.StartPanTiltCommunication());

            this.UpdateMousePanel();
            this.panelMouseControl.MouseWheel += MouseWheelZoom;

            //Disable TabPage Zoom - No ZoomProvider available
            //this.tabControl1.TabPages.Remove(this.tabPageCameraZoom);
            this._zoomProvider = new MockZoomProvider();
            this._zoomProvider.SetZoomAsync(0);
            this._zoomProvider.ZoomChanged += CameraControlZoomChanged;

            if (this._deviceConfiguration.CameraActive)
            {
                //Live Camera Image
                var url = $"http://{this._deviceConfiguration.CameraIpAddress}{this._deviceConfiguration.CameraJpegUrl}";

                IVideoSource source = new JPEGStream(url);
                ((JPEGStream)source).FrameInterval = 200;

                this._videoSourcePlayer             = new Accord.Controls.VideoSourcePlayer();
                this._videoSourcePlayer.VideoSource = source;
                this._videoSourcePlayer.Start();
                this._videoSourcePlayer.Dock = DockStyle.Fill;
                this.tabPageLiveView.Controls.Add(this._videoSourcePlayer);
            }
            else
            {
                //Visual Map
                this._cameraDrawEngine = new DrawEngine(4);
                this.UpdateCurrentImage();
                this.pictureBox_CameraPos.Visible = true;
            }

            startPtHeadCommunication.Wait();

            if (this._panTiltControl != null)
            {
                this.continiousMovementControl1.SetPanTiltControl(this._panTiltControl);
                this.fastMovementControl1.SetPanTiltControl(this._panTiltControl);
                this.absolutePositionControl1.SetPanTiltControl(this._panTiltControl);
                this._panTiltControl.PanTiltAbsolute(0, 0);
            }
        }
Exemplo n.º 31
0
        public void OnLevelLoaded(LoadMode mode)
        {
            try
            {
                Log.Message("ModCorral.OnLevelLoaded() " + mode.ToString());

                if (mode == LoadMode.LoadGame || mode == LoadMode.NewGame)
                {
                    if (mcButton == null) // if not created yet
                    {
                        // add button to the end of the TSBar MainToolstrip (UITabStrip)
                        UIView uiv = UIView.GetAView();

                        if (uiv != null)
                        {
                            UITabstrip ts = uiv.FindUIComponent <UITabstrip>("MainToolstrip");

                            if (ts != null)
                            {
                                UIButton policiesButton = ts.Find <UIButton>("Policies"); // we use this as a template to get 'most' of what we need set up
                                mcButton = ts.AddTab("ModCorral", policiesButton, false);

                                // find the panel added in the ts tabcontainer
                                foreach (UIComponent c in ts.tabContainer.components)
                                {
                                    if (c.name.Contains("ModCorral"))
                                    {
                                        TabPanel       = c as UIPanel;
                                        c.clipChildren = false;
                                        c.opacity      = 0; // otherwise our panel gets clicks obscured when it's in the same place...

                                        break;
                                    }
                                }

                                // initial position info
                                StartingAbsPosY = ts.absolutePosition.y - 20; // get rid of hardcoded 20...

                                ts.eventSelectedIndexChanged += ts_eventSelectedIndexChanged;

                                if (mcButton != null)
                                {
                                    StartingAbsPosX = mcButton.absolutePosition.x;

                                    mcButton.tooltip              = "Open Mod Corral";
                                    mcButton.eventTooltipShow    += (component, param) => { param.tooltip.relativePosition = new Vector3(param.tooltip.relativePosition.x + 25, param.tooltip.relativePosition.y + 10, param.tooltip.relativePosition.z); };
                                    mcButton.foregroundSpriteMode = UIForegroundSpriteMode.Scale;
                                    mcButton.scaleFactor          = 0.6f; // to fit a little better when using options sprites
                                    mcButton.normalFgSprite       = "Options";
                                    mcButton.hoveredFgSprite      = "OptionsHovered";
                                    mcButton.focusedFgSprite      = "OptionsFocused";
                                    mcButton.pressedFgSprite      = "OptionsPressed";
                                    mcButton.disabledFgSprite     = "OptionsDisabled";
                                    mcButton.eventClick          += mcButton_eventClick;
                                    mcButton.clipChildren         = false;

                                    UIPanel fscont = uiv.FindUIComponent <UIPanel>("FullScreenContainer");

                                    if (fscont != null)
                                    {
                                        // create our ui panel
                                        mcPanel = (ModCorralUI)fscont.AddUIComponent(typeof(ModCorralUI));
                                    }
                                    else
                                    {
                                        Log.Message("no fullscreencontainer");
                                    }

                                    if (mcPanel != null)
                                    {
                                        mcPanel.transform.parent = fscont.transform;
                                        mcPanel.initialize();
                                        //mcPanel.anchor = UIAnchorStyle.All;

                                        mcPanel.isVisible = false;
                                    }

                                    ModCorralConfigDialog             = (ConfigDialog)uiv.AddUIComponent(typeof(ConfigDialog));
                                    ModCorralConfigDialog.ParentPanel = mcPanel;
                                    ModCorralConfigDialog.isVisible   = false;
                                }
                            }
                            else
                            {
                                Log.Message("failed to find maintoolstrip");
                            }
                        }
                    }

                    // add any buttons that might have been registered before we got created
                    if (CorralRegistration.RegisteredMods != null)
                    {
                        foreach (ModRegistrationInfo mri in CorralRegistration.RegisteredMods)
                        {
                            if (!mri.IsButtonInitialized())
                            {
                                if (mri is ToggleModRegistrationInfo)
                                {
                                    ToggleModRegistrationInfo tmri = mri as ToggleModRegistrationInfo;

                                    tmri.ToggleButton = mcPanel.ScrollPanel.AddAToggleButton(tmri);
                                }
                                else
                                {
                                    mri.ModButton = mcPanel.ScrollPanel.AddAButton(mri);
                                }
                            }
                        }

                        UpdateNewCount();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("ModCorral.OnLevelLoaded() Exception: " + ex.Message);
            }
        }
Exemplo n.º 32
0
        protected override MenuList OnGetMenuItems()
        {
            MenuList list = base.OnGetMenuItems();;

            UpdateAttention(false);

            List <MenuItem> items = new List <MenuItem> ();

            if (!string.IsNullOrEmpty(GMailPreferences.User) && !string.IsNullOrEmpty(GMailPreferences.Password))
            {
                items.Add(new MenuItem(Catalog.GetString("_View ") + Atom.CurrentLabel,
                                       "gmail",
                                       delegate {
                    Clicked(1, Gdk.ModifierType.None, 0, 0);
                }));
                items.Add(new MenuItem(Catalog.GetString("_Compose Mail"),
                                       "mail-message-new",
                                       delegate {
                    DockServices.System.Open(BaseUrl + "/#compose");
                }));
                items.Add(new MenuItem(Catalog.GetString("View C_ontacts"),
                                       "addressbook",
                                       delegate {
                    DockServices.System.Open(BaseUrl + "/#contacts");
                }));

                if (Atom.HasUnread)
                {
                    items.Add(new SeparatorMenuItem(Catalog.GetString("New Mail")));

                    foreach (UnreadMessage message in Atom.Messages.Take(10))
                    {
                        items.Add(new GMailMenuItem(message, "gmail"));
                    }
                }

                items.Add(new SeparatorMenuItem());
            }

            items.Add(new MenuItem(Catalog.GetString("_Settings"),
                                   Gtk.Stock.Preferences,
                                   delegate {
                if (config == null)
                {
                    config = new GMailConfigDialog();
                }
                config.Show();
            }));

            if (!string.IsNullOrEmpty(GMailPreferences.User) && !string.IsNullOrEmpty(GMailPreferences.Password))
            {
                items.Add(new MenuItem(Catalog.GetString("Check _Mail"),
                                       Gtk.Stock.Refresh,
                                       delegate {
                    Atom.ResetTimer(true);
                }));
            }

            list[MenuListContainer.Actions].InsertRange(0, items);

            return(list);
        }