BLOG-2-題目集4,5,6以及期中考試總結性blog

来源:https://www.cnblogs.com/21207312blog/archive/2023/11/19/17836781.html
-Advertisement-
Play Games

數據持久化 PlayerPrefs相關 PlayerPrefs是Unity游戲引擎中的一個類,用於在游戲中存儲和訪問玩家的偏好設置和數據。它可以用來保存玩家的游戲進度、設置選項、最高分數等信息。PlayerPrefs將數據存儲在本地文件中,因此可以在游戲重新啟動時保持數據的持久性。 //Player ...


(1)前言:在pta4.5.6次大作業和期中考試所包含的知識點主要有:理解類的概念,創建類和實例化對象。定義方法,方法的參數傳遞和返回值。使用條件語句(if-else)、迴圈語句(forwhile)等來控制菜單存儲和用戶輸入。用於存儲菜單選項和處理用戶的選擇的數組或類數組。題目的難度根據題目不同也有所不同,第四題的菜單題只需要做基本的菜單顯示和用戶輸入處理,隨後的5.6兩道題目要求考慮異常輸入的處理並需要使用更複雜的數據結構來實現菜單功能。題量相對適中,第4pta題目可能較為簡單,兩道大題主要是針對對類的設計和方法實現,另外兩道題目針對遍歷排序和日期比較考察了部分基礎知識和庫函數知識。第5.6道題目大幅度增加複雜度了而減少題目數量,其編程設計需要考慮更多的設計和實現細節。

(2) 設計與分析:

菜品包含特色口味輸出類的代碼時間複雜度大體上是O(n),其中n為輸入菜品記錄的數量。在程式中定義了

菜品:dishname菜名,price單價,Kind:菜的種類

菜單:包含菜品數組

桌子類:table_number: 桌號orders: 已點菜品列表

用戶類:name: 用戶名,pay用戶需付價格

菜品記錄類:order_number: 序號items: 已點菜品列表

  這些類的屬性和方法都比較簡單,因此這段代碼的整體邏輯清晰,易於理解和調試。在程式的主函數中,使用了Scanner類從用戶的輸入讀取輸入信息,根據Match判斷的返回值判斷其輸入格式是否正確後轉入相應的if語句中執行相應的操作。各自調用相關類的各種方法結合Dish中存儲的菜品價格和菜品類型計算所點菜品的價格最後得到訂單總價和用戶所需要付的價格後統一輸出,其中折扣判斷在桌號數據行輸入後日期折扣判斷已經完成,而後在計算時根據是否是特色菜結合日期判斷的折扣值計算價格。通過將不同的功能分別封裝在不同的類中,可以使得程式結構更加清晰,並且易於擴展和維護。

 

 

  對於多種錯誤輸入的菜品輸入的題目,由於其判斷代碼出現失誤,導致輸入語句在接收後不知道語句進入了哪個判斷語句,完全無法判斷錯誤輸入。最後總結為思路錯誤,無法適應錯誤輸入的數據並完成相應的輸出判斷。最後寫的代碼全部作廢,寫不下去了。

  關於期中考試的實驗題,之前的實驗題都是根據給出的類來完善主函數,而這次考試則是根據主函數來完善類中數據介面,導致有些措手不及。

  而對於第四次pta題目,對於第五第六次的題目而言實在是小巫見大巫,沒有可比性。

  (3)踩坑心得:在對輸入數據的處理過程中,一定要選擇合適的輸入數據判斷方法,一定要能夠兼顧完成對正常數據的輸入和異常數據的判斷和處理輸出,以應對題目需求。

Exception in thread "main" java.lang.NullPointerException: Cannot load from object array because "cou.stu" is null at Main.Match(Main.java:178) at Main.main(Main.java:278):在main函數中對類的聲明後沒有初始化便開始調用,使得指針嘗試將值存儲到一個空對象數組時出錯,為了避免此類情況的發生,對於對象類數組的調用一定要先確保其已經被正確初始化並分配了足夠的空間。
4)主要困難以及改進建議:對於對輸入數據的處理與判別尤其需要細心並且細緻討論各類情況,防止非法輸入導致程式無法正常運行。

5)總結:關於此次解題經驗,我總結了部分要點:

1.明確題目要求與意義:根據題目說明和所提供的示例輸入輸出等輔助信息理解題目要求與目的。

2.理清解題思路再寫代碼:在理解了題意後,先理清題目的解題思路,避免在編寫代碼的過程中出現錯誤。

3.考慮邊界條件和異常情況:在編寫題目時要考慮到各種可能的輸入情況,包括邊界值和異常情況,以保證代碼的穩定性。

4.不斷學習更新知識:題目的編寫過程也是對自己知識的回顧和鞏固,通過編寫題目可以不斷學習並更新自己的知識體系,只有這樣才能適應多變的題型。

總的來說,這次寫題目對我來說是一次很有收穫的經歷。通過這次寫題目,我鍛煉了自己的問題設計和解決能力,並提高了對編程知識的理解和應用能力。希望在以後的學習和實踐中能夠繼續加油,不斷提升自己的技術水平。

以下附特色口味菜品輸入源碼:

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Calendar;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Arrays;
import java.util.Comparator;
public class Main{
    public static class Dish
    {
        String name;//菜品名稱
        int level=-1;
        int kind=-1;
        int unit_price; //單價

        String[][] tastes = {
                {"不辣","微辣","稍辣", "", "很辣", "爆辣"},
                {"不酸","微酸","稍酸","","很酸"},
                {"不甜","微甜","稍甜",""}
        };
        String[] tastprint={"spicy","acidity","sweetness"};
        int getPrice(int portion)
        {
            int x=0;
            double temp=1;
            double prise=0;
            if(portion==2)
            {temp=1.5;}
            else if(portion==3)
            {temp=2;}
            prise=this.unit_price*temp;
            x=Math.round((float)prise);
            return x;
        }
        //計算菜品價格的方法,輸入參數是點菜的份額(輸入數據只能是1/2/3,代表小//大份) }
        //菜譜類:對應菜譜,包含飯店提供的所有菜的信息。
    }
    public static class Menu {
        Dish[] dishs=new Dish[10];//菜品數組,保存所有菜品信息
        int count  = 0;
        Dish searthDish(String dishName)//根據菜名在菜譜中查找菜品信息,返回Dish對象。
        {
            for(int i=0;i<count;i++)
            {
                if(dishs[i].name!=null) {
                    if(dishs[i].name.equals(dishName)) {
                        return dishs[i];
                    }
                }
            }
            //   System.out.print(dishName+" does not exist\n");
            return null;
        }
        int searthdish(String dishName)//根據菜名在菜譜中查找菜品信息,返回Dish對象。
        {
            for(int i=0;i<count;i++)
            {
                if(dishs[i].name!=null) {
                    if(dishs[i].name.equals(dishName)) {
                        return i;
                    }
                }
            }
            //   System.out.print(dishName+" does not exist\n");
            return -6;
        }
        void addDish(String[] word)//添加一道菜品信息
        {
            int unit_price=0;String dishName;

            if (this.dishs[count] == null)
            {
                this.dishs[count] = new Dish();
            }
            dishName=word[0];
            if(word.length==4)
            {
                unit_price=Integer.parseInt(word[2]);
            }
            else
            {
                if(word.length==2){
                    unit_price=Integer.parseInt(word[1]);}
                else
                {System.out.print("wrong format\n");
                    return;}
            }

            if (count > 1)
            {
                int i = searthdish(dishName);
                if (i != -6)
                {
                    this.dishs[i].name = dishName;
                    this.dishs[i].unit_price = unit_price;
                }
                else {
                    this.dishs[count].name = dishName;
                    this.dishs[count].unit_price = unit_price;
                    switch (word[1]) {
                        case "川菜":
                            this.dishs[count].kind=0;
                            break;
                        case "晉菜" :
                            this.dishs[count].kind=1;
                            break;
                        case "浙菜":
                            this.dishs[count].kind=2;
                            break;

                    }
                    count++;
                }
            }
            else
            {
                this.dishs[count].name = dishName;
                this.dishs[count].unit_price = unit_price;
                switch (word[1]) {
                    case "川菜":
                        this.dishs[count].kind=0;
                        break;
                    case "晉菜" :
                        this.dishs[count].kind=1;
                        break;
                    case "浙菜":
                        this.dishs[count].kind=2;
                        break;

                }
                count++;
            }

        }
    }
    //點菜記錄類:保存訂單上的一道菜品記錄
    public static class Record {

        int orderNum;//序號
        int orderX=0;//訂單份數
        Dish d;//菜品\\
        int replace=0;
        int replaced=0;
        int portion=0;//份額(1/2/3代表小*1/*1.5/大份*2\\

        int getPrice()//計價,計算本條記錄的價格\\
        {
            int ds=d.getPrice(portion);
            return ds;
        }


    }
    public static  class User
    {
        String name,tele;


        int pay=0;

    }

    //訂單類:保存用戶點的所有菜的信息。
    public static class Order {

        User user=new User();
        Record[] records=new Record[50];//保存訂單上每一道的記錄
        int ordercount=0;
        int temp=0;
        int[] time=new int[8];
        int[]  taste={0,0,0};
        int[]  tastecount={0,0,0};

        int getTotalPrice(int i)//計算訂單的總價
        {
            int price=0;
            if(i<ordercount){
                if(records[i]!=null)
                {price=price+records[i].getPrice()*records[i].orderX;}
            }
            return price;

        }
        void addARecord(int judge,int orderNum,String dishName,int portion,int num,int tense,Menu menu)//添加一條菜品信息到訂單中。
        {
            if(this.records[this.ordercount]==null)
            {this.records[this.ordercount]=new Record();}

            this.records[this.ordercount].replace=judge;
            this.records[this.ordercount].orderNum=orderNum;
            this.records[this.ordercount].orderX=num;
            this.records[this.ordercount].portion=portion;

            if (menu.searthDish(dishName)!= null)
            {
                if (this.records[this.ordercount].replace!= 0)//代點菜
                {
                    this.records[this.ordercount].d = new Dish();
                    this.records[this.ordercount].d =menu.searthDish(dishName);


                    if(this.records[this.ordercount].d.kind!=-1) {
                        this.records[this.ordercount].d.level=tense;
                        if(this.records[this.ordercount].d.tastes[this.records[this.ordercount].d.kind].length<=tense)
                        {
                            System.out.print(this.records[this.ordercount].d.tastprint[this.records[this.ordercount].d.kind]+" num out of range : "+tense+"\n");
                            this.ordercount--;
                        }
                        else
                        {
                            System.out.print(orderNum + " table " + (this.time[0]) + " pay for table " + this.records[this.ordercount].replace+ " " + this.records[this.ordercount].getPrice() * this.records[this.ordercount].orderX + "\n");
                        }

                    }
                    else
                    {
                        System.out.print(orderNum + " table " + (this.time[0]) + " pay for table " + this.records[this.ordercount].replace + " " + this.records[this.ordercount].getPrice() * this.records[this.ordercount].orderX + "\n");
                    }
                }
                else//自點菜
                {
                    this.records[this.ordercount].d = new Dish();
                    this.records[this.ordercount].d=menu.searthDish(dishName);

                    if(this.records[this.ordercount].d.kind!=-1) {
                        this.records[this.ordercount].d.level=tense;
                        if(this.records[this.ordercount].d.tastes[this.records[this.ordercount].d.kind].length<=tense)
                        {
                            System.out.print(this.records[this.ordercount].d.tastprint[this.records[this.ordercount].d.kind]+" num out of range :"+tense+"\n");
                            this.ordercount--;
                        }
                        else
                        {

                            this.taste[this.records[this.ordercount].d.kind]=this.taste[this.records[this.ordercount].d.kind]+tense*this.records[this.ordercount].orderX;
                            this.tastecount[this.records[this.ordercount].d.kind]=this.tastecount[this.records[this.ordercount].d.kind]+this.records[this.ordercount].orderX;
                         //   System.out.print("   "+this.taste[this.records[this.ordercount].d.kind]+"   "+this.records[this.ordercount].orderX+"\n\n");
                            System.out.print(this.records[this.ordercount].orderNum + " " + this.records[this.ordercount].d.name + " " + this.records[this.ordercount].getPrice() * this.records[this.ordercount].orderX + "\n");
                        }

                    }
                    else
                    {
                        System.out.print(this.records[this.ordercount].orderNum + " " + this.records[this.ordercount].d.name + " " + this.records[this.ordercount].getPrice() * this.records[this.ordercount].orderX + "\n");
                    }

                }
                this.ordercount++;
            }
            else if (menu.searthDish(dishName) == null)
            {
                System.out.print(dishName + " does not exist\n");
            }

        }
        void delARecordByOrderNum(int orderNum,Menu menu)//根據序號刪除一條記錄
        {
            if(records[orderNum]!=null)
            {
                if(records[orderNum].d!=null) {
                    if (menu.searthDish(records[orderNum].d.name) != null) {
                        records[orderNum].orderX = 0;
                        records[orderNum].d.kind=-1;
                    }
                }
                else
                {
                    System.out.print("delete error;\n");
                }
            }
            else
                System.out.print("delete error;\n");

        }
        int addtable(String str,long[] num)
        {
            for (int j = 0; j < 8; j++)
            {
                if (j == 1)
                {
                    this.time[j+1] =(int)num[j+1];
                    j++;
                }
                else
                {
                    this.time[j] =(int)num[j];
                }
            }
            String[] word=str.split("\\s+");
            this.user.name=word[3];
            this.user.tele=word[4];

            if(word[4].length()!=11)
            {System.out.print("wrong format\n");
                return 0;}
            if (judgetime(this.time,(int)num[0])==0) {
                System.out.print("table " + num[0]+ " out of opening hours\n");
                return 0;
            }
            else
            {
                System.out.print("table " + num[0] + ": \n");
                return 1;
            }
        }
    }//Order

    public static int Match(String x)
    {
        int num=99;
        String regex1="\\S{1,10} \\d{1,2}$";

        String regex11="\\S{1,10} \\p{IsHan}{1,10} \\d{1,2} T$";

        String regex2="table \\d{1} : [a-z]{1,10} \\d{1,11} \\d{4}/\\d{1,2}/\\d{1,2} \\d{1,2}/\\d{1,2}/\\d{1,2}$";

        String regex3="\\d{1} \\S{1,10} [1-3] \\d{1,2}$";//zz普通菜
        String regex4="\\d{1} \\d{1} \\S{1,10} [1-3] \\d{1,2}$";//dd普通菜

        String regex31="\\d{1} \\S{1,10} \\d{1} [1-3] \\d{1,2}$";//zz特色菜
        String regex41="\\d{1} \\d{1,2} \\S{1,10} \\d{1} [1-3] \\d{1,2}$";//dd特色菜


        String regex32="\\d{1,2} \\S{1,10} \\d{1} [1-3] \\d{1,2}$";//zz
        String regex42="\\d{1,2} \\d{1,2} \\S{1,10} \\d{1} [1-3] \\d{1,2}$";//dd

        String regex5="\\d{1} delete$";

        Pattern pattern1=Pattern.compile(regex1);
        Pattern pattern11=Pattern.compile(regex11);//T
        Pattern pattern2=Pattern.compile(regex2);
        Pattern pattern3=Pattern.compile(regex3);
        Pattern pattern4=Pattern.compile(regex4);
        Pattern pattern31=Pattern.compile(regex31);
        Pattern pattern41=Pattern.compile(regex41);
        Pattern pattern32=Pattern.compile(regex32);
        Pattern pattern42=Pattern.compile(regex42);


        Pattern pattern5=Pattern.compile(regex5);

        Matcher matcher1=pattern1.matcher(x);
        Matcher matcher11=pattern11.matcher(x);//T
        Matcher matcher2=pattern2.matcher(x);
        Matcher matcher3=pattern3.matcher(x);
        Matcher matcher4=pattern4.matcher(x);
        Matcher matcher5=pattern5.matcher(x);
        Matcher matcher31=pattern31.matcher(x);
        Matcher matcher41=pattern41.matcher(x);

        if(matcher1.matches())
        {
            num=0;}//麻婆豆腐 12
        else if(matcher2.matches())
        {
            num=1;}
        else if(matcher3.matches())
        {
            num=2;}//3 麻辣雞絲 1 2
        else if(matcher4.matches())
        {
            num=3;}//1 4 麻婆豆腐 1 1代付菜
        else if(matcher5.matches())
        {
            num=4;}//1 delete
        else if(matcher11.matches())
        {
            num=11;
        }
        else if(matcher31.matches())
        {
            num=31;
        }
        else if(matcher41.matches())
        {
            num=41;
        }
        return num;
    }

    public  static double judgetime(int[] time,int table)
    {
            /*周一至周五營業時間與折扣:晚上(1700-20308折,周一至周五中午(10:30--14:306折,其餘時間不營業。
            周末全價,營業時間:9:30-21:30*/
        double n=0;
        double temp=0;
        Calendar calendar = Calendar.getInstance();
        calendar.set(time[2],(time[3]-1),time[4]);
        int weekday = calendar.get(Calendar.DAY_OF_WEEK);
        //獲取星期幾,周日為1,周一為2
        n=time[5]*3600+time[6]*60+time[7];
        //17:00-20:30   61200-73800
        //10:30-14:30   37800-52200
        if(weekday>1&&weekday<7)
        {
            if (n>=37800&&n<=52200)
            {
                temp=0.6;
            }
            else if(n>=61200&&n<=73800)
            {
                temp=0.8;
            }
            else
            {
                temp=0;
            }
        }
        //9:30-21:30    34200-77400
        else if(weekday==1||weekday==7)
        {
            if (n>=34200&&n<=77400)
            {
                temp=1;
            }
            else
            {
                temp=0;
            }
        }
        return temp;
    }
    public static boolean isTimeInRange(LocalDateTime time, LocalTime startTime, LocalTime endTime) {
        LocalTime givenTime = time.toLocalTime();
        return givenTime.isAfter(startTime) && givenTime.isBefore(endTime);
    }
    public static double discountnum(Order order,double judge,int num)
    {
        double dis=0;
        if(order.records[num].d.kind!=-1)
        {
            if(judge==0.8||judge==0.6)
            {dis=0.7;}
            else if(judge==1)
            {dis=1;}
        }
        else
        {
            dis=judge;
        }
        return dis;
    }
    /*
    周一至周五營業時間晚上(1700-20308折,
    周一至周五中午(10:30--14:306折,其餘時間不營業。
    周末全價,營業時間:9:30-21:30

    例如:麻婆豆腐 川菜 9 T
    菜價的計算方法:
    周一至周五 7折, 周末全價。
    */
    public static void dishout(Order order)
    {
        Dish dish=new Dish();
        int aver=0;

        if(order.tastecount[0]!=0)
        {
            aver=(int)Math.round((double)order.taste[0]/(double)order.tastecount[0]);

//System.out.print(" \n\ntaste"+order.taste[0]+"    count"+order.tastecount[0]+"  aver"+aver+"\n\n");
            System.out.print(" 川菜 "+order.tastecount[0]+" "+dish.tastes[0][aver]);

        }
        if(order.tastecount[1]!=0)
        {
            aver=(int)Math.round((double)order.taste[1]/(double)order.tastecount[1]);//
            System.out.print(" 晉菜 "+order.tastecount[1]+" "+dish.tastes[1][aver]);
        }
        if(order.tastecount[2]!=0)
        {
            aver=(int)Math.round((double)order.taste[2]/(double)order.tastecount[2]);//
            System.out.print(" 浙菜 "+order.tastecount[2]+" "+dish.tastes[2][aver]);
        }
        if(order.tastecount[0]==0&&order.tastecount[1]==0&&order.tastecount[2]==0)
        {
            System.out.print(" ");
        }
    }

    public static void userout(Order[] order,int[] tablex,double[] price, int x)
    {
        User[] users=new User[20];
        int count=0;
        int judge=0;
        String[] word=new String[20];


        for (int i = 0; i < x; i++)
        {
            if (count == 0)
            {
                word[count]=order[tablex[i]].user.name;
                count++;
            }
            else
            {
                for (int j = 0; j < count; j++) {
                    if (order[tablex[i]].user.name.equals(word[j])) {
                        judge=1;
                        break;
                    }
                }
                if (judge == 0) {
                    word[count]=order[tablex[i]].user.name;
                    count++;
                } else if (judge == 1) {
                    judge = 0;
                }
            }
        }
        //  Arrays.sort(word);
        Arrays.sort(word, Comparator.nullsLast(Comparator.naturalOrder()));
        for (int i = 0; i < count; i++)
        {
            if(users[i]==null)
            {users[i]=new User();}

            for (int j = 0; j < x; j++)
            {
                if(word[i].equals(order[tablex[j]].user.name))
                {
                    users[i].name=order[tablex[j]].user.name;
                    users[i].tele=order[tablex[j]].user.tele;
                    users[i].pay=users[i].pay+(int)price[j];
                }
            }

        }

        System.out.print("\n");
        for(int i=0;i<count;i++)
        {
            System.out.print(users[i].name+" "+users[i].tele+" "+users[i].pay);
            if(i+1<count){
                System.out.print("\n");}
        }

    }


    public static void main(String[] args)
    {
        Order[] order=new Order[20];
        Menu menu=new Menu();
        User[]  user=new User[20];
        Scanner scan=new Scanner(System.in);

        String regexf="\\p{IsHan}{1,10}";
        String regexn="\\d{1,12}";
        Pattern patternf=Pattern.compile(regexf);
        Pattern patternx=Pattern.compile(regexn);


        String str;//輸入數據存儲
        String dishname = null;

        int n=0;//判斷輸入格式返回值
        int table=0;//桌號計數
        long[] num=new long[9];//臨時點菜存儲數據
        int[] tablex=new int[10];
        int[][] delet=new int[10][2];
        int del=0;//刪除單號數據

        int[] price=new int[10];//總價存儲數組
        double[] disprice=new double[10];
        double dis=0,dis1=0;

        while(true)
        {
            str=scan.nextLine();
            if(str.equals("end"))
            {
                for(int i=0;i<table;i++)
                {
                    dis1=judgetime(order[tablex[i]].time,i);
                    if (dis1!=0)//輸出價格
          

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • int i=1; i=i++; int j=i++; int k=i + ++i * i++; System.out.println("i="+i); System.out.println("j="+j); System.out.println("k="+k); ...
  • 寫在前面 今天狀態很不好,我發現學這部分知識的時候,會出現溜號或者註意力無法集中的情況。 我能想到的是,大概率是這部分知識,應該是超出了我現在的水平了,也就是說我存在知識斷層了,整體感覺真的是一知半解。 那有同學會問了,那你能說明白嗎? 我理解的肯定能呀,來往下看! Flask的使用 1、消息閃現的 ...
  • rust中的枚舉有什麼用?枚舉可以嵌入類型的好處是什麼 你可以在同一個枚舉中既有單個值,也有元組或結構體。 枚舉的每個變體可以擁有不同數量和類型的關聯數據。 這增加了類型的靈活性和表達力,使你能夠更精確地建模你的數據。 我知道rust可以為枚舉創建方法,那在哪種場景下枚舉會比結構體會有優勢 表示多個 ...
  • 公眾號「架構成長指南」,專註於生產實踐、雲原生、分散式系統、大數據技術分享。 在這篇文章中,我們將通過示例來學習 Java 函數式介面。 函數式介面的特點 只包含一個抽象方法的介面稱為函數式介面。 它可以有任意數量的預設靜態方法,但只能包含一個抽象方法。它還可以聲明對象類的方法。 函數介面也稱為單一 ...
  • 大家好,我是 Java 陳序員。許可權認證是我們日常開發繞不過的話題,這是因為我們的應用程式需要防護,防止被竄入和攻擊。 在 Java 後端開發中,實現許可權認證有很多種方案可以選擇,一個攔截器、過濾器也許就可以輕鬆搞定。當然,現在也有很多成熟的框架,供我們選擇。輕量的 Shiro,Spring 家族的 ...
  • TIM輸出比較(OC): 主要功能輸出PWM波形,PWM波形是驅動電機的必要條件,所以信息TIM輸出比較就等於學習PWM CNT:計數器,計數自增,CCR:捕獲比較寄存器,程式員給定的一個值 當CNT,大於、小於、大於CCR時,輸出就會置0,置1,置0....,一個不斷跳變的pwm的波形 每個高級定 ...
  • 在今天的學習中,我們簡要瞭解了Python的控制流程,特別是if-else判斷和迴圈操作。作為有著Java開發經驗的程式員,我們跳過了一些基礎概念,著重探討if判斷和迴圈的靈活運用。Python的縮進寫法和與Java的一些語法區別都是需要註意的地方。在編寫程式時,if嵌套和迴圈是基礎結構,而設計模式... ...
  • 教程簡介 本文將簡單描述視頻網站教程,視頻網站是一個類似於騰訊視頻一樣的網站,視頻資源用戶自己上傳,然後提供友好的界面查看視頻和搜索視頻,並且提供管理頁面對於視頻進行管理,我們將使用Blazor作為前端,並且由MasaFramework作為後端框架,一般情況下我們需要做簡單的許可權管理,對於用戶登錄我 ...
一周排行
    -Advertisement-
    Play Games
  • 最近做項目過程中,使用到了海康相機,官方只提供了C/C++的SDK,沒有搜尋到一個合適的封裝了的C#庫,故自己動手,簡單的封裝了一下,方便大家也方便自己使用和二次開發 ...
  • 前言 MediatR 是 .NET 下的一個實現消息傳遞的庫,輕量級、簡潔高效,用於實現進程內的消息傳遞機制。它基於中介者設計模式,支持請求/響應、命令、查詢、通知和事件等多種消息傳遞模式。通過泛型支持,MediatR 可以智能地調度不同類型的消息,非常適合用於領域事件處理。 在本文中,將通過一個簡 ...
  • 前言 今天給大家推薦一個超實用的開源項目《.NET 7 + Vue 許可權管理系統 小白快速上手》,DncZeus的願景就是做一個.NET 領域小白也能上手的簡易、通用的後臺許可權管理模板系統基礎框架。 不管你是技術小白還是技術大佬或者是不懂前端Vue 的新手,這個項目可以快速上手讓我們從0到1,搭建自 ...
  • 第1章:WPF概述 本章目標 瞭解Windows圖形演化 瞭解WPF高級API 瞭解解析度無關性概念 瞭解WPF體繫結構 瞭解WPF 4.5 WPF概述 ​ 歡迎使用 Windows Presentation Foundation (WPF) 桌面指南,這是一個與解析度無關的 UI 框架,使用基於矢 ...
  • 在日常開發中,並不是所有的功能都是用戶可見的,還在一些背後默默支持的程式,這些程式通常以服務的形式出現,統稱為輔助角色服務。今天以一個簡單的小例子,簡述基於.NET開發輔助角色服務的相關內容,僅供學習分享使用,如有不足之處,還請指正。 ...
  • 第3章:佈局 本章目標 理解佈局的原則 理解佈局的過程 理解佈局的容器 掌握各類佈局容器的運用 理解 WPF 中的佈局 WPF 佈局原則 ​ WPF 視窗只能包含單個元素。為在WPF 視窗中放置多個元素並創建更貼近實用的用戶男面,需要在視窗上放置一個容器,然後在這個容器中添加其他元素。造成這一限制的 ...
  • 前言 在平時項目開發中,定時任務調度是一項重要的功能,廣泛應用於後臺作業、計劃任務和自動化腳本等模塊。 FreeScheduler 是一款輕量級且功能強大的定時任務調度庫,它支持臨時的延時任務和重覆迴圈任務(可持久化),能夠按秒、每天/每周/每月固定時間或自定義間隔執行(CRON 表達式)。 此外 ...
  • 目錄Blazor 組件基礎路由導航參數組件參數路由參數生命周期事件狀態更改組件事件 Blazor 組件 基礎 新建一個項目命名為 MyComponents ,項目模板的交互類型選 Auto ,其它保持預設選項: 客戶端組件 (Auto/WebAssembly): 最終解決方案裡面會有兩個項目:伺服器 ...
  • 先看一下效果吧: isChecked = false 的時候的效果 isChecked = true 的時候的效果 然後我們來實現一下這個效果吧 第一步:創建一個空的wpf項目; 第二步:在項目裡面添加一個checkbox <Grid> <CheckBox HorizontalAlignment=" ...
  • 在編寫上位機軟體時,需要經常處理命令拼接與其他設備進行通信,通常對不同的命令封裝成不同的方法,擴展稍許麻煩。 本次擬以特性方式實現,以兼顧維護性與擴展性。 思想: 一種命令對應一個類,其類中的各個屬性對應各個命令段,通過特性的方式,實現其在這包數據命令中的位置、大端或小端及其轉換為對應的目標類型; ...