예제 #1
0
        public void Reload()
        {
            // Load data from via service
            ContentData[] contentData = null;
            try
            {
                Service service = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlContentEditProperties)this.properties).ServiceLocation]);
                contentData = service.GetContentData();
                foreach (ContentData contentDataEntry in contentData)
                {
                    contentDataEntry.Content = contentDataEntry.Content.Replace("\n", "\r\n");
                }
                CSBoosterMonitor.GetServiceForm().AppendMessage("Daten aktualisiert -> " + this.Text);
            }
            catch (SoapException ex)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message);
            }
            catch (WebException exc)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(exc.Message);
            }

            // Bind the data to the grid control
            this.bindingSource1.DataSource = contentData;
        }
 private void DataLoaded(IAsyncResult asyncResult)
 {
     try
     {
         MethodInfo      methodInfo        = ServiceHelper.GetMethodInfo(((MonitorControlStatisticsProperties)this.properties).ServiceName, "End", "", new Type[] { typeof(IAsyncResult) });
         Service         service           = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlStatisticsProperties)this.properties).ServiceLocation]);
         ChartDataPair[] chartDataPairList = (ChartDataPair[])methodInfo.Invoke(service, new object[] { asyncResult });
         this.chartDataPairBindingSource.DataSource = chartDataPairList;
         this.chartControl1.Invoke(new ChartCallback(this.chartControl1.Titles.Clear));
         this.chartControl1.Invoke(new ChartCallback(this.chartControl1.Refresh));
         CSBoosterMonitor.GetServiceForm().Invoke(new ServiceFormCallback(CSBoosterMonitor.GetServiceForm().AppendMessage), new object[] { "Daten aktualisiert -> " + this.Text });
     }
     catch (Exception ex1)
     {
         try
         {
             CSBoosterMonitor.GetServiceForm().Invoke(new ServiceFormCallback(CSBoosterMonitor.GetServiceForm().AppendMessage), new object[] { ex1.InnerException.Message + " -> " + this.Text });
             this.chartDataPairBindingSource.Clear();
             this.chartControl1.Titles[0].Text = "fehlende Berechtigung oder Fehler aufgetreten";
             this.chartControl1.Invoke(new ChartCallback(this.chartControl1.Refresh));
         }
         catch (Exception ex2)
         {
             CSBoosterMonitor.GetServiceForm().Invoke(new ServiceFormCallback(CSBoosterMonitor.GetServiceForm().AppendMessage), new object[] { ex2.Message });
         }
     }
 }
        public void Reload(bool callAsync)
        {
            try
            {
                DevExpress.XtraCharts.ChartTitle chartTitle = new DevExpress.XtraCharts.ChartTitle();
                chartTitle.Antialiasing = true;
                chartTitle.Font         = new Font("Tahoma", 10);
                chartTitle.TextColor    = Color.Black;
                chartTitle.Text         = "lade Daten...";
                this.chartControl1.Titles.Clear();
                this.chartControl1.Titles.Add(chartTitle);

                // Wait until the chart control is ready
                IntPtr handle = this.chartControl1.Handle;

                if (callAsync)
                {
                    ReloadAsync();
                }
                else
                {
                    ReloadSync();
                }
            }
            catch (SoapException ex)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message);
            }
            catch (WebException exc)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(exc.Message);
            }
        }
예제 #4
0
        public void Reload()
        {
            // Load ads from via service
            CSBAdCampaign[] adCampaigns = null;
            CSBAdWord[]     adWords     = null;
            try
            {
                Service service = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlAdCampaignsProperties)this.properties).ServiceLocation]);
                adCampaigns = service.GetAdCampaigns();
                adWords     = service.GetAdWords();
                CSBoosterMonitor.GetServiceForm().AppendMessage("Daten aktualisiert -> " + this.Text);
            }
            catch (SoapException ex)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
            }
            catch (WebException exc)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(exc.Message + " -> " + this.Text);
            }

            // Bind ads to the grid control
            this.bindingSource1.DataSource = adCampaigns;
            this.bindingSource2.DataSource = adWords;
        }
예제 #5
0
 public static Service GetService(string url)
 {
     if (!services.ContainsKey(url))
     {
         Service service = new Service();
         service.Timeout = 30000;
         service.Url     = url;
         service.AuthenticationHeaderValue = CSBoosterMonitor.GetAuthHeader();
         services.Add(url, service);
         ServiceForm serviceForm = CSBoosterMonitor.GetServiceForm();
         serviceForm.AppendMessage("Lade Service [" + service.Url + "] ...");
     }
     return(services[url]);
 }
        public void Reload()
        {
            // Load users from via service
            CSBDataObject[] dataObjects = null;
            try
            {
                Service service = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlFeaturedContentEditProperties)this.properties).ServiceLocation]);
                dataObjects = service.GetDataObjects(this.objectIdTextBox.Text, this.communityIdTextBox.Text, this.userIdTextBox.Text, this.featuredCheckBox.Checked);
                CSBoosterMonitor.GetServiceForm().AppendMessage("Daten aktualisiert -> " + this.Text);
            }
            catch (SoapException ex)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
            }
            catch (WebException exc)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(exc.Message + " -> " + this.Text);
            }

            // Bind the users to the grid control
            this.bindingSource1.DataSource = dataObjects;
        }
예제 #7
0
        public void Reload()
        {
            // Load users from via service
            User[] users = null;
            try
            {
                Service service = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlUsersProperties)this.properties).ServiceLocation]);
                users = service.GetUsers(this.usernameTextBox.Text, this.emailTextBox.Text, this.lockedCheckBox.Checked);
                CSBoosterMonitor.GetServiceForm().AppendMessage("Daten aktualisiert -> " + this.Text);
            }
            catch (SoapException ex)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
            }
            catch (WebException exc)
            {
                CSBoosterMonitor.GetServiceForm().AppendMessage(exc.Message + " -> " + this.Text);
            }

            // Bind the users to the grid control
            this.bindingSource1.DataSource = users;
        }
예제 #8
0
        private void OnCellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName == "Content")
            {
                if (DialogResult.Yes == MessageBox.Show("Möchten sie diesen Inhalt speichern?", "Änderung speichern", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    try
                    {
                        DevExpress.XtraGrid.Views.Grid.GridView gridView = ((DevExpress.XtraGrid.Views.Grid.GridView)sender);
                        ContentData contentData = (ContentData)gridView.GetRow(e.RowHandle);

                        CSBoosterMonitor.GetServiceForm().AppendMessage("Ändere Inhalt mit Schlüssel " + contentData.Key + " ...");

                        Service service = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlContentEditProperties)this.properties).ServiceLocation]);
                        service.SetContentData(contentData.Key, contentData.Content);
                    }
                    catch (SoapException ex)
                    {
                        CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
                    }
                }
                this.Reload();
            }
        }
        private void OnCellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName == "Featured")
            {
                DevExpress.XtraGrid.Views.Grid.GridView gridView = ((DevExpress.XtraGrid.Views.Grid.GridView)sender);
                CSBDataObject dataObject = (CSBDataObject)gridView.GetRow(e.RowHandle);

                Service service = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlFeaturedContentEditProperties)this.properties).ServiceLocation]);

                if ((bool)e.Value == true)
                {
                    CSBoosterMonitor.GetServiceForm().AppendMessage("Feature " + dataObject.Title + " ...");
                    try
                    {
                        service.FeatureDataObject(dataObject.ObjectId.ToString(), true);
                    }
                    catch (SoapException ex)
                    {
                        CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
                    }
                }
                else
                {
                    CSBoosterMonitor.GetServiceForm().AppendMessage("Stufe " + dataObject.Title + " zurück ...");
                    try
                    {
                        service.FeatureDataObject(dataObject.ObjectId.ToString(), false);
                    }
                    catch (SoapException ex)
                    {
                        CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
                    }
                }
                this.Reload();
            }
        }
예제 #10
0
        private void Initialize(Role[] roles)
        {
            this.addMonitorSubMenu.ClearLinks();
            List <Role> roleList = new List <Role>(roles);

            if (roleList.Contains(Role.StatisticsViewer))
            {
                this.addMonitorSubMenu.AddItem(this.newStatisticsMonitorItem);
            }
            if (roleList.Contains(Role.UserManager))
            {
                this.addMonitorSubMenu.AddItem(this.newUserMonitorItem);
                this.addMonitorSubMenu.AddItem(this.newContentEditorItem);
                this.addMonitorSubMenu.AddItem(this.newFeaturedContentEditorItem);
                this.addMonitorSubMenu.AddItem(this.newAdCampaignEditorItem);
            }

            this.mainMenuBar.ClearLinks();
            this.mainMenuBar.AddItem(this.fileMenu);
            this.mainMenuBar.AddItem(this.viewMenu);
            this.mainMenuBar.AddItem(this.settingsMenu);
            this.mainMenuBar.AddItem(this.helpMenu);
            this.settingsMenu.ClearLinks();
            this.settingsMenu.AddItem(this.monitorSettingsItem);
            this.settingsMenu.AddItem(this.loadSettingsItem);
            this.settingsMenu.AddItem(this.saveSettingsItem);

            // Add mdi form
            ServiceForm serviceForm = CSBoosterMonitor.GetServiceForm();

            serviceForm.MdiParent = this;
            serviceForm.Show();

            // Restore settings
            OnLoadSettingsItemClick(null, null);
        }
예제 #11
0
        private void OnCellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName == "IsLocked")
            {
                DevExpress.XtraGrid.Views.Grid.GridView gridView = ((DevExpress.XtraGrid.Views.Grid.GridView)sender);
                User user = (User)gridView.GetRow(e.RowHandle);

                Service service = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlUsersProperties)this.properties).ServiceLocation]);

                if ((bool)e.Value == true)
                {
                    CSBoosterMonitor.GetServiceForm().AppendMessage("Sperre " + user.Username + " ...");
                    try
                    {
                        service.LockUser(user.Username);
                    }
                    catch (SoapException ex)
                    {
                        CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
                    }
                }
                else
                {
                    CSBoosterMonitor.GetServiceForm().AppendMessage("Entsperre " + user.Username + " ...");
                    try
                    {
                        service.UnlockUser(user.Username);
                    }
                    catch (SoapException ex)
                    {
                        CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
                    }
                }
                this.Reload();
            }
        }
예제 #12
0
        private void OnCellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName == "Email")
            {
                if (DialogResult.Yes == MessageBox.Show("Möchten sie die Email Adresse speichern?", "Änderung speichern", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    try
                    {
                        DevExpress.XtraGrid.Views.Grid.GridView gridView = ((DevExpress.XtraGrid.Views.Grid.GridView)sender);
                        User user = (User)gridView.GetRow(e.RowHandle);

                        CSBoosterMonitor.GetServiceForm().AppendMessage("Ändere Email von " + user.Username + " ...");

                        Service service = ServiceHelper.GetService(Program.GetProperties().GetServiceUrls()[((MonitorControlUsersProperties)this.properties).ServiceLocation]);
                        service.SetUserEmail(user.Username, user.Email);
                    }
                    catch (SoapException ex)
                    {
                        CSBoosterMonitor.GetServiceForm().AppendMessage(ex.Message + " -> " + this.Text);
                    }
                }
                this.Reload();
            }
        }
예제 #13
0
 public CSBoosterMonitorProperties()
 {
     this.csboosterMonitor = new CSBoosterMonitor(this);
 }
예제 #14
0
 public MonitorControlProperties()
 {
     CSBoosterMonitor.AddSerializableType(this.GetType());
 }
예제 #15
0
        public LoginForm(CSBoosterMonitor csboosterMonitor)
        {
            InitializeComponent();

            this.csboosterMonitor = csboosterMonitor;
        }