Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        private void ProgramList_AfterSelect( )
        {
            try
            {
                if ( programListBox.SelectedNode == null )
                    return;
                switch ( programListBox.SelectedNode.Level )
                {
                    #region WhenRootNodeInTreeViewSelected
                    case 0: // RootNode Category Selected

                        Category selectedSoftwareCategory = Main.data.GetSoftwareCategory( programListBox.SelectedNode.Text );
                        if ( selectedSoftwareCategory != null )// && selectedSoftwareCategory.ItemType == Data.DataType.SoftwareCategory)
                        {

                            SaveExistingItem( );
                            {
                                publicWhatToAddComboBox.SelectedIndex = 0;
                                ItemNameTextBox.Text = selectedSoftwareCategory.name;
                                ItemNameTextBox.ForeColor = SystemColors.WindowText;
                                //  NameTextBox1.Enabled = false;
                                EditedItem = selectedSoftwareCategory.name;
                                EditedType = Data.DataType.SoftwareCategory;
                                DescriptionTextBox.Text = selectedSoftwareCategory.Description;
                                previousname = selectedSoftwareCategory.name;
                                iconPathTextBox.Text = selectedSoftwareCategory.IconPath;
                                //     iconFileLocal = selectedSoftwareCategory.IconFileLocal;
                                isExistingItemedit = true;
                                previousdatatype = Data.DataType.SoftwareCategory;
                            }
                            // on main menu

                            #region AddingImageToPreviewbox
                            Image im = Utils.GetImage( selectedSoftwareCategory.IconPath , Data.DataType.SoftwareCategory );
                            if ( im != null )
                            {
                                if ( publicWhatToAddComboBox.SelectedIndex == 0 )
                                {
                                    publicIconPreviewBox.Image = im;
                                }
                            }
                            #endregion

                        }

                        break;

                    #endregion
                    #region WhenSlaveNodeSelected
                    case 1:
                        //     MainMenuLinkLabel.Visible = true;

                        //  MainMenuSetupFileGroupBox1.Visible = true;
                        SoftwareItem selectedSoftwareItem = Main.data.GetSoftwareItem( programListBox.SelectedNode.Text );
                        if ( selectedSoftwareItem != null )// && selectedSoftwareItem.ItemType == Data.DataType.SoftwareItem)
                        {
                            SaveExistingItem( );
                            publicWhatToAddComboBox.SelectedIndex = 1;

                            {
                                EditedItem = selectedSoftwareItem.name;
                                EditedType = Data.DataType.SoftwareItem;
                                ItemNameTextBox.ForeColor = SystemColors.WindowText;
                                ItemNameTextBox.Text = selectedSoftwareItem.name;
                                DescriptionTextBox.Text = selectedSoftwareItem.Description;
                                iconPathTextBox.Text = selectedSoftwareItem.IconPath;
                                //    iconFileLocal = selectedSoftwareItem.IconFileLocal;
                                FileNameTextBox.Text = selectedSoftwareItem.SetupPath;
                                URITextBox.Text = selectedSoftwareItem.URI;
                                MD5TextBox.Text = selectedSoftwareItem.MD5;
                                VersionTextBox.Text = selectedSoftwareItem.Version;
                                directoryTexBox.Text = selectedSoftwareItem.Directory;
                                //    setupFileLocal = selectedSoftwareItem.SetupFileLocal;
                                previousdatatype = Data.DataType.SoftwareItem;
                                publicIconPreviewBox.Image = Utils.GetImage( selectedSoftwareItem.IconPath , Data.DataType.SoftwareItem );
                                isExistingItemedit = true;
                                previousname = selectedSoftwareItem.name;

                            }
                            // on main menu

                            if ( !Uri.IsWellFormedUriString( URITextBox.Text , UriKind.Absolute ) )
                                URITextBox.Text = @"http://";

                            Image im = Utils.GetImage( selectedSoftwareItem.IconPath , Data.DataType.SoftwareItem , selectedSoftwareItem.Directory );

                            if ( im != null && publicWhatToAddComboBox.SelectedIndex == 1 )
                            {
                                publicIconPreviewBox.Image = im;
                            }

                        }
                        break;
                }

                    #endregion
            }
            catch ( Exception ex )
            {
                Debug.WriteLine( ex.Message );
            }
        }
Esempio n. 2
0
 public static async Task <Result.ListSubscriptionsResult> ListSubscriptionsAsync(this IRecordingApi api, GoogleApiClient client, Data.DataType dataType)
 {
     return((await api.ListSubscriptions(client, dataType)).JavaCast <Result.ListSubscriptionsResult> ());
 }
Esempio n. 3
0
 public static async Task <Statuses> UnsubscribeAsync(this IRecordingApi api, GoogleApiClient client, Data.DataType dataType)
 {
     return((await api.Unsubscribe(client, dataType)).JavaCast <Statuses> ());
 }
Esempio n. 4
0
 public static async Task <Result.DailyTotalResult> ReadDailyTotalAsync(this IHistoryApi api, GoogleApiClient client, Data.DataType dataType)
 {
     return((await api.ReadDailyTotal(client, dataType)).JavaCast <Result.DailyTotalResult> ());
 }
        private Data generateData(XmlNodeList node, Data.DataType Type)
        {
            Data data_output = new Data(Type);

            foreach (XmlNode item in node)
            {
                switch (item.Name)
                {
                case "index":
                    data_output.Index = int.Parse(item.InnerText);
                    break;

                case "name":
                    data_output.Name = item.InnerText;
                    break;

                case "url":
                    data_output.Url = item.InnerText;
                    break;

                default:
                    break;
                }
            }

            // Get extra info if available
            if (Type == Data.DataType.App || Type == Data.DataType.Project)
            {
                // Read app's info file
                XmlElement appInfo = null;
                try
                {
                    appInfo = XmlWebReader.ReadFromWeb(data_output.Url).DocumentElement;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Infos not found for : " + data_output.Url);
                }

                if (appInfo == null)
                {
                    return(data_output);
                }

                foreach (XmlNode item in appInfo)
                {
                    switch (item.Name)
                    {
                    case "productname":
                        data_output.ProductName = item.InnerText;
                        break;

                    case "version":
                        data_output.Version = item.InnerText;
                        break;

                    case "description":
                        data_output.Description = item.InnerText;
                        break;

                    case "size":
                        data_output.Size = item.InnerText;
                        break;

                    case "date":
                        data_output.Date = item.InnerText;
                        break;

                    case "installer":
                        data_output.InstallerUrl = item.InnerText;
                        break;

                    case "url":
                        data_output.PublishUrl = item.InnerText;
                        break;

                    default:
                        break;
                    }
                }
            }

            return(data_output);
        }